Upgrade to bookworm via script fails because of dkms and manually installed wireguard

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version | cat /boot/dietpi/.version
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=3
    G_DIETPI_VERSION_RC=0
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
  • Distro version | bullseye
  • Kernel version | Linux DietPiX220t 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64 GNU/Linux
  • Architecture | amd64
  • SBC model | Native PC (x86_64) dell Wyse 5070
  • Power supply used | standard power supply
  • SD card used | SATA ssd

Additional Information (if applicable)

  • Software title | wireguard / dkms / kernel
  • Was the software title installed freshly or updated/migrated? update to bookworm via script
  • Can this issue be replicated on a fresh installation of DietPi? didn’t try, probably not

Steps to reproduce

I used the upgrade script to upgrade to bookworm. First the process broke with initramfs complaining about a swap-partition for resume it couldn’t find. I deleted the requirement. After that initramfs was fine.
However now the process stops because dkms can’t compile a kernel-module for wireguard. Rerunning the process doesn’t help.

Expected behaviour

The install script to go through to the end.

Actual behaviour

APT dist-upgrade
- Command: apt-get -y dist-upgrade
- Exit code: 100                                                                                                      
- DietPi version: v9.3.0 (MichaIng/master) | HW_MODEL: 21 | HW_ARCH: 10 | DISTRO: 6                                   
- Image creator: Berny                                                                                                
- Pre-image: https://cdimage.debian.org/debian-cd/current/amd64/bt-cd/debian-10.5.0-amd64-netinst.iso                 
- Error log:                                                                                                          
 Reading package lists...                                                                                               
 Building dependency tree...                                                                                            
 Reading state information...                                                                                           
 Calculating upgrade...                                                                                                 
 The following packages were automatically installed and are no longer required:                                        
 dctrl-tools gcc-8-base glib-networking glib-networking-common                                                        
 glib-networking-services gsettings-desktop-schemas libaio1 libaom0                                                   
 libatk1.0-data libavcodec58 libavformat58 libavutil56 libbpf0 libcbor0                                               
 libcodec2-0.9 libdav1d4 libdns-export1110 libffi7 libgcc1                                                            
 libgdk-pixbuf-xlib-2.0-0 libgdk-pixbuf2.0-0 libglew2.1 libglu1-mesa                                                  
 libgtksourceview-3.0-1 libgtksourceview-3.0-common libicu67                                                          
 libimobiledevice6 libisc-export1105 libjson-glib-1.0-0                                                               
 libjson-glib-1.0-common libldap-2.4-2 libllvm11 liblua5.1-0 libmpdec3                                                
 libntfs-3g883 libonig5 libopengl0 libpcre3 libperl5.32 libplist3                                                     
 libpoppler102 libprocps8 libproxy1v5 libpython3.9 libpython3.9-minimal                                               
 libpython3.9-stdlib librest-0.7-0 libsepol1 libsoup-gnome2.4-1 libsoup2.4-1                                          
 libsoup2.4-common libsrt1.4-gnutls libswresample3 libtiff5 libusbmuxd6                                               
 libvpx6 libvulkan1 libwavpack1 libwebp6 libx264-160 libx265-192 libxslt1.1                                           
 libzip4 linux-compiler-gcc-10-x86 linux-headers-5.10.0-28-amd64                                                      
 linux-headers-5.10.0-28-common linux-image-5.10.0-28-amd64 linux-kbuild-5.10                                         
 lua-bitop lua-cjson mariadb-server-10.5 perl-modules-5.32                                                            
 python3-requests-toolbelt python3-zope.component python3-zope.event                                                  
 python3-zope.hookable python3-zope.interface python3.9 python3.9-minimal                                             
 Use 'apt autoremove' to remove them.                                                                                   
 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.                                                         
 4 not fully installed or removed.                                                                                      
 After this operation, 0 B of additional disk space will be used.                                                       
 Setting up linux-image-6.1.0-20-amd64 (6.1.85-1) ...^M                                                                 
 /etc/kernel/postinst.d/dkms:^M                                                                                         
 dkms: running auto installation service for kernel 6.1.0-20-amd64.^M                                                   
 Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file^M                                                            
 Signing key: /var/lib/dkms/mok.key^M                                                                                   
 Public certificate (MOK): /var/lib/dkms/mok.pub^M                                                                      
 Error! The /var/lib/dkms/wireguard/1.0.20210219/6.1.0-20-amd64/x86_64/dkms.conf for module wireguard includes a        
 BUILD_EXCLUSIVE directive which does not match this kernel/arch/config.^M                                              
 This indicates that it should not be built.^M                                                                          
 Error! One or more modules failed to install during autoinstall.^M                                                     
 Refer to previous errors for more information.^M                                                                       
 dkms: autoinstall for kernel: 6.1.0-20-amd64 failed!^M                                                                 
 run-parts: /etc/kernel/postinst.d/dkms exited with return code 11^M                                                    
 dpkg: error processing package linux-image-6.1.0-20-amd64 (--configure):^M                                             
