On Thu, Dec 04, 2008 at 03:01:47PM -0000, Matt Zimmerman wrote:
> The crux of my problem is the "updates" directory, which contains modules
> built by DKMS. Nothing cleans up these files when a kernel is removed, only
> when the entire module package (e.g. nvidia-173-kernel-source) is removed.
>
> I think what's needed is to add a "dkms remove" command to the kernel
> package postrm which removes all modules installed by dkms for the specified
> kernel version.
If I install the nvidia-173-kernel-source module on my system here then
I get a dkms postinstall script for both the headers and the kernel:
Status: Before uninstall, this module version was ACTIVE on this kernel.
nvidia.ko:
- Uninstallation
- Deleting from: /lib/modules/2.6.27-7-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module
version.
depmod....
DKMS: uninstall Completed.
run-parts: executing /etc/kernel/prerm.d/last-good-boot
Running postrm hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found:
/boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-TEST
Found kernel: /boot/vmlinuz-2.6.27-10-generic
Found kernel: /boot/vmlinuz-2.6.27-9-generic
Found kernel: /boot/vmlinuz-2.6.27-8-generic
Found kernel: /boot/vmlinuz-2.6.24-21-generic
Found kernel: /boot/memtest86+.bin
Replacing config file /var/run/grub/menu.lst with new version
Updating /boot/grub/menu.lst ... done
The link /vmlinuz is a damaged link
Removing symbolic link vmlinuz
you may need to re-run your boot loader[grub]
The link /initrd.img is a damaged link
Removing symbolic link initrd.img
you may need to re-run your boot loader[grub]
$ sudo dpkg -r linux-headers-2.6.27-7-generic
linux-headers-2.6.27-7(Reading database ... 166786 files and directories
currently installed.)
Removing linux-headers-2.6.27-7-generic ...
dpkg - warning: while removing linux-headers-2.6.27-7-generic, directory
`/lib/modules/2.6.27-7-generic' not empty so not removed.
Removing linux-headers-2.6.27-7 ...
What does go wrong is that dkms is leaving the empty directories behind:
$ ls /lib/modules/2.6.27-7-generic
modules.alias modules.inputmap modules.pcimap modules.usbmap
modules.ccwmap modules.isapnpmap modules.seriomap updates
modules.ieee1394map modules.ofmap modules.symbols
$ ls /lib/modules/2.6.27-7-generic/updates/dkms/
$ ls /lib/modules/2.6.27-7-generic/updates/
dkms
So it appears that if all the other bugs are fixed then it is DKMS which
is 'wrong' here, it needs to clean out its directory when its done
removing everything. Will look at sorting that out.
On Thu, Dec 04, 2008 at 03:01:47PM -0000, Matt Zimmerman wrote:
> The crux of my problem is the "updates" directory, which contains modules 173-kernel- source) is removed.
> built by DKMS. Nothing cleans up these files when a kernel is removed, only
> when the entire module package (e.g. nvidia-
>
> I think what's needed is to add a "dkms remove" command to the kernel
> package postrm which removes all modules installed by dkms for the specified
> kernel version.
If I install the nvidia- 173-kernel- source module on my system here then
I get a dkms postinstall script for both the headers and the kernel:
$ ls -l /etc/kernel/*/dkms header_ postinst. d/dkms postinst. d/dkms prerm.d/ dkms
-rwxr-xr-x 1 root root 185 2008-07-08 16:19 /etc/kernel/
-rwxr-xr-x 1 root root 185 2008-07-08 16:19 /etc/kernel/
-rwxr-xr-x 1 root root 502 2008-07-08 16:19 /etc/kernel/
When both kernel and headers are installed then the driver seems to get
built correctly:
$ sudo dpkg -i linux-image- 2.6.27- 7-generic_ 2.6.27- 7.16_amd64. deb 2.6.27- 7-generic. 2.6.27- 7-generic (from image-2. 6.27-7- generic_ 2.6.27- 7.16_amd64. deb) ... 2.6.27- 7-generic (2.6.27-7.16) ... initramfs: Generating /boot/initrd. img-2.6. 27-7-generic grub/menu. lst 2.6.27- 10-generic 2.6.27- 9-generic 2.6.27- 8-generic 2.6.27- 7-generic 2.6.24- 21-generic +.bin grub/menu. lst with new version
Selecting previously deselected package linux-image-
(Reading database ... 161177 files and directories currently installed.)
Unpacking linux-image-
linux-
Done.
Setting up linux-image-
Running depmod.
update-
Running postinst hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found:
/boot/
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-TEST
Found kernel: /boot/vmlinuz-
Found kernel: /boot/vmlinuz-
Found kernel: /boot/vmlinuz-
Found kernel: /boot/vmlinuz-
Found kernel: /boot/vmlinuz-
Found kernel: /boot/memtest86
Replacing config file /var/run/
Updating /boot/grub/menu.lst ... done
Examining /etc/kernel/ postinst. d. postinst. d/dkms postinst. d/nvidia- common
run-parts: executing /etc/kernel/
* Running DKMS auto installation service for kernel 2.6.27-7-generic
* nvidia (173.14.12)...
* nvidia (173.14.12): Installing module.
Kernel source for 2.6.27-7-generic not installed. Cannot install this module.
[fail]
run-parts: executing /etc/kernel/
(reverse- i-search) `0': less intrepid/ debian/ linux-image- 2.6.27- 10-generic/ DEBIAN/ postrm i-search) `-r': sudo dpkg -r restricted- modules- 2.6.27- 7-generic$ sudo dpkg -i headers- 2.6.27- 7-generic_ 2.6.27- 7.16_amd64. deb Selecting 2.6.27- 7-generic. 2.6.27- 7-generic (from headers- 2.6.27- 7-generic_ 2.6.27- 7.16_amd64. deb) ... 2.6.27- 7-generic (2.6.27-7.16) ... header_ postinst. d. header_ postinst. d/dkms header_ postinst. d/nvidia- common
./ubuntu-
(reverse-
linux-
linux-
previously deselected package linux-headers-
(Reading database ... 163749 files and directories currently installed.)
Unpacking linux-headers-
linux-
Setting up linux-headers-
Examining /etc/kernel/
run-parts: executing /etc/kernel/
* Running DKMS auto installation service for kernel 2.6.27-7-generic
* nvidia (173.14.12)...
* nvidia (173.14.12): Installing module.
...........
......
[ OK ]
run-parts: executing /etc/kernel/
$ ls /lib/modules/ 2.6.27- 7-generic/ build modules.alias ieee1394map modules.ofmap modules.symbols 2.6.27- 7-generic/ updates/ dkms/
modules.
initrd modules.ccwmap modules.inputmap modules.pcimap
modules.usbmap
kernel modules.dep modules.isapnpmap modules.seriomap updates
$ ls /lib/modules/
nvidia.ko
And indeed removed correctly, as in a dkms remove occurs:
$ sudo dpkg -r linux-image- 2.6.27- 7-generic 2.6.27- 7-generic ... prerm.d. prerm.d/ dkms
(Reading database ... 169361 files and directories currently installed.)
Removing linux-image-
Examining /etc/kernel/
run-parts: executing /etc/kernel/
Uninstalling: nvidia 173.14.12 (2.6.27-7-generic) (x86_64)
-------- Uninstall Beginning -------- ------- ------- ------- ------- ------
Module: nvidia
Version: 173.14.12
Kernel: 2.6.27-7-generic (x86_64)
---
Status: Before uninstall, this module version was ACTIVE on this kernel.
nvidia.ko: 2.6.27- 7-generic/ updates/ dkms/
- Uninstallation
- Deleting from: /lib/modules/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module
version.
depmod....
DKMS: uninstall Completed. prerm.d/ last-good- boot grub/menu. lst 2.6.27- 10-generic 2.6.27- 9-generic 2.6.27- 8-generic 2.6.24- 21-generic +.bin grub/menu. lst with new version
run-parts: executing /etc/kernel/
Running postrm hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found:
/boot/
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-TEST
Found kernel: /boot/vmlinuz-
Found kernel: /boot/vmlinuz-
Found kernel: /boot/vmlinuz-
Found kernel: /boot/vmlinuz-
Found kernel: /boot/memtest86
Replacing config file /var/run/
Updating /boot/grub/menu.lst ... done
The link /vmlinuz is a damaged link 2.6.27- 7-generic headers- 2.6.27- 7(Reading database ... 166786 files and directories 2.6.27- 7-generic ... 2.6.27- 7-generic, directory modules/ 2.6.27- 7-generic' not empty so not removed. 2.6.27- 7 ...
Removing symbolic link vmlinuz
you may need to re-run your boot loader[grub]
The link /initrd.img is a damaged link
Removing symbolic link initrd.img
you may need to re-run your boot loader[grub]
$ sudo dpkg -r linux-headers-
linux-
currently installed.)
Removing linux-headers-
dpkg - warning: while removing linux-headers-
`/lib/
Removing linux-headers-
What does go wrong is that dkms is leaving the empty directories behind:
$ ls /lib/modules/ 2.6.27- 7-generic ieee1394map modules.ofmap modules.symbols 2.6.27- 7-generic/ updates/ dkms/ 2.6.27- 7-generic/ updates/
modules.alias modules.inputmap modules.pcimap modules.usbmap
modules.ccwmap modules.isapnpmap modules.seriomap updates
modules.
$ ls /lib/modules/
$ ls /lib/modules/
dkms
So it appears that if all the other bugs are fixed then it is DKMS which
is 'wrong' here, it needs to clean out its directory when its done
removing everything. Will look at sorting that out.