[GH-ISSUE #173] Can't build module on Alma Linux 10.2 #104

Open
opened 2026-10-13 21:06:34 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @legacylynx on GitHub (May 27, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/173

I guess this also applies to RHEL 10.2 and other derivatives (Rocky, Oracle, etc).

My system:

kernel: 6.12.0-211.7.3.el10_2.x86_64
amneziawg-linux-kernel-module branch/commit: master/ac946a9df100a17d342b5982d1947deef1b51952

I managed to build the module by removing two redefines in compat.h.

# 1 - Trying to make without code changes
> make
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/main.o
In file included from <command-line>:
/tmp/amneziawg-linux-kernel-module/src/compat/compat.h:1300:9: warning: "timer_container_of" redefined
 1300 | #define timer_container_of from_timer
      |         ^~~~~~~~~~~~~~~~~~
In file included from ./include/linux/workqueue.h:10,
                 from ./include/linux/srcu.h:21,
                 from ./include/linux/notifier.h:16,
                 from ./arch/x86/include/asm/uprobes.h:13,
                 from ./include/linux/uprobes.h:61,
                 from ./include/linux/mm_types.h:16,
                 from ./include/linux/mmzone.h:22,
                 from ./include/linux/gfp.h:7,
                 from ./include/linux/xarray.h:16,
                 from ./include/linux/list_lru.h:14,
                 from ./include/linux/fs.h:13,
                 from ./include/linux/highmem.h:5,
                 from ./include/linux/bvec.h:10,
                 from ./include/linux/skbuff.h:17,
                 from ./include/linux/ip.h:16,
                 from ./include/linux/if_tunnel.h:5,
                 from ./include/net/ip_tunnels.h:5,
                 from ./include/net/udp_tunnel.h:5,
                 from /tmp/amneziawg-linux-kernel-module/src/compat/udp_tunnel/udp_tunnel_partial_compat.h:154,
                 from /tmp/amneziawg-linux-kernel-module/src/compat/compat.h:70:
./include/linux/timer.h:132:9: note: this is the location of the previous definition
  132 | #define timer_container_of(var, callback_timer, timer_fieldname)        \
      |         ^~~~~~~~~~~~~~~~~~
/tmp/amneziawg-linux-kernel-module/src/compat/compat.h:1314:20: error: static declaration of 'netif_threaded_enable' follows non-static declaration
 1314 | static inline void netif_threaded_enable(struct net_device *dev) { }
      |                    ^~~~~~~~~~~~~~~~~~~~~
In file included from ./include/net/ip_tunnels.h:6:
./include/linux/netdevice.h:593:6: note: previous declaration of 'netif_threaded_enable' with type 'void(struct net_device *)'
  593 | void netif_threaded_enable(struct net_device *dev);
      |      ^~~~~~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:229: /tmp/amneziawg-linux-kernel-module/src/main.o] Error 1
make[1]: *** [Makefile:1994: /tmp/amneziawg-linux-kernel-module/src] Error 2
make: *** [Makefile:27: module] Error 2

# 2 - Trying to make with first "hack" - remove netif_threaded_enable redefine for < KERNEL_VERSION(6, 17, 0)
> diff /tmp/amneziawg-linux-kernel-module/compat/compat.h /tmp/amneziawg-linux-kernel-module-rhel10.2-fix/src/compat/compat.h
1312,1315c1312,1315
< #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 17, 0)
< #include <linux/netdevice.h>
< static inline void netif_threaded_enable(struct net_device *dev) { }
< #endif
---
> //#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 17, 0)
> //#include <linux/netdevice.h>
> //static inline void netif_threaded_enable(struct net_device *dev) { }
> //#endif
> make
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/timers.o
In file included from <command-line>:
/tmp/amneziawg-linux-kernel-module/src/compat/compat.h:1300:9: warning: "timer_container_of" redefined
 1300 | #define timer_container_of from_timer
      |         ^~~~~~~~~~~~~~~~~~
In file included from ./include/linux/workqueue.h:10,
                 from ./include/linux/srcu.h:21,
                 from ./include/linux/notifier.h:16,
                 from ./arch/x86/include/asm/uprobes.h:13,
                 from ./include/linux/uprobes.h:61,
                 from ./include/linux/mm_types.h:16,
                 from ./include/linux/mmzone.h:22,
                 from ./include/linux/gfp.h:7,
                 from ./include/linux/xarray.h:16,
                 from ./include/linux/list_lru.h:14,
                 from ./include/linux/fs.h:13,
                 from ./include/linux/highmem.h:5,
                 from ./include/linux/bvec.h:10,
                 from ./include/linux/skbuff.h:17,
                 from ./include/linux/ip.h:16,
                 from ./include/linux/if_tunnel.h:5,
                 from ./include/net/ip_tunnels.h:5,
                 from ./include/net/udp_tunnel.h:5,
                 from /tmp/amneziawg-linux-kernel-module/src/compat/udp_tunnel/udp_tunnel_partial_compat.h:154,
                 from /tmp/amneziawg-linux-kernel-module/src/compat/compat.h:70:
./include/linux/timer.h:132:9: note: this is the location of the previous definition
  132 | #define timer_container_of(var, callback_timer, timer_fieldname)        \
      |         ^~~~~~~~~~~~~~~~~~
/tmp/amneziawg-linux-kernel-module/src/timers.c: In function 'wg_expired_retransmit_handshake':
/tmp/amneziawg-linux-kernel-module/src/compat/compat.h:1300:28: error: implicit declaration of function 'from_timer'; did you mean 'mod_timer'? [-Wimplicit-function-declaration]
 1300 | #define timer_container_of from_timer
      |                            ^~~~~~~~~~
/tmp/amneziawg-linux-kernel-module/src/timers.c:43:32: note: in expansion of macro 'timer_container_of'
   43 |         struct wg_peer *peer = timer_container_of(peer, timer,
      |                                ^~~~~~~~~~~~~~~~~~
/tmp/amneziawg-linux-kernel-module/src/timers.c:44:51: error: 'timer_retransmit_handshake' undeclared (first use in this function); did you mean 'wg_expired_retransmit_handshake'?
   44 |                                                   timer_retransmit_handshake);
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   wg_expired_retransmit_handshake
/tmp/amneziawg-linux-kernel-module/src/timers.c:44:51: note: each undeclared identifier is reported only once for each function it appears in
/tmp/amneziawg-linux-kernel-module/src/timers.c: In function 'wg_expired_send_keepalive':
/tmp/amneziawg-linux-kernel-module/src/timers.c:82:51: error: 'timer_send_keepalive' undeclared (first use in this function); did you mean 'sock_set_keepalive'?
   82 |                                                   timer_send_keepalive);
      |                                                   ^~~~~~~~~~~~~~~~~~~~
      |                                                   sock_set_keepalive