installed linux-image-6.1.0-20-amd64 package post-installation script subprocess returned error exit status 1^M       
 Setting up linux-headers-6.1.0-20-amd64 (6.1.85-1) ...^M                                                               
 /etc/kernel/header_postinst.d/dkms:^M                                                                                  
 dkms: running auto installation service for kernel 6.1.0-20-amd64.^M                                                   
 Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file^M                                                            
 Signing key: /var/lib/dkms/mok.key^M                                                                                   
 Public certificate (MOK): /var/lib/dkms/mok.pub^M                                                                      
 Error! The /var/lib/dkms/wireguard/1.0.20210219/6.1.0-20-amd64/x86_64/dkms.conf for module wireguard includes a        
 BUILD_EXCLUSIVE directive which does not match this kernel/arch/config.^M                                              
 This indicates that it should not be built.^M                                                                          
 Error! One or more modules failed to install during autoinstall.^M                                                     
 Refer to previous errors for more information.^M                                                                       
 dkms: autoinstall for kernel: 6.1.0-20-amd64 failed!^M                                                                 
 run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 11^M 
Failed to process /etc/kernel/header_postinst.d at /var/lib/dpkg/info/linux-headers-6.1.0-20-amd64.postinst line 11.^M 
dpkg: error processing package linux-headers-6.1.0-20-amd64 (--configure):^M                                           
 installed linux-headers-6.1.0-20-amd64 package post-installation script subprocess returned error exit status 1^M     
dpkg: dependency problems prevent configuration of linux-headers-amd64:^M                                              
 linux-headers-amd64 depends on linux-headers-6.1.0-20-amd64 (= 6.1.85-1); however:^M                                  
  Package linux-headers-6.1.0-20-amd64 is not configured yet.^M                                                        
^M                                                                                                                     
dpkg: error processing package linux-headers-amd64 (--configure):^M                                                    
 dependency problems - leaving unconfigured^M                                                                          
dpkg: dependency problems prevent configuration of linux-image-amd64:^M                                                
 linux-image-amd64 depends on linux-image-6.1.0-20-amd64 (= 6.1.85-1); however:^M                                      
  Package linux-image-6.1.0-20-amd64 is not configured yet.^M                                                          
^M                                                                                                                     
dpkg: error processing package linux-image-amd64 (--configure):^M                                                      
 dependency problems - leaving unconfigured^M                                                                          
Errors were encountered while processing:^M                                                                            
 linux-image-6.1.0-20-amd64^M                                                                                          
 linux-headers-6.1.0-20-amd64^M                                                                                        
 linux-headers-amd64^M                                                                                                 
 linux-image-amd64^M                                                                                                   
E: Sub-process /usr/bin/dpkg returned an error code (1)

Extra details

I had installed wireguard via apt-get install before it was available as a dietPi packet

The directory dkms complains about doesn’t seem to exist:

# ls /var/lib/dkms/wireguard/1.0.20210219/
4.19.0-21-amd64  source

I tried to remove wireguard in a different shell but that didn’t work either:

apt-get remove wireguard
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
Paket »wireguard« ist nicht installiert, wird also auch nicht entfernt.
Die folgenden Pakete wurden automatisch installiert und werden nicht mehr benötigt:
  dctrl-tools gcc-8-base glib-networking glib-networking-common
  glib-networking-services gsettings-desktop-schemas libaio1 libaom0
  libatk1.0-data libavcodec58 libavformat58 libavutil56 libbpf0 libcbor0
  libcodec2-0.9 libdav1d4 libdns-export1110 libffi7 libgcc1
  libgdk-pixbuf-xlib-2.0-0 libgdk-pixbuf2.0-0 libglew2.1 libglu1-mesa
  libgtksourceview-3.0-1 libgtksourceview-3.0-common libicu67
  libimobiledevice6 libisc-export1105 libjson-glib-1.0-0
  libjson-glib-1.0-common libldap-2.4-2 libllvm11 liblua5.1-0 libmpdec3
  libntfs-3g883 libonig5 libopengl0 libpcre3 libperl5.32 libplist3
  libpoppler102 libprocps8 libproxy1v5 libpython3.9 libpython3.9-minimal
  libpython3.9-stdlib librest-0.7-0 libsepol1 libsoup-gnome2.4-1 libsoup2.4-1
  libsoup2.4-common libsrt1.4-gnutls libswresample3 libtiff5 libusbmuxd6
  libvpx6 libvulkan1 libwavpack1 libwebp6 libx264-160 libx265-192 libxslt1.1
  libzip4 linux-compiler-gcc-10-x86 linux-headers-5.10.0-28-amd64
  linux-headers-5.10.0-28-common linux-image-5.10.0-28-amd64 linux-kbuild-5.10
  lua-bitop lua-cjson mariadb-server-10.5 perl-modules-5.32
  python3-requests-toolbelt python3-zope.component python3-zope.event
  python3-zope.hookable python3-zope.interface python3.9 python3.9-minimal
