| Author | Message | 
  
    | 
        
          | Lat   |  | 
        
					| Post subject: dkms says I'm not root  Posted: 22.01.2017, 00:33 |  | 
  
    | 
        
          | 
  
 Joined: 2010-09-19
 Posts: 205
 
 Status: Offline
 |  | 
        
          | Modules for new kernels aren't built because there was an error saying I am not root. 
 
       Code: 
Selecting previously unselected package linux-headers-4.9.0-4.slh.1-aptosid-amd64.
(Reading database ... 440868 files and directories currently installed.)
 Preparing to unpack .../linux-headers-4.9.0-4.slh.1-aptosid-amd64_4.9-8_amd64.deb ...
 Unpacking linux-headers-4.9.0-4.slh.1-aptosid-amd64 (4.9-8) ...
 Selecting previously unselected package linux-image-4.9.0-4.slh.1-aptosid-amd64.
 Preparing to unpack .../linux-image-4.9.0-4.slh.1-aptosid-amd64_4.9-8_amd64.deb ...
 Unpacking linux-image-4.9.0-4.slh.1-aptosid-amd64 (4.9-8) ...
 Setting up linux-headers-4.9.0-4.slh.1-aptosid-amd64 (4.9-8) ...
 /etc/kernel/header_postinst.d/dkms:
 Error! You must be root to use this command.
 run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 1
 Failed to process /etc/kernel/header_postinst.d at /var/lib/dpkg/info/linux-headers-4.9.0-4.slh.1-aptosid-amd64.postinst line 11.
 dpkg: error processing package linux-headers-4.9.0-4.slh.1-aptosid-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
 Setting up linux-image-4.9.0-4.slh.1-aptosid-amd64 (4.9-8) ...
 /etc/kernel-img.conf:6: W: ignoring unknown parameter relative_links
 I: /vmlinuz.old is now a symlink to boot/vmlinuz-4.9.0-0.slh.1-aptosid-amd64
 I: /initrd.img.old is now a symlink to boot/initrd.img-4.9.0-0.slh.1-aptosid-amd64
 I: /vmlinuz is now a symlink to boot/vmlinuz-4.9.0-4.slh.1-aptosid-amd64
 I: /initrd.img is now a symlink to boot/initrd.img-4.9.0-4.slh.1-aptosid-amd64
 /etc/kernel/postinst.d/dkms:
 Error! You must be root to use this command.
 run-parts: /etc/kernel/postinst.d/dkms exited with return code 1
 dpkg: error processing package linux-image-4.9.0-4.slh.1-aptosid-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
 Errors were encountered while processing:
 linux-headers-4.9.0-4.slh.1-aptosid-amd64
 linux-image-4.9.0-4.slh.1-aptosid-amd64
 E: Sub-process /usr/bin/dpkg returned an error code (1)
 After digging a bit, /usr/sbin/dkms never initializes the variable UID
 
 
       Code: 
grep UID /usr/sbin/dkms 
if ((UID != 0)); then
 ((UID == 0)) && return
 if ((UID != 0)) && [[ $force = true ]]; then
 
 Adding the line below somewhere at top the script fixes it:
 
       Code: 
