Comment 2 for bug 300773

Revision history for this message
Andy Whitcroft (apw) wrote :

Going through some experiments:

Simple install/deinstall:
$ sudo dpkg -i linux-image-2.6.28-1-ub-generic_2.6.28-1.1_amd64.deb
[...]
$ sudo dpkg -r linux-image-2.6.28-1-ub-generic
[...]
$ ls /lib/modules/2.6.28-1-ub-generic
modules.alias modules.inputmap modules.pcimap modules.usbmap
modules.ccwmap modules.isapnpmap modules.seriomap
modules.ieee1394map modules.ofmap modules.symbols

Simple install/Purge:
$ sudo dpkg -i linux-image-2.6.28-1-ub-generic_2.6.28-1.1_amd64.deb
[...]
$ sudo dpkg -P linux-image-2.6.28-1-ub-generic
[...]
rmdir: failed to remove `/lib/modules/2.6.28-1-ub-generic': Directory not empty
dpkg - warning: while removing linux-image-2.6.28-1-ub-generic, directory `/lib/modules/2.6.28-1-ub-generic' not empty so not removed.
$ ls /lib/modules/2.6.28-1-ub-generic
modules.seriomap

Fixing up the postrm so it purges the modules.seriomap:
$ sudo dpkg -i linux-image-2.6.28-1-ub-generic_2.6.28-1.1_amd64.deb
[...]
$ sudo dpkg -P linux-image-2.6.28-1-ub-generic
[...]
$ ls /lib/modules/2.6.28-1-ub-generic
ls: cannot access /lib/modules/2.6.28-1-ub-generic: No such file or directory

Something is clearly wrong with the postrm purge support. We are unconditionally removing the directory regardless of the fact its completely reasonable for there to be files from other packages (headers, source etc) in this directory. Looking at it closely it only seems to work that way because the dependancy map files modules.*map are treated as configuration files. But actually they are not. We are completely happy to remove the main member of this collection modules.map in the normal remove and on a reinstall we simply overwrite the lot of them, no user modification is expected; nor does it appear sensible.

Put together a patch to clean this lot up (attached).

With the patched prerm/postrm:

$ sudo dpkg -i linux-image-2.6.28-1-ub-generic_2.6.28-1.1_amd64.deb
[...]
$ sudo dpkg -i linux-headers-2.6.28-1-ub
[...]
$ ls /lib/modules/2.6.28-1-ub-generic
build modules.alias modules.ieee1394map modules.ofmap modules.symbols
initrd modules.ccwmap modules.inputmap modules.pcimap modules.usbmap
kernel modules.dep modules.isapnpmap modules.seriomap
$ sudo dpkg -P linux-image-2.6.28-1-ub-generic
[...]
$ ls /lib/modules/2.6.28-1-ub-generic
build
$ sudo dpkg -r linux-headers-2.6.28-1-ub-generic
[...]
$ ls /lib/modules/2.6.28-1-ub-generic
ls: cannot access /lib/modules/2.6.28-1-ub-generic: No such file or directory

Much more believable. Will push this up for review.