2.6.31 snapshots: all kernels without initrd broken
Rainer M. Canavan reporetd that the Cobalt 2.6.31 snapshot doesn't
install. In fact, all kernels that do not use an initramfs are
currently uninstallable. Looking at SVN logs, I see that maks removed
various initrd handling because he thought it wasn't necessary. mips,
mipsel and some other kernels (e.g. s390) don't use an initramfs, so
this code is definitely still required.
I came up with the following patch reverting some of maks removals.
The package installs now but I still get the following warning:
Could not find . at /var/lib/dpkg/tmp.ci/preinst line 165, <STDIN> line 9.
Since I'm not very familiar with the config scripts, I wanted to ask
if someone else can take a look at this.
Here is the patch that sort-of works:
Index: templates/temp.image.plain/postinst
===================================================================
--- templates/temp.image.plain/postinst (revision 14281)
+++ templates/temp.image.plain/postinst (working copy)
@@ -37,6 +37,7 @@
my $loader = "=L"; # lilo, silo, quik, palo, vmelilo, nettrom, arcboot or delo
my $image_dir = "=D"; # where the image is located
my $relative_links = ""; # target machine defined
+my $initrd = "=I"; # initrd kernel
my $mkimage = "=M"; # command to generate the initrd image
my $use_hard_links = ''; # hardlinks do not work across fs boundaries
my $postinst_hook = ''; #Normally we do not
@@ -145,6 +146,12 @@
+# For some versions of kernel-package, we had this warning in the
+# postinst, but the rules did not really interpolate the value in.
+# Here is a sanity check.
+my $pattern = "=" . "I";
+$initrd=~ s/^$pattern$//;
+
if ($link_in_boot) {
$image_dest = "/$image_dir/"; # same as realimageloc
}
@@ -717,10 +724,15 @@
my $signal_num = $? & 127;
my $dumped_core = $? & 128;
if ($ret) {
+ if ( -f "$modules_base/$version/modules.dep") {
+ unlink "$modules_base/$version/modules.dep" unless $initrd;
+ }
my $seen;
my $answer;
- $question = "${package_name}/postinst/depmod-error-initrd-$version";
-
+ my $question = "${package_name}/postinst/depmod-error-$version";
+ if ($initrd) {
+ $question = "${package_name}/postinst/depmod-error-initrd-$version";
+ }
($ret,$seen) = fset ("$question", 'seen', 'false');
die "Error setting debconf flags in $question: $seen" if $ret;
@@ -866,12 +878,15 @@
}
-my @ramdisklist;
-@ramdisklist = find_inird_tool($ramdisk) if $ramdisk;
-die "Failed to find suitable initramfs generation tool in $ramdisk\n"
+# The initrd symlink should probably be in the same dir that the
+# symlinks are in
+if ($initrd) {
+ my @ramdisklist;
+ @ramdisklist = find_inird_tool($ramdisk) if $ramdisk;
+ die "Failed to find suitable initramfs generation tool in $ramdisk\n"
if $#ramdisklist < 0;
-my $success = 0;
-for $ramdisk_cmd (@ramdisklist) {
+ my $success = 0;
+ for $ramdisk_cmd (@ramdisklist) {
print STDERR "Running $ramdisk_cmd.\n";
print STDERR "Other valid candidates: @ramdisklist\n" if $#ramdisklist > 0;
@@ -885,17 +900,40 @@
$success = 1;
last;
}
-}
-die "Failed to create initrd image.\n" unless $success;
-if (! defined $ARGV[1] || ! $ARGV[1] || $ARGV[1] =~ m/<unknown>/og) {
+ }
+ die "Failed to create initrd image.\n" unless $success;
+ if (! defined $ARGV[1] || ! $ARGV[1] || $ARGV[1] =~ m/<unknown>/og) {
image_magic("initrd.img", $image_dest);
-} else {
+ }
+ else {
if (! -e "initrd.img") {
handle_missing_link("initrd.img", $image_dest, "initrd.img-$version",
$realimageloc);
}
+ }
+
}
+else { # Not making an initrd emage
+ if (-l "initrd.img") {
+ # Ooh, last image was an initrd image? in any case, we should move it.
+ my $target = readlink "initrd.img";
+ my $real_target = '';
+ $real_target = abs_path($target) if defined ($target);
+ if (!defined($target) || ! -f "$real_target") {
+ # Eh. dangling link. can safely be removed.
+ unlink("initrd.img");
+ } else {
+ if (-l "initrd.img.old" || ! -e "initrd.img.old" ) {
+ rename("initrd.img", "initrd.img.old");
+ } else {
+ warn "initrd.img.old is not a symlink, not clobbering\n";
+ unlink("initrd.img");
+ }
+ }
+ }
+}
+
# Only change the symlinks if we are not being upgraded
if (! defined $ARGV[1] || ! $ARGV[1] || $ARGV[1] =~ m/<unknown>/og) {
image_magic($kimage, $image_dest);
Index: templates/temp.image.plain/postrm
===================================================================
--- templates/temp.image.plain/postrm (revision 14281)
+++ templates/temp.image.plain/postrm (working copy)
@@ -45,6 +45,8 @@
my $kimage = "=K"; # Should be empty, mostly
my $loader = "=L"; # lilo, silo, quik, palo, vmelilo, or nettrom
my $image_dir = "=D"; # where the image is located
+my $initrd = "=I"; # initrd kernel
+my $mkimage = "=M"; # command to generate the initrd image
my $use_hard_links = ''; # hardlinks do not work across fs boundaries
my $postrm_hook = ''; #Normally we do not
my $minimal_swap = ''; # Do not swap symlinks
@@ -55,6 +57,7 @@
my $arch = "=A"; # should be same as dpkg --print-installation-architecture
my $kernel_arch = "=B";
my $ramdisk = "=MK"; # List of tools to create initial ram fs.
+my $initrddep = "=MD"; # List of dependencies for such tools
my $package_name = "=ST-image-$version";
my $Loader = "NoLOADER"; #
@@ -132,6 +135,8 @@
$image_dest = "$1" if /image_dest\s*=\s*(\S+)/ig;
$postrm_hook = "$1" if /postrm_hook\s*=\s*(\S+)/ig;
+ $mkimage = "$1" if /mkimage\s*=\s*(.+)$/ig;
+ $ramdisk = "$1" if /ramdisk\s*=\s*(.+)$/ig;
}
close CONF;
$have_conffile = "Yes";
@@ -326,8 +331,8 @@
# check and remove damaged and dangling symlinks
image_magic($kimage, $image_dest);
image_magic($kimage . ".old", $image_dest);
- image_magic("initrd.img", $image_dest);
- image_magic("initrd.img.old", $image_dest);
+ image_magic("initrd.img", $image_dest) if $initrd;
+ image_magic("initrd.img.old", $image_dest) if $initrd;
}
Index: templates/temp.image.plain/prerm
===================================================================
--- templates/temp.image.plain/prerm (revision 14281)
+++ templates/temp.image.plain/prerm (working copy)
@@ -33,6 +33,8 @@
my $kimage = "=K"; # Should be empty, mostly
my $loader = "=L"; # lilo, silo, quik, palo, vmelilo, or nettrom
my $image_dir = "=D"; # where the image is located
+my $mkimage = "=M"; # command to generate the initrd image
+my $initrd = "=I"; # initrd kernel
my $use_hard_links = ''; # hardlinks do not wirk across fs boundaries
my $prerm_hook = ''; #Normally we do not
my $minimal_swap = ''; # Do not swap symlinks
@@ -42,6 +44,8 @@
my $official_image = "=OF"; # only true for official images
my $arch = "=A"; # should be same as dpkg --print-installation-architecture
my $kernel_arch = "=B";
+my $ramdisk = "=MK"; # List of tools to create initial ram fs.
+my $initrddep = "=MD"; # List of dependencies for such tools
my $package_name = "=ST-image-$version";
my $Loader = "NoLOADER"; #
@@ -135,6 +139,8 @@
$image_dest = "$1" if /image_dest\s*=\s*(\S+)/ig;
$prerm_hook = "$1" if /prerm_hook\s*=\s*(\S+)/ig;
+ $mkimage = "$1" if /mkimage\s*=\s*(.+)$/ig;
+ $ramdisk = "$1" if /ramdisk\s*=\s*(.+)$/ig;
}
close CONF;
$have_conffile = "Yes";
Index: templates/temp.image.plain/templates
===================================================================
--- templates/temp.image.plain/templates (revision 14281)
+++ templates/temp.image.plain/templates (working copy)
@@ -12,6 +12,18 @@
.
${initrddep}
+Template: =ST-image-=V/postinst/depmod-error-=V
+Type: boolean
+Default: false
+Description: Abort installation after depmod error?
+ The 'depmod' command exited with the exit code ${exit_value}
+ (${SIGNAL}${CORE}).
+ .
+ This may be benign, for instance because of versioned symbol names.
+ .
+ Please choose whether the installation should be aborted or the error
+ just ignored.
+
Template: =ST-image-=V/postinst/depmod-error-initrd-=V
Type: boolean
Default: false
Here the relevant SVN log:
r14021 | maks | 2009-07-27 13:14:01 +0100 (Mon, 27 Jul 2009) | 3 lines
Changed paths:
M /dists/trunk/linux-2.6/debian/templates/temp.image.plain/postinst
postinst cleanup the !initrd code pathes
never used and useless.
------------------------------------------------------------------------
r14020 | maks | 2009-07-27 13:13:50 +0100 (Mon, 27 Jul 2009) | 1 line
Changed paths:
M /dists/trunk/linux-2.6/debian/templates/temp.image.plain/prerm
prerm cleanup from unused variables related to initramfs
------------------------------------------------------------------------
r14019 | maks | 2009-07-27 13:13:41 +0100 (Mon, 27 Jul 2009) | 1 line
Changed paths:
M /dists/trunk/linux-2.6/debian/templates/temp.image.plain/postrm
postrm cleanup initramfs related variables
------------------------------------------------------------------------
r14018 | maks | 2009-07-27 13:13:29 +0100 (Mon, 27 Jul 2009) | 4 lines
Changed paths:
M /dists/trunk/linux-2.6/debian/templates/temp.image.plain/postinst
M /dists/trunk/linux-2.6/debian/templates/temp.image.plain/templates
postinst nuke useless depmod-error template
as we always ship an initramfs that code path,
was never executed and thus is useless for us, nuke it.
------------------------------------------------------------------------
r14017 | maks | 2009-07-27 13:13:11 +0100 (Mon, 27 Jul 2009) | 1 line
Changed paths:
M /dists/trunk/linux-2.6/debian/templates/temp.image.plain/config
config clean up of usesless variables regarding initramfs
But report:
* Rainer M. Canavan <rainer@canavan.de> [2009-09-21 21:17]:
> Martin Michlmayr <tbm@cyrius.com> wrote:
> >
> [...]
> > Debian on MIPS doesn't use an initrd or ramdisk - everything that's
> > needed is built in.
>
> Hi,
>
> I know, but you experimental r14136 Kernel apparently does not:
>
> +----------------------+ Configuring linux-image-2.6.31-rc6-r5k-cobalt +----------------------+
> | |
> | Initial RAMdisk image generation impossible |
> | |
> | You are attempting to install an initrd kernel image (version 2.6.31-rc6-r5k-cobalt) on a |
> | machine currently running kernel version 2.6.22-3-r5k-cobalt. |
> | |
> | No suitable tool for generating initrd images was found in and therefore no initrd image |
> | can be generated. This will break the installation, unless such tools are also being |
> | installed right now. Suitable tools: |
> | |
> | D |
> | |
> | <Ok> |
> | |
> +---------------------------------------------------------------------------------------------+
>
> Could not find . at /var/lib/dpkg/tmp.ci/preinst line 165, <STDIN> line 9.
> Setting up linux-image-2.6.31-rc6-r5k-cobalt (2.6.31~rc6-1~experimental.1) ...
> Running depmod.
> Failed to find suitable initramfs generation tool in
> dpkg: error processing linux-image-2.6.31-rc6-r5k-cobalt (--install):
> subprocess post-installation script returned error exit status 2
> Errors were encountered while processing:
> linux-image-2.6.31-rc6-r5k-cobalt
>
> # dpkg -l |grep linux-image-2.6.31
> iF linux-image-2.6.31-rc6-r5k-cobalt 2.6.31~rc6-1~experimental.1 Linux 2.6.31-rc6 image on Cobalt
--
Martin Michlmayr
http://www.cyrius.com/
Reply to: