Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DKMS Install on ubuntu #56

Closed
KaygorodovIS opened this issue Nov 24, 2024 · 10 comments
Closed

DKMS Install on ubuntu #56

KaygorodovIS opened this issue Nov 24, 2024 · 10 comments

Comments

@KaygorodovIS
Copy link

Пытаюсь установить

add-apt-repository -y ppa:amnezia/ppa && apt install -y amneziawg

Получаю ошибку

rm: cannot remove 'kernel': Is a directory
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/amneziawg-dkms.0.crash'
Error! Bad return status for module build on kernel: 6.8.0-45-generic (x86_64)
Consult /var/lib/dkms/amneziawg/1.0.0/build/make.log for more information.
dpkg: error processing package amneziawg-dkms (--configure):
 installed amneziawg-dkms package post-installation script subprocess returned error exit status 10
Setting up curl (8.5.0-2ubuntu10.5) ...
dpkg: dependency problems prevent configuration of amneziawg:
 amneziawg depends on amneziawg-dkms (>= 0.0.20200121-2) | amneziawg-modules (>= 0.0.20191219); however:
  Package amneziawg-dkms is not configured yet.
  Package amneziawg-modules is not installed.

dpkg: error processing package amneziawg (--configure):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.12.0-4build2) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for libc-bin (2.39-0ubuntu8.3) ...
Errors were encountered while processing:
 amneziawg-dkms
 amneziawg
needrestart is being skipped since dpkg has failed

В логе /var/lib/dkms/amneziawg/1.0.0/build/make.log следующее:

DKMS make.log for amneziawg-1.0.0 for kernel 6.8.0-45-generic (x86_64)
Sun Nov 24 10:16:12 PM CET 2024
make: Entering directory '/var/lib/dkms/amneziawg/1.0.0/build'
Makefile:81: *** 
You're running a modern Linux Kernel (version 6.8.0-45-generic).

In order to build AmneziaWG kernel module for this kernel you must obtain sources of your kernel
by yourself and make a symlink to them into this directory:

    ln -s <path to kernel sources> kernel

After that please run make script again.  Stop.
make: Leaving directory '/var/lib/dkms/amneziawg/1.0.0/build'

В какой дирректори требуется сделать симлинк?
Пробовал добавить линк в /var/lib/dkms/amneziawg/1.0.0/build

... kernel -> /usr/src/linux-headers-6.8.0-45-generic/

И из этой же дирректории запустить make, но ошибка остаётся.
Так же наткнулся на #5 и пробовал сделать как в #47 - тоже не принесло результата.

@KaygorodovIS KaygorodovIS changed the title DKMS Install on ubunti DKMS Install on ubuntu Nov 24, 2024
@GlebGlebovAKAJJ
Copy link

У меня наблюдается проблема того же рода.

cat /var/lib/dkms/amneziawg/1.0.0/build/make.log
DKMS make.log for amneziawg-1.0.0 for kernel 6.8.0-49-generic (x86_64)
Чт 28 ноя 2024 07:33:35 MSK
make: Entering directory '/var/lib/dkms/amneziawg/1.0.0/build'
Makefile:81: *** 
You're running a modern Linux Kernel (version 6.8.0-49-generic).

In order to build AmneziaWG kernel module for this kernel you must obtain sources of your kernel
by yourself and make a symlink to them into this directory:

    ln -s <path to kernel sources> kernel

After that please run make script again.  Stop.
make: Leaving directory '/var/lib/dkms/amneziawg/1.0.0/build'

Симлинк пробовал устанавливать как на linux-source-6.8.0, так и на linux-headers-6.8.0-49-generic.
Но при попытке запуска команды make, ситуация не исправляется.

@WTFThatPerson
Copy link

WTFThatPerson commented Dec 4, 2024

I would NOT use installer from repository for new kernel. Instead:

  1. Load and unpack to some_kernel_directory FULL kernel tree, not headers only
  2. git clone amneziawg-linux-kernel-module and cd into its subdirectory src
  3. make symlink:
    ln -s some_kernel_directory kernel
  4. make && sudo make install as usual and you're back in black :)

