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.
Going through some experiments:
Simple install/deinstall: 2.6.28- 1-ub-generic_ 2.6.28- 1.1_amd64. deb 2.6.28- 1-ub-generic 2.6.28- 1-ub-generic
$ sudo dpkg -i linux-image-
[...]
$ sudo dpkg -r linux-image-
[...]
$ ls /lib/modules/
modules.alias modules.inputmap modules.pcimap modules.usbmap
modules.ccwmap modules.isapnpmap modules.seriomap
modules.ieee1394map modules.ofmap modules.symbols
Simple install/Purge: 2.6.28- 1-ub-generic_ 2.6.28- 1.1_amd64. deb 2.6.28- 1-ub-generic 2.6.28- 1-ub-generic' : Directory not empty 2.6.28- 1-ub-generic, directory `/lib/modules/ 2.6.28- 1-ub-generic' not empty so not removed. 2.6.28- 1-ub-generic
$ sudo dpkg -i linux-image-
[...]
$ sudo dpkg -P linux-image-
[...]
rmdir: failed to remove `/lib/modules/
dpkg - warning: while removing linux-image-
$ ls /lib/modules/
modules.seriomap
Fixing up the postrm so it purges the modules.seriomap: 2.6.28- 1-ub-generic_ 2.6.28- 1.1_amd64. deb 2.6.28- 1-ub-generic 2.6.28- 1-ub-generic 2.6.28- 1-ub-generic: No such file or directory
$ sudo dpkg -i linux-image-
[...]
$ sudo dpkg -P linux-image-
[...]
$ ls /lib/modules/
ls: cannot access /lib/modules/
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 2.6.28- 1-ub 2.6.28- 1-ub-generic 2.6.28- 1-ub-generic 2.6.28- 1-ub-generic 2.6.28- 1-ub-generic 2.6.28- 1-ub-generic 2.6.28- 1-ub-generic: No such file or directory
[...]
$ sudo dpkg -i linux-headers-
[...]
$ ls /lib/modules/
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-
[...]
$ ls /lib/modules/
build
$ sudo dpkg -r linux-headers-
[...]
$ ls /lib/modules/
ls: cannot access /lib/modules/
Much more believable. Will push this up for review.