FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 12-04-2008, 01:27 PM
Andy Whitcroft
 
Default UBUNTU: clean up module dependancy information on package removal/purge

Bug: #399773

Currently when we purge (dpkg -P) a kernel image we emit the following
warning and fail to clean up the /lib/modules/<version> directory:

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.

This may be triggered by a number of things:

1) recently depmod started producing a new map file modules.seriomap,
which we do not know about and do not purge,
2) if the kernel-header files are installed there is a build symbolic
link in this directory,
3) if the kernel-source files are installed there is a source symbolic
link in this directory, and
4) it is possible to have an updates directory here from the dkms
system.

When these are encountered we fail to clear the directory and our
unconditional directory remove will fail leading to this missleading
warning.

When examining the prerm and postrm handling for this package a number
of things are apparent:

1) the main dependancy information modules.dep is removed on a normal
package removal (non-purge),
2) the remaining dependancy information modules.aliases,
modules.symbols, and modules.*map are only removed on a purge, and
3) during a purge we attempt to remove files belonging to other
packages the build and source links (although the code will fail to
remove them as they are links and not files).

If we consider the official difference between a module remove and a purge
we find that a purge is meant to also take away any local configuration
files for this package. These dependancy files are not configuration
files for the module loader, those are all in /etc/modprobe.d these are
all data generated by the install of the kernel package and indeed are
all overwritten without comment on a reinstall. Basically they should
be considered in the same manner as the modules.dep file and removed
when the package is removed.

This patch fixes up this whole lot, it:

1) moves removal of all dependancy related files over to prerm with the
removal of modules.dep,
2) adds the new modules.seriomap file to the list of files to be removed, and
3) removes build and source from the removal list.

This also fixes the original issue (the warning) by moving removal to the
prerm phase, so that the files are removed before the primary directory
deletion is attempted. This allows the normal reference counting for
this directory to work as normal. The directory being removed when all
packages storing files within are removed from the system.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
debian/control-scripts/postrm | 23 -----------------------
debian/control-scripts/prerm | 18 +++++++++++++++---
2 files changed, 15 insertions(+), 26 deletions(-)

diff --git a/debian/control-scripts/postrm b/debian/control-scripts/postrm
index b5b985c..3326a15 100644
--- a/debian/control-scripts/postrm
+++ b/debian/control-scripts/postrm
@@ -342,29 +342,6 @@ if ($ARGV[0] !~ /upgrade/) {
image_magic("initrd.img.old", $image_dest) if $initrd;
}

-
-# Ignore all invocations except when called on to purge.
-exit 0 unless $ARGV[0] =~ /purge/;
-
-my @files_to_remove = qw{
- modules.dep modules.isapnpmap modules.pcimap
- modules.usbmap modules.parportmap
- modules.generic_string modules.ieee1394map
- modules.ieee1394map modules.pnpbiosmap
- modules.alias modules.ccwmap modules.inputmap
- modules.symbols build source modules.ofmap
- };
-
-foreach my $extra_file (@files_to_remove) {
- if (-f "/lib/modules/$version/$extra_file") {
- unlink "/lib/modules/$version/$extra_file";
- }
-}
-
-if (-d "/lib/modules/$version" ) {
- system ("rmdir", "/lib/modules/$version");
-}
-
exit 0;

__END__
diff --git a/debian/control-scripts/prerm b/debian/control-scripts/prerm
index dfef8c9..47fbd21 100644
--- a/debian/control-scripts/prerm
+++ b/debian/control-scripts/prerm
@@ -277,9 +277,21 @@ if (-d "/etc/kernel/prerm.d/$version") {
}

sub success () {
- -f "/lib/modules/$version/modules.dep" &&
- unlink "/lib/modules/$version/modules.dep";
- exit 0;
+ my @files_to_remove = qw{
+ modules.dep modules.isapnpmap modules.pcimap
+ modules.usbmap modules.parportmap
+ modules.generic_string modules.ieee1394map
+ modules.ieee1394map modules.pnpbiosmap
+ modules.alias modules.ccwmap modules.inputmap
+ modules.symbols modules.ofmap modules.seriomap
+ };
+
+ foreach my $extra_file (@files_to_remove) {
+ if (-f "/lib/modules/$version/$extra_file") {
+ unlink "/lib/modules/$version/$extra_file";
+ }
+ }
+ exit 0;
}


--
1.6.0.4.911.gc990


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 01:17 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org