Of course, You can go by way of pain and still try use amnezia-dkms; in such case You should use something like
ls -s some_kernel_directory /var/lib/dkms/amneziawg/1.0.0/build/kernel
then cd into /var/lib/dkms/amneziawg/1.0.0/build and use sudo make && sudo make install from there. And that's general plan only, so adding/editing is possible

@bloodybios
Copy link

bloodybios commented Dec 5, 2024

I would NOT use installer from repository for new kernel. Instead:

1. Load and unpack to some_kernel_directory FULL kernel tree, not headers only

2. git clone amneziawg-linux-kernel-module and cd into its subdirectory src

3. make symlink:
   `ln -s some_kernel_directory kernel`

4. make && sudo make install as usual and you're back in black :)

Of course, You can go by way of pain and still try use amnezia-dkms; in such case You should use something like ls -s some_kernel_directory /var/lib/dkms/amneziawg/1.0.0/build/kernel then cd into /var/lib/dkms/amneziawg/1.0.0/build and use sudo make && sudo make install from there. And that's general plan only, so adding/editing is possible

Если вы такой же тупик, как я, и не знаете где найти вот это вот "some_kernel_directory". Искать для ебунты, например, на сайте launchpad.net/ubuntu
PS. исходники нужной версии легче найти через гугл поиск по этому сайту, чем на самом сайте с ориентироваться xd

@KaygorodovIS
Copy link
Author

Удалось собрать через make && make-install. Thx @bloodybios @WTFThatPerson
Но при дальнейшей установке apt install -y amneziawg получил ошибку

Errors were encountered while processing:
 amneziawg-dkms
 amneziawg
needrestart is being skipped since dpkg has failed
cat /var/lib/dkms/amneziawg/1.0.0/build/make.log
DKMS make.log for amneziawg-1.0.0 for kernel 6.8.0-49-generic (x86_64)
Sat Dec  7 01:47:53 PM CET 2024
make: Entering directory '/var/lib/dkms/amneziawg/1.0.0/build'
Makefile:81: *** 
You're running a modern Linux Kernel (version 6.8.0-49-generic).

In order to build AmneziaWG kernel module for this kernel you must obtain sources of your kernel
by yourself and make a symlink to them into this directory:

    ln -s <path to kernel sources> kernel

After that please run make script again.  Stop.

Решил собрать amneziawg-dkms самостоятельно.

make dkms-install
dkms add -m amneziawg -v 1.0.0
dkms build -m amneziawg -v 1.0.0

И уже новая ошибка с gc

warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0
  You are using:           gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0
  CC [M]  /var/lib/dkms/amneziawg/1.0.0/build/generated/main.o
