Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Kernel (http://www.linux-archive.org/debian-kernel/)
-   -   Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs (http://www.linux-archive.org/debian-kernel/375358-bug-582858-initramfs-tools-modules-dep-fails-when-ubifs.html)

Daniel Kahn Gillmor 05-24-2010 09:00 AM

Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs
 
Package: initramfs-tools
Version: 0.94.4
Severity: normal

When / is on ubifs, if i set MODULES=dep in
/etc/initramfs-tools/initramfs.conf, i get the following error:

0 root@moo:~# update-initramfs -k all -u
update-initramfs: Generating /boot/initrd.img-2.6.32-5-kirkwood
readlink: missing operand
Try `readlink --help' for more information.
stdin: Illegal seek
mkinitramfs: for root missing /sys/block/ entry
mkinitramfs: workaround is MODULES=most
mkinitramfs: Error please report the bug
update-initramfs: failed for /boot/initrd.img-2.6.32-5-kirkwood
0 root@moo:~#

here's more information about this machine (it's a guruplug, running
directly from nand flash:

0 root@moo:~# cat /proc/cmdline
console=ttyS0,115200n8 root=ubi0:root ubi.mtd=2 rootfstype=ubifs
0 root@moo:~# cat /proc/mounts
rootfs / rootfs rw 0 0
none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
none /proc proc rw,nosuid,nodev,noexec,relatime 0 0
none /dev devtmpfs rw,relatime,size=254824k,nr_inodes=63706,mode=755 0 0
none /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode= 000 0 0
ubi0:root / ubifs rw,relatime 0 0
tmpfs /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0
tmpfs /var/cache/apt/archives tmpfs rw,nosuid,nodev,noexec,relatime,mode=755 0 0
tmpfs /tmp tmpfs rw,relatime 0 0
/dev/md0 /home ext3 rw,relatime,errors=continue,data=ordered 0 0
0 root@moo:~#

I can provide more info if you want it; please let me know.

Thanks for keeping initramfs-tools up-to-date!

--dkg


-- Package-specific info:
-- /proc/cmdline
console=ttyS0,115200n8 root=ubi0:root ubi.mtd=2 rootfstype=ubifs

-- /proc/filesystems
ext3

-- lsmod
Module Size Used by
ext3 110692 1
jbd 37274 1 ext3
mbcache 4860 1 ext3
sd_mod 31168 2
crc_t10dif 1106 1 sd_mod
ipv6 252757 10
btmrvl_sdio 8140 0
btmrvl 10622 1 btmrvl_sdio
libertas_sdio 6387 0
bluetooth 47558 1 btmrvl
libertas 79561 1 libertas_sdio
mv_cesa 4620 0
rfkill 14240 1 bluetooth
lib80211 3680 1 libertas
usb_storage 34775 2
aes_generic 32820 1 mv_cesa
raid0 5835 1
md_mod 80194 2 raid0
mmc_block 7634 0
sata_mv 24181 0
ehci_hcd 35267 0
libata 137558 1 sata_mv
mvsdio 5294 0
mv643xx_eth 22510 0
usbcore 122040 3 usb_storage,ehci_hcd
scsi_mod 119084 3 sd_mod,usb_storage,libata
mmc_core 49668 4 btmrvl_sdio,libertas_sdio,mmc_block,mvsdio
nls_base 5367 1 usbcore
libphy 14808 1 mv643xx_eth

-- /etc/initramfs-tools/initramfs.conf
MODULES=dep
BUSYBOX=y
KEYMAP=n
COMPRESS=gzip
BOOT=local
DEVICE=eth0
NFSROOT=auto

-- /sys/block
md0
mtdblock0
mtdblock1
mtdblock2
sda
sdb
sdc
sdd


-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: armel (armv5tel)

Kernel: Linux 2.6.32-5-kirkwood
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages initramfs-tools depends on:
ii cpio 2.11-4 GNU cpio -- a program to manage ar
ii findutils 4.4.2-1 utilities for finding files--find,
ii klibc-utils 1.5.18-1 small utilities built with klibc f
ii module-init-tools 3.12~pre2-3 tools for managing Linux kernel mo
ii udev 154-1 /dev/ and hotplug management daemo

Versions of packages initramfs-tools recommends:
ii busybox 1:1.14.2-2 Tiny utilities for small and embed

initramfs-tools suggests no packages.

-- Configuration Files:
/etc/initramfs-tools/initramfs.conf changed:
MODULES=dep
BUSYBOX=y
KEYMAP=n
COMPRESS=gzip
BOOT=local
DEVICE=eth0
NFSROOT=auto


-- no debconf information



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100524090039.1624.22938.reportbug@moo">http://lists.debian.org/20100524090039.1624.22938.reportbug@moo

Martin Michlmayr 06-07-2010 02:07 PM

Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs
 
tags 582858 + patch
thanks

* Daniel Kahn Gillmor <dkg@fifthhorseman.net> [2010-05-24 09:00]:
> 0 root@moo:~# update-initramfs -k all -u
> update-initramfs: Generating /boot/initrd.img-2.6.32-5-kirkwood
> readlink: missing operand
> Try `readlink --help' for more information.
> stdin: Illegal seek
> mkinitramfs: for root missing /sys/block/ entry

The patch below works for me. Can you try it?

--- a/hook-functions 2010-06-07 15:03:22.000000000 +0100
+++ b/hook-functions 2010-06-07 15:06:06.000000000 +0100
@@ -226,6 +226,14 @@

# findout root block device + fstype
eval "$(mount | awk '//dev// {if ($3 == "/") {print "root=" $1 "
FSTYPE=" $5; exit}}')"
+
+ # handle ubifs and return since ubifs root is a char device but
+ # most of the commands below only work with block devices.
+ if [ "${FSTYPE}" = "ubifs" ]; then
+ manual_add_modules "${FSTYPE}"
+ return
+ fi
+
if [ "${root}" = "/dev/root" ] ; then
root="/dev/disk/by-uuid/"$(blkid -o value -s UUID ${root}) 2>/dev/null
fi

--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100607140726.GY4688@jirafa.cyrius.com">http://lists.debian.org/20100607140726.GY4688@jirafa.cyrius.com

Martin Michlmayr 06-07-2010 05:10 PM

Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs
 
* Martin Michlmayr <tbm@cyrius.com> [2010-06-07 15:07]:
> The patch below works for me. Can you try it?

I should mention that "works for me" means that the initramfs will be
generated without error.

I'm not claiming that you'll actually be able to boot from ubifs with
that ramdisk though. For that, i-t needs to be taught to know what to
do about something like root=ubi0:rootfs.

--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100607171049.GA31558@jirafa.cyrius.com">http://lists.debian.org/20100607171049.GA31558@jirafa.cyrius.com

Michael Prokop 06-07-2010 11:21 PM

Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs
 
* Martin Michlmayr <tbm@cyrius.com> [Mon Jun 07, 2010 at 06:10:49 +0100]:
> * Martin Michlmayr <tbm@cyrius.com> [2010-06-07 15:07]:
> > The patch below works for me. Can you try it?

> I should mention that "works for me" means that the initramfs will be
> generated without error.

Thanks for the patch, Martin.
Can I apply it already to i-t?

> I'm not claiming that you'll actually be able to boot from ubifs with
> that ramdisk though. For that, i-t needs to be taught to know what to
> do about something like root=ubi0:rootfs.

I see "root=ubi0:root ubi.mtd=2 rootfstype=ubifs" in the additional
information section of the original bugreport. Who does evaluate
this stuff in the guruplug device that's supposed to work?
And what's behind ubi0:root?

regards,
-mika-

Martin Michlmayr 06-08-2010 08:58 AM

Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs
 
* Michael Prokop <mika@debian.org> [2010-06-08 01:21]:
> Thanks for the patch, Martin.
> Can I apply it already to i-t?

Sure.

> > I'm not claiming that you'll actually be able to boot from ubifs with
> > that ramdisk though. For that, i-t needs to be taught to know what to
> > do about something like root=ubi0:rootfs.
>
> I see "root=ubi0:root ubi.mtd=2 rootfstype=ubifs" in the additional
> information section of the original bugreport. Who does evaluate
> this stuff in the guruplug device that's supposed to work?
> And what's behind ubi0:root?

ubi.mtd=2 says that /dev/mtd2 should be used for ubi; this is then
ubi0. ubi0:root is the root volume.

I'm away this week but I'll try to look into this next week.
--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100608085834.GI31084@jirafa.cyrius.com">http://lists.debian.org/20100608085834.GI31084@jirafa.cyrius.com

Michael Prokop 06-08-2010 09:20 AM

Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs
 
* Martin Michlmayr <tbm@cyrius.com> [Tue Jun 08, 2010 at 09:58:34AM +0100]:
> * Michael Prokop <mika@debian.org> [2010-06-08 01:21]:
> > Thanks for the patch, Martin.
> > Can I apply it already to i-t?

> Sure.

Thanks, done.

> > > I'm not claiming that you'll actually be able to boot from ubifs with
> > > that ramdisk though. For that, i-t needs to be taught to know what to
> > > do about something like root=ubi0:rootfs.

> > I see "root=ubi0:root ubi.mtd=2 rootfstype=ubifs" in the additional
> > information section of the original bugreport. Who does evaluate
> > this stuff in the guruplug device that's supposed to work?
> > And what's behind ubi0:root?

> ubi.mtd=2 says that /dev/mtd2 should be used for ubi; this is then
> ubi0. ubi0:root is the root volume.

> I'm away this week but I'll try to look into this next week.

This would be great, thanks.

regards,
-mika-

Daniel Kahn Gillmor 06-08-2010 03:35 PM

Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs
 
On 06/07/2010 10:07 AM, Martin Michlmayr wrote:
> tags 582858 + patch
> thanks
>
> * Daniel Kahn Gillmor <dkg@fifthhorseman.net> [2010-05-24 09:00]:
>> 0 root@moo:~# update-initramfs -k all -u
>> update-initramfs: Generating /boot/initrd.img-2.6.32-5-kirkwood
>> readlink: missing operand
>> Try `readlink --help' for more information.
>> stdin: Illegal seek
>> mkinitramfs: for root missing /sys/block/ entry
>
> The patch below works for me. Can you try it?
>
> --- a/hook-functions 2010-06-07 15:03:22.000000000 +0100
> +++ b/hook-functions 2010-06-07 15:06:06.000000000 +0100
> @@ -226,6 +226,14 @@
>
> # findout root block device + fstype
> eval "$(mount | awk '//dev// {if ($3 == "/") {print "root=" $1 "
FSTYPE=" $5; exit}}')"
> +
> + # handle ubifs and return since ubifs root is a char device but
> + # most of the commands below only work with block devices.
> + if [ "${FSTYPE}" = "ubifs" ]; then
> + manual_add_modules "${FSTYPE}"
> + return
> + fi
> +
> if [ "${root}" = "/dev/root" ] ; then
> root="/dev/disk/by-uuid/"$(blkid -o value -s UUID ${root}) 2>/dev/null
> fi


hrm, doesn't seem to work for me. Am i applying it in the wrong place?
Here's a transcript of a failure, patch application, and a repeated
failure:

>> 0 root@moo:/usr/share/initramfs-tools# grep ^MODULES /etc/initramfs-tools/initramfs.conf
>> MODULES=dep
>> 0 root@moo:/usr/share/initramfs-tools# update-initramfs -v -k $(uname -r) -u
>> Keeping /boot/initrd.img-2.6.32-5-kirkwood.dpkg-bak
>> update-initramfs: Generating /boot/initrd.img-2.6.32-5-kirkwood
>> readlink: missing operand
>> Try `readlink --help' for more information.
>> stdin: Illegal seek
>> mkinitramfs: for root missing /sys/block/ entry
>> mkinitramfs: workaround is MODULES=most
>> mkinitramfs: Error please report the bug
>> Removing /boot/initrd.img-2.6.32-5-kirkwood.dpkg-bak
>> update-initramfs: failed for /boot/initrd.img-2.6.32-5-kirkwood
>> 1 root@moo:/usr/share/initramfs-tools# patch -p1 < /root/582858.diff
>> patching file hook-functions
>> Hunk #1 succeeded at 258 (offset 32 lines).
>> 0 root@moo:/usr/share/initramfs-tools# update-initramfs -v -k $(uname -r) -u
>> Keeping /boot/initrd.img-2.6.32-5-kirkwood.dpkg-bak
>> update-initramfs: Generating /boot/initrd.img-2.6.32-5-kirkwood
>> readlink: missing operand
>> Try `readlink --help' for more information.
>> stdin: Illegal seek
>> mkinitramfs: for root missing /sys/block/ entry
>> mkinitramfs: workaround is MODULES=most
>> mkinitramfs: Error please report the bug
>> Removing /boot/initrd.img-2.6.32-5-kirkwood.dpkg-bak
>> update-initramfs: failed for /boot/initrd.img-2.6.32-5-kirkwood
>> 1 root@moo:/usr/share/initramfs-tools#

It still works fine with MODULES=list, of course.

--dkg

Martin Michlmayr 06-08-2010 05:27 PM

Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs
 
* Daniel Kahn Gillmor <dkg@fifthhorseman.net> [2010-06-08 11:35]:
> hrm, doesn't seem to work for me. Am i applying it in the wrong place?
> Here's a transcript of a failure, patch application, and a repeated
> failure:

With the patch applied, can you do:
sh -x mkinitramfs -k $(uname -r) -o /tmp/foo > debug 2>&1
bzip2 -9 debug
and then send me debug.bz2.

--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100608172702.GJ1641@jirafa.cyrius.com">http://lists.debian.org/20100608172702.GJ1641@jirafa.cyrius.com

Martin Michlmayr 06-08-2010 07:31 PM

Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs
 
* Daniel Kahn Gillmor <dkg@fifthhorseman.net> [2010-06-08 15:22]:
> >> rootfs on / type rootfs (rw)
> >> ubi0:root on / type ubifs (rw,relatime)
^^^^^^^^^
This is the output from 'mount', and here's what i-t does:

eval "$(mount | awk '//dev// {if ($3 == "/") {print "root=" $1 "
FSTYPE=" $5; exit}}')"

it looks for something with /dev/ in it. In your case, this does't
match so root= and FSTYPE= are empty. I think we should simply add a
check to i-t at this point to produce an error when $root is empty.

Daniel, do you know if ubi0:root in /etc/fstab is valid? Is that what
the ubi people recommend to use? Shouldn't this be a device like
/dev/ubiX_Y? (This would make i-t happy)

--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100608193103.GD29780@jirafa.cyrius.com">http://lists.debian.org/20100608193103.GD29780@jirafa.cyrius.com

Martin Michlmayr 06-08-2010 07:43 PM

Bug#582858: initramfs-tools: MODULES=dep fails when / is ubifs
 
* Martin Michlmayr <tbm@cyrius.com> [2010-06-08 21:31]:
> This is the output from 'mount', and here's what i-t does:
>
> eval "$(mount | awk '//dev// {if ($3 == "/") {print "root=" $1 "
FSTYPE=" $5; exit}}')"
>
> it looks for something with /dev/ in it. In your case, this does't
> match so root= and FSTYPE= are empty. I think we should simply add a
> check to i-t at this point to produce an error when $root is empty.

[PATCH] Produce an error when root cannot be determined with MODULES=dep

A lot of code in dep_add_modules() uses $root. Therefore, produce an
error message if we cannot determine the root device.

Signed-off-by: Martin Michlmayr <tbm@cyrius.com>

diff --git a/hook-functions b/hook-functions
index 6a6e233..154ae3e 100644
--- a/hook-functions
+++ b/hook-functions
@@ -226,6 +226,11 @@ dep_add_modules()

# findout root block device + fstype
eval "$(mount | awk '//dev// {if ($3 == "/") {print "root=" $1 "
FSTYPE=" $5; exit}}')"
+ if [ -z "$root" ]; then
+ echo "mkinitramfs: failed to determine root device"
+ echo "mkinitramfs: workaround is MODULES=most"
+ echo "Error please report bug on initramfs-tools and include the output of 'mount'"
+ fi

# handle ubifs and return since ubifs root is a char device but
# most of the commands below only work with block devices.

--
Martin Michlmayr
http://www.cyrius.com/



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100608194308.GA31538@jirafa.cyrius.com">http://lists.debian.org/20100608194308.GA31538@jirafa.cyrius.com


All times are GMT. The time now is 07:32 AM.

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