Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 389755

Summary: sys-kernel/genkernel-3.4.19 docache doesn't work when pxe booting
Product: Gentoo Hosted Projects Reporter: Richard Scott <gentoo.bugs>
Component: genkernelAssignee: Gentoo Genkernel Maintainers <genkernel>
Status: IN_PROGRESS ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Screenshot of a PXE booted system
Screenshot of a PXE booted system
A patch to fix the docache issue
busybox NFS patch

Description Richard Scott 2011-11-06 19:51:52 UTC
Created attachment 291833 [details]
Screenshot of a PXE booted system

When booting a LiveCD via PXE, you can't use the "docache" option if you've made the CD's kernel with genkernel-3.4.19. genkernel-3.4.18 works perfectly.
Comment 1 Richard Scott 2011-11-06 19:53:14 UTC
Created attachment 291835 [details]
Screenshot of a PXE booted system
Comment 2 Alex Legler (RETIRED) archtester gentoo-dev Security 2011-11-10 11:30:50 UTC
*** Bug 390073 has been marked as a duplicate of this bug. ***
Comment 3 Richard Scott 2011-11-16 15:58:57 UTC
now works for me.
Comment 4 Richard Scott 2011-11-23 10:41:17 UTC
I've re-opened this bug as it still exists.

I'm using this in my pxelinux.cfg/default file:

LABEL h64
  kernel k64
  append loop=d64 initrd=i64 looptype=squashfs doacpi nolvm nomdadm doscsi ip=dhcp cdroot real_root=/dev/nfs nfsroot=10.254.0.1:/var/tftproot/media acpi_enforce_resources=lax vga=789 scandelay=0 docache

Without the "docache" entry, things work fine.
Comment 5 Richard Scott 2011-11-23 13:06:55 UTC
Created attachment 293499 [details, diff]
A patch to fix the docache issue

This change workes for me... it may not be the correct change tho.
Comment 6 Richard Scott 2011-11-25 16:04:03 UTC
ok, cancel that... the patch allows you to boot, but the squashfs image is mounted in an unmountable place so things lock up when powering off or rebooting.
Comment 7 Paul 2012-03-11 22:49:49 UTC
I tried to boot the newest install-x86-minimal-20120306.iso with "docache" and this results in Kernel panic:
See screenshot @
http://oi41.tinypic.com/2s9bus7.jpg
Comment 8 Richard Scott 2012-03-16 08:36:55 UTC
Is there any chance that someone could confirm this bug as its a real show stopper for me.

Other users are having the same problem now:
http://forums.gentoo.org/viewtopic-t-912898-highlight-.html
Comment 9 Sebastian Pipping gentoo-dev 2012-03-17 01:33:36 UTC
Should be fixed, please give branch fix-docache [1] a try ..

  # git clone git://git.overlays.gentoo.org/proj/genkernel.git
  # cd genkernel
  # git checkout -t origin/fix-docache
  # GK_SHARE="$PWD" ./genkernel initramfs --no-install --no-postclear

.. and report back.