UID=$(id -u)
 |  
          |  |  
         
	        |  |  | 
  
    |  | 
  
    |  | 
  
    | 
        
          | Lat   |  | 
        
					| Post subject: RE: dkms says I  Posted: 19.02.2017, 02:56 |  | 
  
    | 
        
          | 
  
 Joined: 2010-09-19
 Posts: 205
 
 Status: Offline
 |  | 
        
          | Same behavior in dkms 2.3-3 |  
          |  |  
         
	        |  |  | 
  
    |  | 
  
    |  | 
  
    | 
        
          | slh   |  | 
        
					| Post subject: RE: dkms says I  Posted: 19.02.2017, 07:01 |  | 
  
    | 
        
          | 
  
 Joined: 2010-08-25
 Posts: 962
 
 Status: Offline
 |  | 
        
          | Without having dug into it deeper (I don't really like the way dkms works), the situation is a bit weird. While $UID is not a variable mandated by POSIX shells, it is defined by bash and - and /usr/sbin/dkms does explicitly use #!/bin/bash as shebang. At least the 'normal' ways dkms appears to be invoked, is via exec, which in turn should use bash to execute the script (thereby defining $UID), but apparently it isn't executed rather than sourced on your system somehow (which would be the only way to end up with your error condition). Unfortunately I don't really see how this would happen (assuming that /bin/bash is indeed provided by bash, check "/bin/bash --version", which it really should be). 
 In order to debug this further, it would probably make sense to run "debsums -as" on your system, to check for eventual disk corruption and/ or modified conffiles (there typically are several under /etc/, so that isn't a problem per se, but it might hint at potential problems). Furthermore you apparently still have /etc/kernel-img.conf on your system, which isn't supposed to be present anymore (while it shouldn't exactly break havoc, it has the potential to do so - it is safe to remove it).
 |  
          |  |  
         
	        |  |  | 
  
    |  | 
  
    |  | 
  
    | 
        
          | Lat   |  | 
        
					| Post subject: RE: dkms says I  Posted: 21.02.2017, 01:10 |  | 
  
    | 
        
          | 
  
 Joined: 2010-09-19
 Posts: 205
 
 Status: Offline
 |  | 
        
          | Ok, this is the bash command 
       Code: 
 /bin/bash --version ; apt-cache policy bash
GNU bash, version 4.4.11(1)-release (x86_64-pc-linux-gnu)
 Copyright (C) 2016 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later <http>
 
 This is free software; you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.
 bash:
 Installed: 4.4-4
 Candidate: 4.4-4
 Version table:
 *** 4.4-4 500
 500 http://httpredir.debian.org/debian testing/main amd64 Packages
 500 http://httpredir.debian.org/debian sid/main amd64 Packages
 100 /var/lib/dpkg/status
 
 and this is kernel-img.conf
 
       Code: 
cat /etc/kernel-img.conf
# Kernel Image management overrides
 # See kernel-img.conf(5) for details
 do_symlinks = Yes
 do_bootloader = no
 do_initrd = Yes
 relative_links = Yes
 I'll run debsums -as, too
 
 Thanks slh,
 Lat
 |  
          |  |  
         
	        |  |  | 
  
    |  | 
  
    |  | 
  
    | 
        
          | Lat   |  | 
        
					| Post subject: RE: dkms says I  Posted: 21.02.2017, 01:24 |  | 
  
    | 
        
          | 
  
 Joined: 2010-09-19
 Posts: 205
 
 Status: Offline
 |  | 
        
          | I decided to dist-upgrade before running debsums -as. During that I saw "/usr/sbin/dkms: line 40: UID: readonly variable" which is where I put my work around. Could it be that it got fixed? 
 
       Code: 
...
Building initial module for 4.9.0-0.slh.1-aptosid-amd64
 /usr/sbin/dkms: line 40: UID: readonly variable
 Done.
 /usr/sbin/dkms: line 40: UID: readonly variable
 /usr/sbin/dkms: line 40: UID: readonly variable
 ..
 
 sed -n '40 p' < /usr/sbin/dkms
 UID=$(id -u)
 |  
          |  |  
         
	        |  |  | 
  
    |  | 
  
    |  | 
  
    | 
        
          | slh   |  | 
        
					| Post subject: RE: dkms says I  Posted: 21.02.2017, 01:46 |  | 
  
    | 
        
          | 
  
 Joined: 2010-08-25
 Posts: 962
 
 Status: Offline
 |  | 
        
          | As mentioned, /etc/kernel-img.conf should be removed and doesn't contain any required/ useful content (anymore). 
 "UID: readonly variable" does make sense, if the script is executed under bash (given that bash itself sets this variable and overriding it would be problematic under normal circumstances).
 |  
          |  |  
         
	        |  |  | 
  
    |  | 
  
    |  | 
  
    | 
        
          | Lat   |  | 
        
					| Post subject: RE: dkms says I  Posted: 18.03.2017, 22:44 |  | 
  
    | 
        
          | 
  
 Joined: 2010-09-19
 Posts: 205
 
 Status: Offline
 |  | 
        
          | This was fixed already, but today came back again 
 
       Code: 
Setting up linux-image-4.10.0-3.slh.1-aptosid-amd64 (4.10-7) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-4.10.0-1.slh.2-aptosid-amd64
 I: /initrd.img.old is now a symlink to boot/initrd.img-4.10.0-1.slh.2-aptosid-amd64
 I: /vmlinuz is now a symlink to boot/vmlinuz-4.10.0-3.slh.1-aptosid-amd64
 I: /initrd.img is now a symlink to boot/initrd.img-4.10.0-3.slh.1-aptosid-amd64
 /etc/kernel/postinst.d/dkms:
 Error! You must be root to use this command.
 run-parts: /etc/kernel/postinst.d/dkms exited with return code 1
 dpkg: error processing package linux-image-4.10.0-3.slh.1-aptosid-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
 Setting up linux-headers-4.10.0-3.slh.1-aptosid-amd64 (4.10-7) ...
 /etc/kernel/header_postinst.d/dkms:
 Error! You must be root to use this command.
 run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 1
 Failed to process /etc/kernel/header_postinst.d at /var/lib/dpkg/info/linux-headers-4.10.0-3.slh.1-aptosid-amd64.postinst line 11.
 dpkg: error processing package linux-headers-4.10.0-3.slh.1-aptosid-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
 Errors were encountered while processing:
 linux-image-4.10.0-3.slh.1-aptosid-amd64
 linux-headers-4.10.0-3.slh.1-aptosid-amd64
 E: Sub-process /usr/bin/dpkg returned an error code (1)
 |  
          |  |  
         
	        |  |  | 
  
    |  | 
  
    |  | 
  
  
    |  |