Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 208477 - sys-kernel/genkernel-3.4.9 - check_loop() failed
Summary: sys-kernel/genkernel-3.4.9 - check_loop() failed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-01 19:19 UTC by justXi
Modified: 2008-03-23 15:39 UTC (History)
1 user (show)

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


Attachments
diff since 3.4.9 (genkernel-3.4.9.diff,17.11 KB, patch)
2008-02-05 12:26 UTC, Andrew Gaffney (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description justXi 2008-02-01 19:19:24 UTC
When using an "initramfs" file from genkernel (3.4.9) the "check_loop()" procedure fails and "ash" starts. After simply existing by typing "exit" the cdboot continues without problems.



Reproducible: Always




Kernel commandline:  kernel /boot/vmlinuz-2.6.23-gentoo-r3 root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/livecd.squashfs udev nodevfs cdroot dodmraid real_root=/dev/loop0 video=vesafb:1024x768-32@85,mtrr:2,ywrap splash=verbose,theme:default CONSOLE=/dev/tty1 quiet nodhcp
Comment 1 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-01 19:48:55 UTC
Fails how? What's the error? Got any output? Is this on a CD? Is this a custom built CD? We need some information that we can actually use
Comment 2 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-01 19:53:22 UTC
Ok, looking at the genkernel code, you only get a failure there if you've pointed it to a loop file that doesn't exist. Do you actually have a "livecd.squashfs" in your CD root? The "standard" filename that catalyst uses is "image.squashfs".
Comment 3 Chris Gianelloni (RETIRED) gentoo-dev 2008-02-01 20:04:33 UTC
If you're using genkernel on a "real" machine and this isn't a CD, you need to remove a *bunch* from your command line:

looptype=squashfs loop=/livecd.squashfs udev nodevfs cdroot

Also, you need to change real_root=/dev/loop0 to actually point to your real root device.  It should be something like /dev/sda3 or /dev/hda3.

Now, nodhcp does nothing on a live system.  It only affects the CD.
Comment 4 justXi 2008-02-02 10:10:00 UTC
On a real machine the initramfs from genkernel run fine.

I am using it on a custom build liveCD (http://gentoo-wiki.com/HOWTO_build_a_LiveCD_from_scratch).

Yes I have a "livecd.squashfs" on the CD.

The interessting thing is, that the procedure shows up the error message and starts the "ash" shell, but when I do nothing but typing "exit" followed by pressing "enter" the CD keeps on starting without problems! 

In other words: The "check_loop()" procedure does not find an existing "livecd.squashfs" file, but the following procedure is able to read it.

I am a little bit confused about that.
Comment 5 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-03 18:31:02 UTC
The only "obvious" problem I see is that there's not a leading / in the path of the loop file to check in check_loop(). Please add one, rebuild your initramfs, and let us know if that fixes it.
Comment 6 devsk 2008-02-03 23:23:09 UTC
I am seeing the same error trying to boot a livecd with almost (I don't have quiet nodhcp) same boot parameters (seems like we followed the same guide). Only difference is that I get kernel panic once I exit from ash.

The error is coming from:

                bad_msg "Invalid loop location: ${LOOP}"
                bad_msg 'Please export LOOP with a valid location, or reboot and pass a proper loop=...'
                bad_msg 'kernel command line!'

i.e.

Invalid loop location: livecd.squashfs

I do see /newroot/mnt/cdrom mounted with correct livecd.squashfs in there with 'df' inside the shell. So, I don't know why that check failed.

Where is /bin/ash coming from?
Comment 7 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-03 23:51:52 UTC
First, I have no idea why people are following that guide. It is *much* easier (not to mention "supported") to use catalyst to create a Gentoo-based LiveCD. The genkernel code that handles the loopback image is meant for use in conjunction with what catalyst generates. Any usage outside of that is "unsupported".

Since we don't see the problem with our CDs generated by catalyst, chances are we won't be able to fix this. If you can track down the issue (and perhaps even provide a patch), it'll be a lot more likely that it will get fixed.
Comment 8 devsk 2008-02-04 06:23:50 UTC
(In reply to comment #7)
> First, I have no idea why people are following that guide. It is *much* easier
> (not to mention "supported") to use catalyst to create a Gentoo-based LiveCD.
> The genkernel code that handles the loopback image is meant for use in
> conjunction with what catalyst generates. Any usage outside of that is
> "unsupported".

Is there a way to make catalyst use my existing chroot (that I created for this livecd environment)?
Comment 9 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-04 21:13:25 UTC
Okay, this is fixed in SVN. It was due to the mount command returning before the CD was actually mounted, which made the check fail.
Comment 10 devsk 2008-02-04 21:19:26 UTC
(In reply to comment #9)
> Okay, this is fixed in SVN. It was due to the mount command returning before
> the CD was actually mounted, which made the check fail.
> 

I can test it out really quick and not wait for the next release if its possible to get the fix as a patch against 3.4.9? With SVN, I will probably need to emerge few things. Is that a possibility?
Comment 11 justXi 2008-02-05 11:14:33 UTC
I would like to have a patch too.
Comment 12 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-05 12:26:41 UTC
Created attachment 142715 [details, diff]
diff since 3.4.9

I'm not going to break apart the patch, so you get the entire diff since 3.4.9.
Comment 13 justXi 2008-02-05 14:40:02 UTC
I had a look to the patch and could not find any changes changes related to this problem. Where is the difference after applying the patch.
Comment 14 devsk 2008-02-05 17:12:47 UTC
> Change &>/dev/null to >/dev/null 2>&1 because busybox ash sucks

So, it was putting 'mount' in the background and happily proceeding...that explains. Will give it a shot. Thanks for the patch.
Comment 15 justXi 2008-02-05 23:08:51 UTC
Seems to work.
Comment 16 devsk 2008-02-05 23:53:42 UTC
We could probably release the one line change as r1 on 3.4.9 because it is a major breakage (I hit a kernel panic because of this). But that's up to you. I guess depends when you plan to do 3.5.0 or 3.4.10.
Comment 17 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-06 00:27:54 UTC
We'll likely do 3.4.10, which we will use for the 2008.0 release.
Comment 18 devsk 2008-02-06 03:18:12 UTC
Andrew, With this patch applied I still get an error thrown that says (I am typing it because kernel panicked)

"mount: Mounting /dev/loop0 on /newroot/mnt/livecd failed: Invalid argument"

Then it says "Copying read write contents to tmpfs" and throws a bunch of "cp: etc no such file or directory" errors and "switch_root: bad init '/sbin/init'" and boom kernel panic.

Seems like the root of the problem is the mount problem. When I made it die earlier in the process by creating a livecd directory instead of livecd file in the root folder of the CD, it threw me into shell where I could see /dev/loop0 being there. And when I manually fired the same command which mounts the squashfs file system, it threw the same "Invalid argument" error, although all arguments were valid (at least the paths).

The kernel has support for loopback.

Got any ideas?
Comment 19 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-06 04:09:30 UTC
That's a completely different issue. Try downgrading squashfs-tools or using a newer gentoo-sources (like 2.6.24) that is patched for squashfs-3.3 support. I ran into this same problem while testing the fix for this bug. Downgrading squashfs-tools and recreating the squashfs fixed it.
Comment 20 Chris Gianelloni (RETIRED) gentoo-dev 2008-02-14 04:32:40 UTC
I just released genkernel 3.4.10_pre1, which has this fix included.  Feel free to REOPEN this bug or make a comment if it is not resolved.
Comment 21 devsk 2008-03-09 05:24:21 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.
Comment 22 devsk 2008-03-23 15:39:34 UTC
the above problem is being followed up in another bug:

http://bugs.gentoo.org/show_bug.cgi?id=212794