[1] http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commitdiff;h=fix-docache
Comment 10 Richard Scott 2012-03-24 22:19:49 UTC
(In reply to comment #9)
> .. and report back.

Hi, I'm sorry to say that its still broken. The boot errors on trying to mount the nfs share on /mnt/cdrom
Rich
Comment 11 Sebastian Pipping gentoo-dev 2012-03-24 22:39:37 UTC
(In reply to comment #10)
> Hi, I'm sorry to say that its still broken. The boot errors on trying to
> mount the nfs share on /mnt/cdrom

I'm puzzled: Does it do that without docache?

In the diff from 3.4.18 to 3.4.19 I found:

+  08 Oct 2011; Fabio Erculiani <lxnay@gentoo.org> defaults/initrd.defaults,
+  defaults/initrd.scripts, defaults/linuxrc:
+  Do not hardcode /mnt/cdrom path across the whole code, use CDROOT_PATH
+  instead. At the same time, mount cdrom into /mnt/cdrom instead of
+  /newroot/mnt/cdrom (which is now just a bind mount), this avoids
+  losetup to expose unavailable paths inside the live system, breaking
+  mkfs.btrfs (next upstream version, which does silly things with
+  /proc/mounts).

I guess that's related.

I welcome patches if you get to debugging this before me.
Comment 12 Richard Scott 2012-03-25 18:05:41 UTC
I'm sorry to say that all methods for PXE are still broken in the genkernel version I've just pulled from git. It borks at mounting my squashfs image over nfs on /mnt/cdrom. This is the same issue other (older) genkernels are having (not sure if that'll help).

Here's my history as I know it.
3.4.18 pxe worked with and without docache
3.4.19 - 3.4.20 pxe only worked without docache
3.4.24 - 3.4.27 pxe doesn't work with or without docache

It seems to be the new code that mounts things at /mnt/cdrom as from here on it fails at mounting the squashfs image over nfs at /mnt/cdrom.

This is the entry I have in my pxelinux.cfg/default file... is this still correct:

kernel k64
append loop=d64 root=/dev/ram0 initrd=i64 looptype=squashfs doacpi nolvm nomdadm doscsi ip=dhcp cdroot real_root=/dev/nfs nfsroot=10.254.0.1:/var/tftproot/media acpi_enforce_resources=lax scandelay=0 vga=789

Rich
Comment 13 Sebastian Pipping gentoo-dev 2012-03-25 18:34:57 UTC
In case you get to trying your scenario with sys-kernel/dracut please report back if dracut supports it or not.
Comment 14 Richard Scott 2012-03-26 10:03:44 UTC
(In reply to comment #13)
> In case you get to trying your scenario with sys-kernel/dracut please report
> back if dracut supports it or not.

I may be wrong as I've only googled, but as far as I can tell Dracut doesn't support caching of the entire root squashfs image in ram on the PXE booted node. 

This is the one feature that I need the most as without it I'm unable to disconnect the diskless node from the network once its booted i.e. to change network settings or setup interface bonding etc.
Comment 15 Sebastian Pipping gentoo-dev 2012-03-26 13:19:38 UTC
Is that sceneraio of yours supported anywhere else, yet?
Have you considered making a custom initramfs for your needs?

I'm afraid to get it into genkernel you'll need to get into genkernel yourself.  Far enough so that I trust your patches without testing them for hours myself.
There's no test suite as of now and changes about stuff that I am rather new to have much potential to break stuff for whole classes of other use cases.
Comment 16 Richard Scott 2012-03-26 13:31:54 UTC
(In reply to comment #15)
> Is that sceneraio of yours supported anywhere else, yet?

Yes, both Fedora and Ubuntu support caching of the image in RAM and PXE booting.

> Have you considered making a custom initramfs for your needs?
I currenty use genkernel-3.4.18 as it already has this feature built into it so I don't see the need (or have the time) to create a custom file.

> I'm afraid to get it into genkernel you'll need to get into genkernel
> yourself.  Far enough so that I trust your patches without testing them for
> hours myself.

That's fair enough, i'm not expecing you to do all the work ;-) However, the feature is already in genkernel-3.4.18 but has been broken since genkernel-3.4.19

I'll have a dig around in the latest release from Git to see if I can figure out what's gone wrong. Thanks for taking time to look at this bug report.

Rich
Comment 17 Richard Scott 2012-03-27 07:42:22 UTC
OK, I've had a poke about in genkernel-3.4.37 (and also double checked this in the Git release).

The first fix that has enabled mounting the NFS share to work. It's a tweak to the busybox kernel config:

> /usr/share/genkernel/defaults/busy-config
> CONFIG_FEATURE_MOUNT_NFS=y

I still have the error with the docache option:

>> Mounting squashfs filesystem
mount: mounting /mnt/cdrom/../d64 on /newroot/mnt/livecd failed: no such file or directory

The "d64" file is my squashfs loop image.

I'll see if I can figure this one out too.
Rich.
Comment 18 Richard Scott 2012-03-27 08:05:15 UTC
ok, i've found a fix, not sure if its correct tho.
Basically in initrd.scripts the cache_cd_contents function is copying the LOOP file into a different place.

I've just changed this:

> /usr/share/genkernel/defaults/initrd.scripts
> #cp -a ${CDROOT_PATH}/${LOOP} ${NEW_ROOT}/mnt/${LOOP}
> cp -a ${CDROOT_PATH}/${LOOP} ${CDROOT_PATH}/../${LOOP}

This seems to work ok fore me apart from an error about unmounting /mnt/cdrom when I shut down the booted node.

Rich
Comment 19 Richard Scott 2012-03-28 08:46:27 UTC
Created attachment 306931 [details]
busybox NFS patch

A patch to /usr/share/genkernel/defaults/busybox to enable NFS
Comment 20 Sebastian Pipping gentoo-dev 2012-03-29 06:15:24 UTC
(In reply to comment #19)
> Created attachment 306931 [details]
> busybox NFS patch
> 
> A patch to /usr/share/genkernel/defaults/busybox to enable NFS

I'm afraid I cannot apply that.  See <http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commitdiff;h=b977d66940fdbbe552bb735a54141b69da873b5b> for details.