Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 212794 - genkernel 3.4.10_pre4 doesn't boot livecd or rather liveUSB.
Summary: genkernel 3.4.10_pre4 doesn't boot livecd or rather liveUSB.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2008-03-09 05:53 UTC by devsk
Modified: 2021-09-08 14:00 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
dumb fix for "don't mount disk if it has at least one partition" (genkernel-3.4.10-liveusb-partition.patch,380 bytes, patch)
2008-03-09 06:23 UTC, devsk
Details | Diff
both fixes, and better check for disk (genkernel-3.4.10-liveusb-partition.patch,793 bytes, patch)
2008-03-09 06:34 UTC, devsk
Details | Diff
Sleep for scandelay instead of fixed 10 and 20 seconds (genkernel-3.4.10-misc.patch,1.16 KB, patch)
2008-03-09 19:35 UTC, devsk
Details | Diff
if at least one partition, skip the device (genkernel-3.4.10-misc.patch,1.43 KB, patch)
2008-03-23 19:13 UTC, devsk
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description devsk 2008-03-09 05:53:43 UTC
I am still hitting "mount: Mounting /dev/loop0 on /newroot/mnt/livecd failed:
Invalid argument", with squashfs-tools-3.2_p2 (tried 3.3 as well),
gentoo-sources-2.6.24 and genkernel-3.4.10_pre4. And I kept wondering why it
panics instead of throwing the shell. And then, I found a bug with
test_success:

test_success() {
        error_string=$1
        error_string="${error_string:-run command}"
        # If last command failed send error message and fall back to a shell
        if [ "$?" != '0' ]
        then
                bad_msg 'Failed to $1; failing back to the shell...'
                run_shell
        fi
}

That $? check will always succeed because error_string="${error_string:-run
command}" always succeeds. You need to store $? before hand, as soon as you
enter the function.

So, after I fixed the above, I was thrown into a shell. And I tried to mount my squashfs manually. Indeed, it failed with same error. Then, I noticed that /dev/sdd was mounted on /newroot/mnt/cdrom, instead of /dev/sdd1, the first partition on my USB drive. A pitfall of using a liveCD to boot a liveUSB, I guess. If I mount /dev/sdd1 on /newroot/mnt/cdrom from the shell and then try to mount my squashfs, it succeeds in mounting.

Although it succeeds in mounting /dev/sdd (files are actually on first partition) on /newroot/mnt/cdrom, it can't read all the files properly.

Can the media detection code be modified a little bit to allow for this anamoly somehow? e.g. ignore the device /dev/sd[a-z] if it contains partitions.
Comment 1 devsk 2008-03-09 05:55:32 UTC
BTW, I decided to open a new bug because I couldn't really open http://bugs.gentoo.org/show_bug.cgi?id=208477 and it was a different problem now.
Comment 2 devsk 2008-03-09 06:23:02 UTC
Created attachment 145626 [details, diff]
dumb fix for "don't mount disk if it has at least one partition"
Comment 3 devsk 2008-03-09 06:34:01 UTC
ok, the patch booted me into liveusb fine but I found a problem with the patch. If /dev/sdd1 is my boot partition, and I have a USB drive large enough that I have 11 partitions, /dev/sdd11 will be tried instead and /dev/sdd1 will be skipped. darn!

here is another one.
Comment 4 devsk 2008-03-09 06:34:32 UTC
Created attachment 145628 [details, diff]
both fixes, and better check for disk
Comment 5 devsk 2008-03-09 19:07:20 UTC
One more question: why did we decide to force slowusb?