/tmp/amneziawg-linux-kernel-module/src/timers.c: In function 'wg_expired_new_handshake':
/tmp/amneziawg-linux-kernel-module/src/timers.c:95:51: error: 'timer_new_handshake' undeclared (first use in this function); did you mean 'wg_expired_new_handshake'?
   95 |                                                   timer_new_handshake);
      |                                                   ^~~~~~~~~~~~~~~~~~~
      |                                                   wg_expired_new_handshake
/tmp/amneziawg-linux-kernel-module/src/timers.c: In function 'wg_expired_zero_key_material':
/tmp/amneziawg-linux-kernel-module/src/timers.c:110:51: error: 'timer_zero_key_material' undeclared (first use in this function); did you mean 'wg_expired_zero_key_material'?
  110 |                                                   timer_zero_key_material);
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~~
      |                                                   wg_expired_zero_key_material
/tmp/amneziawg-linux-kernel-module/src/timers.c: In function 'wg_expired_send_persistent_keepalive':
/tmp/amneziawg-linux-kernel-module/src/timers.c:141:51: error: 'timer_persistent_keepalive' undeclared (first use in this function)
  141 |                                                   timer_persistent_keepalive);
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:229: /tmp/amneziawg-linux-kernel-module/src/timers.o] Error 1
make[1]: *** [Makefile:1994: /tmp/amneziawg-linux-kernel-module/src] Error 2
make: *** [Makefile:27: module] Error 2