Verwenden Sie »apt autoremove«, um sie zu entfernen.
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
4 nicht vollständig installiert oder entfernt.
Nach dieser Operation werden 0 B Plattenplatz zusätzlich benutzt.
linux-image-6.1.0-20-amd64 (6.1.85-1) wird eingerichtet ...
/etc/kernel/postinst.d/dkms:
dkms: running auto installation service for kernel 6.1.0-20-amd64.
Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Error! The /var/lib/dkms/wireguard/1.0.20210219/6.1.0-20-amd64/x86_64/dkms.conf for module wireguard includes a BUILD_EXCLUSIVE directive which does not match this kernel/arch/config.
This indicates that it should not be built.
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
dkms: autoinstall for kernel: 6.1.0-20-amd64 failed!
run-parts: /etc/kernel/postinst.d/dkms exited with return code 11
dpkg: Fehler beim Bearbeiten des Paketes linux-image-6.1.0-20-amd64 (--configure):
 »installiertes post-installation-Skript des Paketes linux-image-6.1.0-20-amd64«-Unterprozess gab den Fehlerwert 1 zurück
linux-headers-6.1.0-20-amd64 (6.1.85-1) wird eingerichtet ...
/etc/kernel/header_postinst.d/dkms:
dkms: running auto installation service for kernel 6.1.0-20-amd64.
Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Error! The /var/lib/dkms/wireguard/1.0.20210219/6.1.0-20-amd64/x86_64/dkms.conf for module wireguard includes a BUILD_EXCLUSIVE directive which does not match this kernel/arch/config.
This indicates that it should not be built.
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
dkms: autoinstall for kernel: 6.1.0-20-amd64 failed!
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 11
Failed to process /etc/kernel/header_postinst.d at /var/lib/dpkg/info/linux-headers-6.1.0-20-amd64.postinst line 11.
dpkg: Fehler beim Bearbeiten des Paketes linux-headers-6.1.0-20-amd64 (--configure):
 »installiertes post-installation-Skript des Paketes linux-headers-6.1.0-20-amd64«-Unterprozess gab den Fehlerwert 1 zurück
dpkg: Abhängigkeitsprobleme verhindern Konfiguration von linux-headers-amd64:
 linux-headers-amd64 hängt ab von linux-headers-6.1.0-20-amd64 (= 6.1.85-1); aber:
  Paket linux-headers-6.1.0-20-amd64 ist noch nicht konfiguriert.

dpkg: Fehler beim Bearbeiten des Paketes linux-headers-amd64 (--configure):
 Abhängigkeitsprobleme - verbleibt unkonfiguriert
dpkg: Abhängigkeitsprobleme verhindern Konfiguration von linux-image-amd64:
 linux-image-amd64 hängt ab von linux-image-6.1.0-20-amd64 (= 6.1.85-1); aber:
  Paket linux-image-6.1.0-20-amd64 ist noch nicht konfiguriert.

dpkg: Fehler beim Bearbeiten des Paketes linux-image-amd64 (--configure):
 Abhängigkeitsprobleme - verbleibt unkonfiguriert
Fehler traten auf beim Bearbeiten von:
 linux-image-6.1.0-20-amd64
 linux-headers-6.1.0-20-amd64
 linux-headers-amd64
 linux-image-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

What can I do to finish the upgrade?

How would I return to the backup I made before the process started?

simply exit the process and run dietpi-backup -1

Looks like your system is trying to build the Wireguard module, which usually is not needed since kernel 5.6, because it should be included as kernel module already. Did you upgrade from Bullseye directly or was there an update from Buster before?

Probably best to recover your backup and change Wireguard afterwards, before running the upgrade again.

1 Like

There was an upgrade from buster before. And I’m note sure anymore, whether it was a fresh install for buster or whether I converted a plain debian install to DietPi.

Restoring the backup worked like a charm. After that I removed wireguard-dkms (and I think wireguard as well) but didn’t purge the config files. I then started the upgrade-script and it finished the job. I thought, I would need to reinstall wireguard after the upgrade but it turned out to be installed an working out of the box. I now have an upgraded and working installation again, with wireguard, home assistant, paperless, and nextcloud. Thanks a lot for your help!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.