check_slowusb() {
        [ "${DO_slowusb}" ] || \
        for dir in /sys/bus/usb/drivers/usb-storage/*
        do
                [ -d "${dir}" ] && FORCE_slowusb="1"
        done
}

This just makes my boot 30 seconds longer. If we don't do this and user's boot fails, he/she still has the option to pass 'slowusb' and get his delay.
Comment 6 devsk 2008-03-09 19:35:57 UTC
Created attachment 145674 [details, diff]
Sleep for scandelay instead of fixed 10 and 20 seconds

I have modified the patch to sleep with sdelay instead of sleep 10 etc. This makes the sleep for USB driven by the same parameter. Please let me know what you think of this change.
Comment 7 devsk 2008-03-11 03:25:54 UTC
knock, knock! anybody home?...:-)
Comment 8 Andrew Gaffney (RETIRED) gentoo-dev 2008-03-11 12:41:16 UTC
No, leave us alone. Annoying poking on bugs just makes us want to shove it right down to the bottom of the list. Both of the genkernel maintainers are also members of releng, and we're in the middle of a release cycle, which means we're very busy. We'll get to it eventually.
Comment 9 devsk 2008-03-11 16:24:31 UTC
(In reply to comment #8)
> No, leave us alone. Annoying poking on bugs just makes us want to shove it
> right down to the bottom of the list. Both of the genkernel maintainers are
> also members of releng, and we're in the middle of a release cycle, which means
> we're very busy. We'll get to it eventually.
> 

Apologies...just used to seeing a comment or two from devs if a patch has been provided. Both the bugs are of critical nature, but pretty trivial.
Comment 10 devsk 2008-03-18 02:03:22 UTC
Is it fair now (1 week later) to ask for status of the patches supplied here? Both bugs are real issues, and showstopper for certain configurations. Can we please include them?
Comment 11 Andrew Gaffney (RETIRED) gentoo-dev 2008-03-18 12:21:43 UTC
Have you tested that this can still successfully boot a CD? What happens if you don't have /dev/sdX1 but you have /dev/sdX2? I've seen it happen. What about arches like hppa where the CD actually contains a partition table (I'm not sure if the kernel actually recognizes it)?
Comment 12 devsk 2008-03-20 03:39:27 UTC
(In reply to comment #11)
> Have you tested that this can still successfully boot a CD?

I have booted a livecd with it fine.

> What happens if you
> don't have /dev/sdX1 but you have /dev/sdX2?

We can definitely change:

if [ -e "/sys/block/${bsn}" -a -b "${x}1" ]

to

if [ -e "/sys/block/${bsn}" -a -b "${x}[0-9]" ]

in the patch.

> I've seen it happen. What about
> arches like hppa where the CD actually contains a partition table (I'm not sure
> if the kernel actually recognizes it)?
> 

That should work with the changes. In fact, that is a use case for this change.
Comment 13 devsk 2008-03-20 03:40:03 UTC
(In reply to comment #11)
> Have you tested that this can still successfully boot a CD?

I have booted a livecd with it fine. May be some more folks can give it a run too.

> What happens if you
> don't have /dev/sdX1 but you have /dev/sdX2?

We can definitely change:

if [ -e "/sys/block/${bsn}" -a -b "${x}1" ]

to

if [ -e "/sys/block/${bsn}" -a -b "${x}[0-9]" ]

in the patch.

> I've seen it happen. What about
> arches like hppa where the CD actually contains a partition table (I'm not sure
> if the kernel actually recognizes it)?
> 

That should work with the changes. In fact, that is a use case for this change.
Comment 14 Andrew Gaffney (RETIRED) gentoo-dev 2008-03-20 12:00:27 UTC
(In reply to comment #13)
> if [ -e "/sys/block/${bsn}" -a -b "${x}[0-9]" ]

Is that even supported syntax, especially with busybox ash's built-in test?
Comment 15 devsk 2008-03-20 15:53:56 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > if [ -e "/sys/block/${bsn}" -a -b "${x}[0-9]" ]
> 
> Is that even supported syntax, especially with busybox ash's built-in test?
> 

On a re-look, it won't work even in bash...because "${x}[0-9]" won't be glob'd by shell because of "". I tested only if [ -e "/sys/block/${bsn}" -a -b "${x}1" ], which does work in ash. So, your concern for /dev/sda2 being there without a /dev/sda1, will need to be addressed with a little more work. I will work on something once I come back from work....:-)
Comment 16 devsk 2008-03-23 19:13:29 UTC
Created attachment 147046 [details, diff]
if at least one partition, skip the device

How about this patch? This will work even if /dev/hda2 is there and /dev/hda1 is missing.
Comment 17 devsk 2008-03-23 19:15:04 UTC
The syntax verified by hand in ash from busybox 1.7.1. I think genekernel uses that version.
Comment 18 Chris Gianelloni (RETIRED) gentoo-dev 2008-04-04 15:18:18 UTC
This is in SVN and 3.4.10_pre8... thanks for the patch!
Comment 19 devsk 2008-06-23 04:11:19 UTC
this is fixed.
Comment 20 Larry the Git Cow gentoo-dev 2021-09-08 14:00:27 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=a3e1af34bb4dce30d99fdeca7b8217f89f219a01

commit a3e1af34bb4dce30d99fdeca7b8217f89f219a01
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2021-09-08 02:04:16 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2021-09-08 14:00:08 +0000

    initrd.scripts: don't skip top level devices with partitions
    
    ppc64 media should be mounted as /dev/sdX, not as /dev/sdX1
    this loop was skipping /dev/sdX if /dev/sdX1 is present.
    
    Bug: https://bugs.gentoo.org/212794
    Bug: https://bugs.gentoo.org/796272
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
    Closes: https://bugs.gentoo.org/796272
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 defaults/initrd.scripts | 18 ------------------
 1 file changed, 18 deletions(-)