# 3 - Trying to make with second "hack" - also remove timer_container_of redefine for < KERNEL_VERSION(6, 16, 0)
> diff /tmp/amneziawg-linux-kernel-module/compat/compat.h /tmp/amneziawg-linux-kernel-module-rhel10.2-fix/src/compat/compat.h
1299,1301c1299,1301
< #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
< #define timer_container_of from_timer
< #endif
---
> //#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
> //#define timer_container_of from_timer
> //#endif
1312,1315c1312,1315
< #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 17, 0)
< #include <linux/netdevice.h>
< static inline void netif_threaded_enable(struct net_device *dev) { }
< #endif
---
> //#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 17, 0)
> //#include <linux/netdevice.h>
> //static inline void netif_threaded_enable(struct net_device *dev) { }
> //#endif


> make
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/main.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/noise.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/device.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/peer.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/timers.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/queueing.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/send.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/receive.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/socket.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/peerlookup.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/allowedips.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/ratelimiter.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/cookie.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/netlink.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/junk.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/magic_header.o
  LD [M]  /tmp/amneziawg-linux-kernel-module/src/amneziawg.o
  MODPOST /tmp/amneziawg-linux-kernel-module/src/Module.symvers
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/amneziawg.mod.o
  CC [M]  /tmp/amneziawg-linux-kernel-module/src/.module-common.o
  LD [M]  /tmp/amneziawg-linux-kernel-module/src/amneziawg.ko
  BTF [M] /tmp/amneziawg-linux-kernel-module/src/amneziawg.ko
Skipping BTF generation for /tmp/amneziawg-linux-kernel-module/src/amneziawg.ko due to unavailability of vmlinux
> echo $?
0

Success! kmod also loads without errors, i can set up awg interface


I've made a more correct patch, which introduces additional conditions under which redefines are not applied - when RHEL 10.2 or later is used (with a reserve for the future).
I'll create a PR soon.

Originally created by @legacylynx on GitHub (May 27, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/173 I guess this also applies to RHEL 10.2 and other derivatives (Rocky, Oracle, etc). My system: ``` kernel: 6.12.0-211.7.3.el10_2.x86_64 amneziawg-linux-kernel-module branch/commit: master/ac946a9df100a17d342b5982d1947deef1b51952 ``` I managed to build the module by removing two redefines in `compat.h`. <details> <summary># 1 - Trying to make without code changes </summary> ``` > make CC [M] /tmp/amneziawg-linux-kernel-module/src/main.o In file included from <command-line>: /tmp/amneziawg-linux-kernel-module/src/compat/compat.h:1300:9: warning: "timer_container_of" redefined 1300 | #define timer_container_of from_timer | ^~~~~~~~~~~~~~~~~~ In file included from ./include/linux/workqueue.h:10, from ./include/linux/srcu.h:21, from ./include/linux/notifier.h:16, from ./arch/x86/include/asm/uprobes.h:13, from ./include/linux/uprobes.h:61, from ./include/linux/mm_types.h:16, from ./include/linux/mmzone.h:22, from ./include/linux/gfp.h:7, from ./include/linux/xarray.h:16, from ./include/linux/list_lru.h:14, from ./include/linux/fs.h:13, from ./include/linux/highmem.h:5, from ./include/linux/bvec.h:10, from ./include/linux/skbuff.h:17, from ./include/linux/ip.h:16, from ./include/linux/if_tunnel.h:5, from ./include/net/ip_tunnels.h:5, from ./include/net/udp_tunnel.h:5, from /tmp/amneziawg-linux-kernel-module/src/compat/udp_tunnel/udp_tunnel_partial_compat.h:154, from /tmp/amneziawg-linux-kernel-module/src/compat/compat.h:70: ./include/linux/timer.h:132:9: note: this is the location of the previous definition 132 | #define timer_container_of(var, callback_timer, timer_fieldname) \ | ^~~~~~~~~~~~~~~~~~ /tmp/amneziawg-linux-kernel-module/src/compat/compat.h:1314:20: error: static declaration of 'netif_threaded_enable' follows non-static declaration 1314 | static inline void netif_threaded_enable(struct net_device *dev) { } | ^~~~~~~~~~~~~~~~~~~~~ In file included from ./include/net/ip_tunnels.h:6: ./include/linux/netdevice.h:593:6: note: previous declaration of 'netif_threaded_enable' with type 'void(struct net_device *)' 593 | void netif_threaded_enable(struct net_device *dev); | ^~~~~~~~~~~~~~~~~~~~~ make[2]: *** [scripts/Makefile.build:229: /tmp/amneziawg-linux-kernel-module/src/main.o] Error 1 make[1]: *** [Makefile:1994: /tmp/amneziawg-linux-kernel-module/src] Error 2 make: *** [Makefile:27: module] Error 2 ``` </details> <details> <summary># 2 - Trying to make with first "hack" - remove netif_threaded_enable redefine for < KERNEL_VERSION(6, 17, 0)</summary> ``` > diff /tmp/amneziawg-linux-kernel-module/compat/compat.h /tmp/amneziawg-linux-kernel-module-rhel10.2-fix/src/compat/compat.h 1312,1315c1312,1315 < #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 17, 0) < #include <linux/netdevice.h> < static inline void netif_threaded_enable(struct net_device *dev) { } < #endif --- > //#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 17, 0) > //#include <linux/netdevice.h> > //static inline void netif_threaded_enable(struct net_device *dev) { } > //#endif ``` ``` > make CC [M] /tmp/amneziawg-linux-kernel-module/src/timers.o In file included from <command-line>: /tmp/amneziawg-linux-kernel-module/src/compat/compat.h:1300:9: warning: "timer_container_of" redefined 1300 | #define timer_container_of from_timer | ^~~~~~~~~~~~~~~~~~ In file included from ./include/linux/workqueue.h:10, from ./include/linux/srcu.h:21, from ./include/linux/notifier.h:16, from ./arch/x86/include/asm/uprobes.h:13, from ./include/linux/uprobes.h:61, from ./include/linux/mm_types.h:16, from ./include/linux/mmzone.h:22, from ./include/linux/gfp.h:7, from ./include/linux/xarray.h:16, from ./include/linux/list_lru.h:14, from ./include/linux/fs.h:13, from ./include/linux/highmem.h:5, from ./include/linux/bvec.h:10, from ./include/linux/skbuff.h:17, from ./include/linux/ip.h:16, from ./include/linux/if_tunnel.h:5, from ./include/net/ip_tunnels.h:5, from ./include/net/udp_tunnel.h:5, from /tmp/amneziawg-linux-kernel-module/src/compat/udp_tunnel/udp_tunnel_partial_compat.h:154, from /tmp/amneziawg-linux-kernel-module/src/compat/compat.h:70: ./include/linux/timer.h:132:9: note: this is the location of the previous definition 132 | #define timer_container_of(var, callback_timer, timer_fieldname) \ | ^~~~~~~~~~~~~~~~~~ /tmp/amneziawg-linux-kernel-module/src/timers.c: In function 'wg_expired_retransmit_handshake': /tmp/amneziawg-linux-kernel-module/src/compat/compat.h:1300:28: error: implicit declaration of function 'from_timer'; did you mean 'mod_timer'? [-Wimplicit-function-declaration] 1300 | #define timer_container_of from_timer | ^~~~~~~~~~ /tmp/amneziawg-linux-kernel-module/src/timers.c:43:32: note: in expansion of macro 'timer_container_of' 43 | struct wg_peer *peer = timer_container_of(peer, timer, | ^~~~~~~~~~~~~~~~~~ /tmp/amneziawg-linux-kernel-module/src/timers.c:44:51: error: 'timer_retransmit_handshake' undeclared (first use in this function); did you mean 'wg_expired_retransmit_handshake'? 44 | timer_retransmit_handshake); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | wg_expired_retransmit_handshake /tmp/amneziawg-linux-kernel-module/src/timers.c:44:51: note: each undeclared identifier is reported only once for each function it appears in /tmp/amneziawg-linux-kernel-module/src/timers.c: In function 'wg_expired_send_keepalive': /tmp/amneziawg-linux-kernel-module/src/timers.c:82:51: error: 'timer_send_keepalive' undeclared (first use in this function); did you mean 'sock_set_keepalive'? 82 | timer_send_keepalive); | ^~~~~~~~~~~~~~~~~~~~ | sock_set_keepalive /tmp/amneziawg-linux-kernel-module/src/timers.c: In function 'wg_expired_new_handshake': /tmp/amneziawg-linux-kernel-module/src/timers.c:95:51: error: 'timer_new_handshake' undeclared (first use in this function); did you mean 'wg_expired_new_handshake'? 95 | timer_new_handshake); | ^~~~~~~~~~~~~~~~~~~ | wg_expired_new_handshake /tmp/amneziawg-linux-kernel-module/src/timers.c: In function 'wg_expired_zero_key_material': /tmp/amneziawg-linux-kernel-module/src/timers.c:110:51: error: 'timer_zero_key_material' undeclared (first use in this function); did you mean 'wg_expired_zero_key_material'? 110 | timer_zero_key_material); | ^~~~~~~~~~~~~~~~~~~~~~~ | wg_expired_zero_key_material /tmp/amneziawg-linux-kernel-module/src/timers.c: In function 'wg_expired_send_persistent_keepalive': /tmp/amneziawg-linux-kernel-module/src/timers.c:141:51: error: 'timer_persistent_keepalive' undeclared (first use in this function) 141 | timer_persistent_keepalive); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [scripts/Makefile.build:229: /tmp/amneziawg-linux-kernel-module/src/timers.o] Error 1 make[1]: *** [Makefile:1994: /tmp/amneziawg-linux-kernel-module/src] Error 2 make: *** [Makefile:27: module] Error 2 ``` </details> <details> <summary># 3 - Trying to make with second "hack" - also remove timer_container_of redefine for < KERNEL_VERSION(6, 16, 0)</summary> ``` > diff /tmp/amneziawg-linux-kernel-module/compat/compat.h /tmp/amneziawg-linux-kernel-module-rhel10.2-fix/src/compat/compat.h 1299,1301c1299,1301 < #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0) < #define timer_container_of from_timer < #endif --- > //#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0) > //#define timer_container_of from_timer > //#endif 1312,1315c1312,1315 < #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 17, 0) < #include <linux/netdevice.h> < static inline void netif_threaded_enable(struct net_device *dev) { } < #endif --- > //#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 17, 0) > //#include <linux/netdevice.h> > //static inline void netif_threaded_enable(struct net_device *dev) { } > //#endif ``` ``` > make CC [M] /tmp/amneziawg-linux-kernel-module/src/main.o CC [M] /tmp/amneziawg-linux-kernel-module/src/noise.o CC [M] /tmp/amneziawg-linux-kernel-module/src/device.o CC [M] /tmp/amneziawg-linux-kernel-module/src/peer.o CC [M] /tmp/amneziawg-linux-kernel-module/src/timers.o CC [M] /tmp/amneziawg-linux-kernel-module/src/queueing.o CC [M] /tmp/amneziawg-linux-kernel-module/src/send.o CC [M] /tmp/amneziawg-linux-kernel-module/src/receive.o CC [M] /tmp/amneziawg-linux-kernel-module/src/socket.o CC [M] /tmp/amneziawg-linux-kernel-module/src/peerlookup.o CC [M] /tmp/amneziawg-linux-kernel-module/src/allowedips.o CC [M] /tmp/amneziawg-linux-kernel-module/src/ratelimiter.o CC [M] /tmp/amneziawg-linux-kernel-module/src/cookie.o CC [M] /tmp/amneziawg-linux-kernel-module/src/netlink.o CC [M] /tmp/amneziawg-linux-kernel-module/src/junk.o CC [M] /tmp/amneziawg-linux-kernel-module/src/magic_header.o LD [M] /tmp/amneziawg-linux-kernel-module/src/amneziawg.o MODPOST /tmp/amneziawg-linux-kernel-module/src/Module.symvers CC [M] /tmp/amneziawg-linux-kernel-module/src/amneziawg.mod.o CC [M] /tmp/amneziawg-linux-kernel-module/src/.module-common.o LD [M] /tmp/amneziawg-linux-kernel-module/src/amneziawg.ko BTF [M] /tmp/amneziawg-linux-kernel-module/src/amneziawg.ko Skipping BTF generation for /tmp/amneziawg-linux-kernel-module/src/amneziawg.ko due to unavailability of vmlinux > echo $? 0 ``` Success! kmod also loads without errors, i can set up awg interface </details> --- I've made a more correct patch, which introduces additional conditions under which redefines are not applied - when RHEL 10.2 or later is used (with a reserve for the future). I'll create a PR soon.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-linux-kernel-module#104
No description provided.