rebuild_dkms_packages.sh script fails

Report Bugs, Issues and non- package Requests
Message
Author
tony37
Posts: 1306
Joined: Sat Jul 18, 2020 12:34 pm

Re: rebuild_dkms_packages.sh script fails

#11 Post by tony37 »

I see a problem: there are different packages called 'linux-image-amd64', so when someone has the Debian Backports repo enabled (like me, though I rarely install something from it), then

Code: Select all

apt-cache show linux-image-amd64 |grep -m1 Depends
will result in "linux-image-5.8.0-0.bpo.2-amd64 (= 5.8.10-1~bpo10+1)". For some reason the appended "(= 5.8.10-1~bpo10+1)" doesn't cause problems, but anyway: when I install the 4.19 meta-package I get this:

Code: Select all

update dkms modules for kernel:  5.8.0-0.bpo.2-amd64
see log at /var/log/rebuild-dkms.log
dkms: running auto installation service for kernel 5.8.0-0.bpo.2-amd64:Error! echo
Your kernel headers for kernel 5.8.0-0.bpo.2-amd64 cannot be found at
/lib/modules/5.8.0-0.bpo.2-amd64/build or /lib/modules/5.8.0-0.bpo.2-amd64/source.
Error! echo
Your kernel headers for kernel 5.8.0-0.bpo.2-amd64 cannot be found at
.
/lib/modules/5.8.0-0.bpo.2-amd64/build or /lib/modules/5.8.0-0.bpo.2-amd64/source.
Maybe for the 4.19 kernel you could use

Code: Select all

apt-cache show linux-image-amd64=4.19* |grep -m1 Depends

User avatar
dolphin_oracle
Developer
Posts: 22657
Joined: Sun Dec 16, 2007 12:17 pm

Re: rebuild_dkms_packages.sh script fails

#12 Post by dolphin_oracle »

ugh.

this is why I used the dpkg-reconfigure commands in the first place.

got the debian kernels updated...thanks for the help with that case
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

tony37
Posts: 1306
Joined: Sat Jul 18, 2020 12:34 pm

Re: rebuild_dkms_packages.sh script fails

#13 Post by tony37 »

A more general command would be:

Code: Select all

file=$(apt-cache show linux-image-amd64=$(dpkg-query -W linux-image-amd64 |awk '{print $2}') |grep -m1 Depends) 
It will find the version of the installed meta-package. Maybe I can find something better still.

User avatar
dolphin_oracle
Developer
Posts: 22657
Joined: Sun Dec 16, 2007 12:17 pm

Re: rebuild_dkms_packages.sh script fails

#14 Post by dolphin_oracle »

tony37 wrote: Mon Nov 09, 2020 12:50 pm A more general command would be:

Code: Select all

file=$(apt-cache show linux-image-amd64=$(dpkg-query -W linux-image-amd64 |awk '{print $2}') |grep -m1 Depends) 
It will find the version of the installed meta-package. Maybe I can find something better still.
I don't understand why the dpkg-query test is past for a kernel that isn't installed. it should have exited without doing anything in that case. still wrong, but less wrong.

Code: Select all

[[ $(dpkg-query --show $1 2>/dev/null && echo $?) ]] || exit 0
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

tony37
Posts: 1306
Joined: Sat Jul 18, 2020 12:34 pm

Re: rebuild_dkms_packages.sh script fails

#15 Post by tony37 »

dolphin_oracle wrote: Mon Nov 09, 2020 12:54 pm
tony37 wrote: Mon Nov 09, 2020 12:50 pm A more general command would be:

Code: Select all

file=$(apt-cache show linux-image-amd64=$(dpkg-query -W linux-image-amd64 |awk '{print $2}') |grep -m1 Depends) 
It will find the version of the installed meta-package. Maybe I can find something better still.
I don't understand why the dpkg-query test is past for a kernel that isn't installed.
remaining configuration files?

User avatar
dolphin_oracle
Developer
Posts: 22657
Joined: Sun Dec 16, 2007 12:17 pm

Re: rebuild_dkms_packages.sh script fails

#16 Post by dolphin_oracle »

I think its because I'm stupid.

the echo succeeds, so the statement is true no matter if the dpkg-query works or not. that should be easy to fix.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

User avatar
dolphin_oracle
Developer
Posts: 22657
Joined: Sun Dec 16, 2007 12:17 pm

Re: rebuild_dkms_packages.sh script fails

#17 Post by dolphin_oracle »

dolphin_oracle wrote: Mon Nov 09, 2020 2:15 pm I think its because I'm stupid.

the echo succeeds, so the statement is true no matter if the dpkg-query works or not. that should be easy to fix.
nope that's not it.

did you have the debian backports kernel installed at some point?
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

User avatar
dolphin_oracle
Developer
Posts: 22657
Joined: Sun Dec 16, 2007 12:17 pm

Re: rebuild_dkms_packages.sh script fails

#18 Post by dolphin_oracle »

dpkg-query --status

is the command we want. the "--show" will pass if a package has been installed but later removed.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

User avatar
dolphin_oracle
Developer
Posts: 22657
Joined: Sun Dec 16, 2007 12:17 pm

Re: rebuild_dkms_packages.sh script fails

#19 Post by dolphin_oracle »

haven't packaged yet, but here's the code.

Code: Select all

#!/bin/bash

#force rebuild of dkms packages (virtualbox, nvidia, fglrx, broadcom, ndiswrapper)
#part of mx-packageinstaller

kernel="$1"

# if parameter passed, then check to see if package is installed, exit if not
if [ -n "$kernel" ]; then
	[[ $(dpkg-query --status $1 2>/dev/null ) ]] || exit 0
fi	

#if no kernel parameter given, assume current kernel
if [ -z "$kernel" ]; then
	kernel="$(uname -r)"
fi

kernel=${kernel#"linux-image-"}
kernel=${kernel%-unsigned}

echo "update dkms modules for kernel: " $kernel |tee /var/log/rebuild-dkms.log
echo "see log at /var/log/rebuild-dkms.log"

/usr/lib/dkms/dkms_autoinstaller start $kernel |tee -a /var/log/rebuild-dkms.log

exit 0
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

tony37
Posts: 1306
Joined: Sat Jul 18, 2020 12:34 pm

Re: rebuild_dkms_packages.sh script fails

#20 Post by tony37 »

"dpkg-query --status" also gives output for packages with remaining configuration files:

Code: Select all

Status: deinstall ok config-files

Post Reply

Return to “Bugs and Non-Package Requests Forum”