Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Kernel (http://www.linux-archive.org/debian-kernel/)
-   -   postinst of linux-image complains if initrd has different file name (http://www.linux-archive.org/debian-kernel/654614-postinst-linux-image-complains-if-initrd-has-different-file-name.html)

Thomas Lange 04-10-2012 05:10 PM

postinst of linux-image complains if initrd has different file name
 
Hi,

when using dracut (017-1) instead of initramfs-tools on a wheezy
machine /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst creates
and complains about a dangling symlink /initrd.img. This is because
dracut creates a initrd file called initramfs-3.2.0-2-amd64.img. This
is properly detected by update-grub but not by the postinst script of
the linux-image package.

Is there a policy that the initrd must be called initrd.img-`uname
-r`? Since grub handles different initrd file names (in
/etc/grub.d/10_linux), I assume the postinst of the linux-image
package should also handle a initrd called initramfs*.img.

If dracut would use the same name for the initrd as initramfs-tools,
then there are two programs in /etc/kernel/postinst.d which would
write to the same file. So, IMO dracut must use another file name
for its initrd and the postinst of linux-image should support initrd
file names like initramfs...... What's your oppinion?





Here's the log of a test on my wheezy machine without initramfs-tools
installed, but using dracut 017-1. I've set debug=1 in the postinst script.

This is what I did:

rm /vmli* /initr*
ls -l /vmlinu* /initr* /boot/vmlinu* /boot/initr*
/var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst configure
ls -l /vmlinu* /initr* /boot/vmlinu* /boot/initr*
/var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst configure
ls -l /vmlinu* /initr* /boot/vmlinu* /boot/initr*


Script started on Tue 10 Apr 2012 06:12:36 PM CEST
wheezy[~]# rm /vmli* /initr*
wheezy[~]# ls -l /vmlinu* /initr* /boot/vmlinu* /boot/initr*
-rw-r--r-- 1 root root 14130694 Apr 10 18:11 /boot/initramfs-3.2.0-2-amd64.img
-rw-r--r-- 1 root root 2804816 Mar 20 20:35 /boot/vmlinuz-3.2.0-2-amd64

wheezy[~]# /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst configure
Running depmod.
image_magic: kimage=vmlinuz, image_dest=/
image_name=vmlinuz-3.2.0-2-amd64, src_dir=/boot/ at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 449, <STDIN> line 2.
handle_missing_link: kimage=vmlinuz, image_dest=/
image_name=vmlinuz-3.2.0-2-amd64, src_dir=/boot/ at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 336, <STDIN> line 2.
Test relative: testing /boot/ -> / at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 130, <STDIN> line 2.
image_magic: kimage=initrd.img, image_dest=/
image_name=initrd.img-3.2.0-2-amd64, src_dir=/boot/ at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 449, <STDIN> line 2.
handle_missing_link: kimage=initrd.img, image_dest=/
image_name=initrd.img-3.2.0-2-amd64, src_dir=/boot/ at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 336, <STDIN> line 2.
Test relative: testing /boot/ -> / at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 130, <STDIN> line 2.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dracut 3.2.0-2-amd64 /boot/vmlinuz-3.2.0-2-amd64
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.2.0-2-amd64 /boot/vmlinuz-3.2.0-2-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-2-amd64 /boot/vmlinuz-3.2.0-2-amd64
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-2-amd64
Found initrd image: /boot/initramfs-3.2.0-2-amd64.img
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
done


wheezy[~]# ls -l /vmlinu* /initr* /boot/vmlinu* /boot/initr*
-rw-r--r-- 1 root root 14130547 Apr 10 18:13 /boot/initramfs-3.2.0-2-amd64.img
-rw-r--r-- 1 root root 2804816 Mar 20 20:35 /boot/vmlinuz-3.2.0-2-amd64
lrwxrwxrwx 1 root root 30 Apr 10 18:12 /initrd.img -> /boot/initrd.img-3.2.0-2-amd64
lrwxrwxrwx 1 root root 26 Apr 10 18:12 /vmlinuz -> boot/vmlinuz-3.2.0-2-amd64


wheezy[~]# /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst configure
Running depmod.
image_magic: kimage=vmlinuz, image_dest=/
image_name=vmlinuz-3.2.0-2-amd64, src_dir=/boot/ at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 449, <STDIN> line 2.
DEBUG: There is a symlink for vmlinuz
Move?: kimage=vmlinuz, image_dest=/,
image_name=vmlinuz-3.2.0-2-amd64, src_dir=/boot/ at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 185, <STDIN> line 2.
DEBUG: OK. We found symlink, and we should have a symlink here.
DEBUG: The link vmlinuz points to (boot/vmlinuz-3.2.0-2-amd64)
DEBUG: (boot/vmlinuz-3.2.0-2-amd64) is really (/boot/vmlinuz-3.2.0-2-amd64)
vmlinuz(/boot/vmlinuz-3.2.0-2-amd64
) points to /boot/vmlinuz-3.2.0-2-amd64
(/boot/vmlinuz-3.2.0-2-amd64) -- doing nothing at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 268, <STDIN> line 2.
image_magic: kimage=initrd.img, image_dest=/
image_name=initrd.img-3.2.0-2-amd64, src_dir=/boot/ at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 449, <STDIN> line 2.
DEBUG: There is a symlink for initrd.img
Move?: kimage=initrd.img, image_dest=/,
image_name=initrd.img-3.2.0-2-amd64, src_dir=/boot/ at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 185, <STDIN> line 2.
DEBUG: OK. We found symlink, and we should have a symlink here.
The link /initrd.img is a dangling linkto /boot/initrd.img-3.2.0-2-amd64
really_move_link: kimage=initrd.img, image_dest=/
image_name=initrd.img-3.2.0-2-amd64, src_dir=/boot/ at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 283, <STDIN> line 2.
Test relative: testing /boot/ -> / at /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst line 130, <STDIN> line 2.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dracut 3.2.0-2-amd64 /boot/vmlinuz-3.2.0-2-amd64
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.2.0-2-amd64 /boot/vmlinuz-3.2.0-2-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-2-amd64 /boot/vmlinuz-3.2.0-2-amd64
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-2-amd64
Found initrd image: /boot/initramfs-3.2.0-2-amd64.img
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
done


wheezy[~]# ls -l /vmlinu* /initr* /boot/vmlinu* /boot/initr*
-rw-r--r-- 1 root root 14130951 Apr 10 18:13 /boot/initramfs-3.2.0-2-amd64.img
-rw-r--r-- 1 root root 2804816 Mar 20 20:35 /boot/vmlinuz-3.2.0-2-amd64
lrwxrwxrwx 1 root root 30 Apr 10 18:13 /initrd.img -> /boot/initrd.img-3.2.0-2-amd64
lrwxrwxrwx 1 root root 30 Apr 10 18:12 /initrd.img.old -> /boot/initrd.img-3.2.0-2-amd64
lrwxrwxrwx 1 root root 26 Apr 10 18:12 /vmlinuz -> boot/vmlinuz-3.2.0-2-amd64

Script done on Tue 10 Apr 2012 06:14:01 PM CEST

--
regards Thomas


--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20356.27011.448201.954794@kueppers.informatik.uni-koeln.de">http://lists.debian.org/20356.27011.448201.954794@kueppers.informatik.uni-koeln.de

Ben Hutchings 04-11-2012 01:44 AM

postinst of linux-image complains if initrd has different file name
 
On Tue, 2012-04-10 at 19:10 +0200, Thomas Lange wrote:
> Hi,
>
> when using dracut (017-1) instead of initramfs-tools on a wheezy
> machine /var/lib/dpkg/info/linux-image-3.2.0-2-amd64.postinst creates
> and complains about a dangling symlink /initrd.img. This is because
> dracut creates a initrd file called initramfs-3.2.0-2-amd64.img. This
> is properly detected by update-grub but not by the postinst script of
> the linux-image package.
>
> Is there a policy that the initrd must be called initrd.img-`uname
> -r`?

It's not written anywhere, but linux-initramfs-tool is expected to
create files with this name.

> Since grub handles different initrd file names (in
> /etc/grub.d/10_linux), I assume the postinst of the linux-image
> package should also handle a initrd called initramfs*.img.

GRUB might know about this but I bet most of the other boot loaders
don't.

> If dracut would use the same name for the initrd as initramfs-tools,
> then there are two programs in /etc/kernel/postinst.d which would
> write to the same file. So, IMO dracut must use another file name
> for its initrd and the postinst of linux-image should support initrd
> file names like initramfs...... What's your oppinion?

I think dracut and initramfs-tools should each conflict with
linux-initramfs-tool.

Ben.

--
Ben Hutchings
It is easier to change the specification to fit the program than vice versa.

Thomas Lange 04-11-2012 08:39 AM

postinst of linux-image complains if initrd has different file name
 
>>>>> On Wed, 11 Apr 2012 02:44:44 +0100, Ben Hutchings <ben@decadent.org.uk> said:

>> If dracut would use the same name for the initrd as initramfs-tools,
>> then there are two programs in /etc/kernel/postinst.d which would
>> write to the same file. So, IMO dracut must use another file name
>> for its initrd and the postinst of linux-image should support initrd
>> file names like initramfs...... What's your oppinion?

> I think dracut and initramfs-tools should each conflict with
> linux-initramfs-tool.
Mmm, I think that's not possible. The linux-image package depends on
initramfs-tools or linux-initramfs-tool (see below). If dracut
conflicts with linux-initramfs-tool it can't be installed since the
linux-image package does not (yet) list dracut in its dependency
list. Additionally initramfs-tools currently provides
linux-initramfs-tool, so why should it now conflict with it?


Package: linux-image-3.2.0-2-amd64
Depends: kmod | module-init-tools, linux-base (>= 3~), initramfs-tools (>= 0.99~) | linux-initramfs-tool

--
regards Thomas


--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20357.17193.435028.446070@malzmuehle.informatik.un i-koeln.de">http://lists.debian.org/20357.17193.435028.446070@malzmuehle.informatik.un i-koeln.de

Ben Hutchings 04-11-2012 02:27 PM

postinst of linux-image complains if initrd has different file name
 
On Wed, 2012-04-11 at 10:39 +0200, Thomas Lange wrote:
> >>>>> On Wed, 11 Apr 2012 02:44:44 +0100, Ben Hutchings <ben@decadent.org.uk> said:
>
> >> If dracut would use the same name for the initrd as initramfs-tools,
> >> then there are two programs in /etc/kernel/postinst.d which would
> >> write to the same file. So, IMO dracut must use another file name
> >> for its initrd and the postinst of linux-image should support initrd
> >> file names like initramfs...... What's your oppinion?
>
> > I think dracut and initramfs-tools should each conflict with
> > linux-initramfs-tool.
> Mmm, I think that's not possible. The linux-image package depends on
> initramfs-tools or linux-initramfs-tool (see below). If dracut
> conflicts with linux-initramfs-tool it can't be installed since the
> linux-image package does not (yet) list dracut in its dependency
> list.

WTF? dracut provides linux-initramfs-tool.

> Additionally initramfs-tools currently provides
> linux-initramfs-tool, so why should it now conflict with it?
[...]

Because we don't want more than one installed.

Ben.

--
Ben Hutchings
It is easier to change the specification to fit the program than vice versa.


All times are GMT. The time now is 12:58 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.