In file included from /var/lib/dkms/amneziawg/1.0.0/build/generated/noise.h:8,
                 from /var/lib/dkms/amneziawg/1.0.0/build/generated/device.h:9,
                 from /var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:7:
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:130:6: error: redeclaration of ‘enum message_size’
  130 | enum message_size {
      |      ^~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:120:6: note: originally defined here
  120 | enum message_size {
      |      ^~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:131:9: error: redeclaration of enumerator ‘MESSAGE_INITIATION_SIZE’
  131 |         MESSAGE_INITIATION_SIZE = sizeof(struct message_handshake_initiation),
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:121:9: note: previous definition of ‘MESSAGE_INITIATION_SIZE’ with type ‘enum message_size’
  121 |         MESSAGE_INITIATION_SIZE = sizeof(struct message_handshake_initiation),
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:132:9: error: redeclaration of enumerator ‘MESSAGE_RESPONSE_SIZE’
  132 |         MESSAGE_RESPONSE_SIZE = sizeof(struct message_handshake_response),
      |         ^~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:122:9: note: previous definition of ‘MESSAGE_RESPONSE_SIZE’ with type ‘enum message_size’
  122 |         MESSAGE_RESPONSE_SIZE = sizeof(struct message_handshake_response),
      |         ^~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:133:9: error: redeclaration of enumerator ‘MESSAGE_COOKIE_REPLY_SIZE’
  133 |         MESSAGE_COOKIE_REPLY_SIZE = sizeof(struct message_handshake_cookie),
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:123:9: note: previous definition of ‘MESSAGE_COOKIE_REPLY_SIZE’ with type ‘enum message_size’
  123 |         MESSAGE_COOKIE_REPLY_SIZE = sizeof(struct message_handshake_cookie),
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:134:9: error: redeclaration of enumerator ‘MESSAGE_TRANSPORT_SIZE’
  134 |         MESSAGE_TRANSPORT_SIZE = sizeof(struct message_data),
      |         ^~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:124:9: note: previous definition of ‘MESSAGE_TRANSPORT_SIZE’ with type ‘enum message_size’
  124 |         MESSAGE_TRANSPORT_SIZE = sizeof(struct message_data),
      |         ^~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:135:9: error: redeclaration of enumerator ‘MESSAGE_MAX_SIZE’
  135 |         MESSAGE_MAX_SIZE = 65535
      |         ^~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:125:9: note: previous definition of ‘MESSAGE_MAX_SIZE’ with type ‘enum message_size’
  125 |         MESSAGE_MAX_SIZE = 65535
      |         ^~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/device.h:53:8: error: redefinition of ‘struct amnezia_config’
   53 | struct amnezia_config {
      |        ^~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/device.h:40:8: note: originally defined here
   40 | struct amnezia_config {
      |        ^~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/device.h:80:31: error: duplicate member ‘advanced_security_config’
   80 |         struct amnezia_config advanced_security_config;
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/module.h:22,
                 from ./include/linux/device/driver.h:21,
                 from ./include/linux/device.h:32,
                 from ./include/linux/dma-mapping.h:8,
                 from ./include/linux/skbuff.h:28,
                 from /var/lib/dkms/amneziawg/1.0.0/build/generated/messages.h:15:
./include/linux/moduleparam.h:413:45: error: redefinition of ‘__check_bogus_endpoints’
  413 |         static inline type __always_unused *__check_##name(void) { return(p); }
      |                                             ^~~~~~~~
./include/linux/moduleparam.h:433:34: note: in expansion of macro ‘__param_check’
  433 | #define param_check_int(name, p) __param_check(name, p, int)
      |                                  ^~~~~~~~~~~~~
./include/linux/moduleparam.h:150:9: note: in expansion of macro ‘param_check_int’
  150 |         param_check_##type(name, &(value));                                \
      |         ^~~~~~~~~~~~
./include/linux/moduleparam.h:127:9: note: in expansion of macro ‘module_param_named’
  127 |         module_param_named(name, name, type, perm)
      |         ^~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:76:1: note: in expansion of macro ‘module_param’
   76 | module_param(bogus_endpoints, int, 0600);
      | ^~~~~~~~~~~~
./include/linux/moduleparam.h:413:45: note: previous definition of ‘__check_bogus_endpoints’ with type ‘int *(void)’
  413 |         static inline type __always_unused *__check_##name(void) { return(p); }
      |                                             ^~~~~~~~
./include/linux/moduleparam.h:433:34: note: in expansion of macro ‘__param_check’
  433 | #define param_check_int(name, p) __param_check(name, p, int)
      |                                  ^~~~~~~~~~~~~
./include/linux/moduleparam.h:150:9: note: in expansion of macro ‘param_check_int’
  150 |         param_check_##type(name, &(value));                                \
      |         ^~~~~~~~~~~~
./include/linux/moduleparam.h:127:9: note: in expansion of macro ‘module_param_named’
  127 |         module_param_named(name, name, type, perm)
      |         ^~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:71:1: note: in expansion of macro ‘module_param’
   71 | module_param(bogus_endpoints, int, 0600);
      | ^~~~~~~~~~~~
./include/linux/moduleparam.h:289:27: error: redefinition of ‘__param_str_bogus_endpoints’
  289 |         static const char __param_str_##name[] = prefix #name;          \
      |                           ^~~~~~~~~~~~
./include/linux/moduleparam.h:176:9: note: in expansion of macro ‘__module_param_call’
  176 |         __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
      |         ^~~~~~~~~~~~~~~~~~~
./include/linux/moduleparam.h:151:9: note: in expansion of macro ‘module_param_cb’
  151 |         module_param_cb(name, &param_ops_##type, &value, perm);            \
      |         ^~~~~~~~~~~~~~~
./include/linux/moduleparam.h:127:9: note: in expansion of macro ‘module_param_named’
  127 |         module_param_named(name, name, type, perm)
      |         ^~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:76:1: note: in expansion of macro ‘module_param’
   76 | module_param(bogus_endpoints, int, 0600);
      | ^~~~~~~~~~~~
./include/linux/moduleparam.h:289:27: note: previous definition of ‘__param_str_bogus_endpoints’ with type ‘const char[16]’
  289 |         static const char __param_str_##name[] = prefix #name;          \
      |                           ^~~~~~~~~~~~
./include/linux/moduleparam.h:176:9: note: in expansion of macro ‘__module_param_call’
  176 |         __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
      |         ^~~~~~~~~~~~~~~~~~~
./include/linux/moduleparam.h:151:9: note: in expansion of macro ‘module_param_cb’
  151 |         module_param_cb(name, &param_ops_##type, &value, perm);            \
      |         ^~~~~~~~~~~~~~~
./include/linux/moduleparam.h:127:9: note: in expansion of macro ‘module_param_named’
  127 |         module_param_named(name, name, type, perm)
      |         ^~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:71:1: note: in expansion of macro ‘module_param’
   71 | module_param(bogus_endpoints, int, 0600);
      | ^~~~~~~~~~~~
./include/linux/moduleparam.h:290:56: error: redefinition of ‘__param_bogus_endpoints’
  290 |         static struct kernel_param __moduleparam_const __param_##name   \
      |                                                        ^~~~~~~~
./include/linux/moduleparam.h:176:9: note: in expansion of macro ‘__module_param_call’
  176 |         __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
      |         ^~~~~~~~~~~~~~~~~~~
./include/linux/moduleparam.h:151:9: note: in expansion of macro ‘module_param_cb’
  151 |         module_param_cb(name, &param_ops_##type, &value, perm);            \
      |         ^~~~~~~~~~~~~~~
./include/linux/moduleparam.h:127:9: note: in expansion of macro ‘module_param_named’
  127 |         module_param_named(name, name, type, perm)
      |         ^~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:76:1: note: in expansion of macro ‘module_param’
   76 | module_param(bogus_endpoints, int, 0600);
      | ^~~~~~~~~~~~
./include/linux/moduleparam.h:290:56: note: previous definition of ‘__param_bogus_endpoints’ with type ‘const struct kernel_param’
  290 |         static struct kernel_param __moduleparam_const __param_##name   \
      |                                                        ^~~~~~~~
./include/linux/moduleparam.h:176:9: note: in expansion of macro ‘__module_param_call’
  176 |         __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
      |         ^~~~~~~~~~~~~~~~~~~
./include/linux/moduleparam.h:151:9: note: in expansion of macro ‘module_param_cb’
  151 |         module_param_cb(name, &param_ops_##type, &value, perm);            \
      |         ^~~~~~~~~~~~~~~
./include/linux/moduleparam.h:127:9: note: in expansion of macro ‘module_param_named’
  127 |         module_param_named(name, name, type, perm)
      |         ^~~~~~~~~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:71:1: note: in expansion of macro ‘module_param’
   71 | module_param(bogus_endpoints, int, 0600);
      | ^~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:243: /var/lib/dkms/amneziawg/1.0.0/build/generated/main.o] Error 1
make[1]: *** [Makefile:1925: /var/lib/dkms/amneziawg/1.0.0/build/generated] Error 2
make: *** [Makefile:94: module] Error 2
make: Leaving directory '/var/lib/dkms/amneziawg/1.0.0/build'

@WTFThatPerson
Copy link

WTFThatPerson commented Dec 7, 2024

I don't understand what do You do. If You followed my suggestion, after
sudo make install
all key files are just in place, for what You did
apt install
after that?

@anonis3
Copy link

anonis3 commented Dec 9, 2024

Мучался с этой проблемой всю ночь, у меня была такая же проблема с ядром 6.8.0. Помогло вот это: sudo dkms autoinstall.

@snk26
Copy link

snk26 commented Dec 12, 2024

Для установки нужны исходники ядра. Добавляем репозиторий в Ubuntu 24.04

cat >>/etc/apt/sources.list.d/ubuntu.sources<<EOF

Types: deb-src
URIs: http://archive.ubuntu.com/ubuntu
Suites: noble noble-updates noble-backports
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

EOF

Для 22.04 и ниже

sed -i -e 's@# deb-src http://archive.ubuntu.com/ubuntu \(\w\+\) main restricted@deb-src http://archive.ubuntu.com/ubuntu \1 main restricted@' /etc/apt/sources.list

И в конце

add-apt-repository -y ppa:amnezia/ppa && apt install -y amneziawg

@leninalive
leninalive Предлагаю добавить строки из Readme в prepare-sources.sh красным цветом в консоль
Ensure that you have source repositories configured for APT - run vi /etc/apt/sources.list and make sure that there is at least one line starting with deb-src is present and uncommented.
Можно даже и скриптом deb-src добавлять...

@parampapam
Copy link

parampapam commented Dec 20, 2024

На ubuntu 22.10 при попытке сделать make возникает ошибка компиляции:

CC [M]  /var/lib/dkms/amneziawg/1.0.0/build/generated/main.o
In file included from /var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:12:
/var/lib/dkms/amneziawg/1.0.0/build/generated/uapi/wireguard.h:156:22: error: expected declaration specifiers or '...' before string constant
  156 | #define WG_GENL_NAME "amneziawg"
      |                      ^~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:79:26: note: in expansion of macro 'WG_GENL_NAME'
   79 | MODULE_ALIAS_GENL_FAMILY(WG_GENL_NAME);
      |                          ^~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:244: /var/lib/dkms/amneziawg/1.0.0/build/generated/main.o] Error 1
make[1]: *** [Makefile:1931: /var/lib/dkms/amneziawg/1.0.0/build/generated] Error 2
make: *** [Makefile:94: module] Error 2

В чем может быть проблема?

UPD
Проблема была в неправильных исходниках Ubuntu. Решение такое:
В файле /etc/apt/sources.list.d/ubuntu.sources везде где "Types: deb" добавил deb-src, чтобы получилось так "Types: deb deb-src". После этого sudo apt update -y && sudo apt upgrade -y

@holyjoespb
Copy link

Ubuntu 22.04 Под кастомное ядро, после первого фейла с установкой amneziawg-dkms, помогло добавление симлинка
/usr/src/amneziawg-1.0.0/kernel -> /home/semyon/source/linux-tkg/linux-src-git
Где /home/semyon/source/linux-tkg/linux-src-git сорсы ядра

После еще раз apt install amneziawg-dkms

@KaygorodovIS
Copy link
Author

На ubuntu 22.10 при попытке сделать make возникает ошибка компиляции:

CC [M]  /var/lib/dkms/amneziawg/1.0.0/build/generated/main.o
In file included from /var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:12:
/var/lib/dkms/amneziawg/1.0.0/build/generated/uapi/wireguard.h:156:22: error: expected declaration specifiers or '...' before string constant
  156 | #define WG_GENL_NAME "amneziawg"
      |                      ^~~~~~~~~~~
/var/lib/dkms/amneziawg/1.0.0/build/generated/main.c:79:26: note: in expansion of macro 'WG_GENL_NAME'
   79 | MODULE_ALIAS_GENL_FAMILY(WG_GENL_NAME);
      |                          ^~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:244: /var/lib/dkms/amneziawg/1.0.0/build/generated/main.o] Error 1
make[1]: *** [Makefile:1931: /var/lib/dkms/amneziawg/1.0.0/build/generated] Error 2
make: *** [Makefile:94: module] Error 2

В чем может быть проблема?

UPD Проблема была в неправильных исходниках Ubuntu. Решение такое: В файле /etc/apt/sources.list.d/ubuntu.sources везде где "Types: deb" добавил deb-src, чтобы получилось так "Types: deb deb-src". После этого sudo apt update -y && sudo apt upgrade -y

В итоге помогло это решение. С отдельными types для deb и deb-src не отрабатывало.
Всем спасибо за комменты!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants