Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 80617 - root over nfs support in genkernel (initrd)
Summary: root over nfs support in genkernel (initrd)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All All
: High enhancement (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-03 12:01 UTC by Jean-François Richard
Modified: 2005-07-24 10:17 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-François Richard 2005-02-03 12:01:16 UTC
Could it be possible to support booting from a root over nfs with the real_root parameter?  I'm trying to boot cluster nodes with genkernel but I can't use the initrd (which would be great : genkernel single kernel+initrd, autodetection, everything... :)  ) because it seems the linuxrc has trouble with nfsroot...

Thanks!

(last tried on genkernel-3.1.0e)
Comment 1 Jean-François Richard 2005-04-10 11:48:51 UTC
What I see that is needed to support this is :

-- ability to setup networking in the initrd, perhaps with busybox's "udchpc" dhcp client and a kernel parameter 
   OR :  I think there is already a standard ip=X:X:X.. parameter for the kernel to autoconfigure itself, perhaps this would "just work" right now if "kernel level autoconfiguration" is activated?  --> change genkernel default kernel config

-- the linuxrc should not test if real_root is a block device if, say, we use a real_root=SERVERIPADDRESS:/directory/ format (regexp test it?)

-- the linuxrc should be able to mount "ro" an nfs mount, since some setups are setting a read-only system and then mount a "rw" /root, /home, /var, /tmp, using the fstab during the init process.
   ---> "mount rw $REALROOT" would become "mount $REALROOT"  and it would work 
        directly, since we use "SERVERIPADDRESS:/directory" for the 
        real_root= kernel param
   I think busybox needs to be compiled with the "mount nfs" option so that this 
   works

So those are the changes I think would work.  I will try to get a patch for this soon.
Comment 2 Eric Edgar (RETIRED) gentoo-dev 2005-07-11 09:24:03 UTC
In Genkernel 3.2.1
Comment 3 Jean-François Richard 2005-07-13 13:36:51 UTC
These are great news!


I've tried it today and found some little problems with it.

First, it seems that variables $IP and $NFSROOT are not set, so the function
"findnfsmount()" is simply not run, since it starts with an " if IP!='' " test.

I've added this to linuxrc :

for x in ${CMDLINE}
do
  case "${x}" in
      ip\=*)
          IP=`parse_opt "${x}"`
          ;;
      nfsroot\=*)
          NFSROOT=`parse_opt "${x}"`
          ;;

This fixes the problem.

Also, when using both "cdroot" and "real_root=/dev/nfs", one must make sure that
"cdroot" comes _first_ on the kernel command-line, since "cdroot" sets
REAL_ROOT="" (empty... no good!) :

      # Livecd options
      cdroot)
          CDROOT=1
          REAL_ROOT=''
          ;;
      cdroot\=*)
          CDROOT=1
          CDROOT_DEV=`parse_opt "${x}"`
          REAL_ROOT=''
          ;;



When doing a "cdroot over nfs", I've had to add this, so we don't try to find a
cdrom device and overwrite the $REAL_ROOT

[ "${REAL_ROOT}"="/dev/nfs" ] || bootstrapCD



Finally, added the nfs part in the big "if" test :

    if [ "${CDROOT}" -eq '1' -a "${got_good_root}" = '1' -a "${REAL_ROOT}" !=
"/dev/nfs" ]
        then
                # cdrom device already mounted no further checks necessary
                break
        else
                good_msg "Mounting root..."
                # Try to mount the device as  ${NEW_ROOT}
                if [ "${REAL_ROOT}" = '/dev/nfs' ]; then
                        findnfsmount


If it wasn't there, it would just have breaked and returned without going
through findnfsmount.  (I don't find this very elegant though, maybe you have a
better idea?)


Thanks for your work, this feature will help save CDs!
Comment 4 Tim Yamin (RETIRED) gentoo-dev 2005-07-14 14:34:01 UTC
Fixed in 3.2.4; thanks!
Comment 5 Jean-François Richard 2005-07-21 08:10:07 UTC
In initrd.scripts, there is a test which goes like

    if [ "${NFSROOT}" != '' ]; then
                        if [ "${CDROOT}" != '' ]; then

But CDROOT is set in initrd.defaults to CDROOT=0, so the condition is never true.

Perhaps replace it with

                        if [ "${CDROOT}" != '0' ]; then


Also, 

  good_msg "Attempting to mount NFS CD image on ${NFSPATH}"

Gives me 
            Attempting to mount NFS CD image on 

When booting : NFSPATH is not always set, so I propose using
  good_msg "Attempting to mount NFS CD image from ${NFSROOT}"

The same is true for 
  good_msg "Attemping to mount NFS root on ${NFSPATH}"



I was also wondering about UNIONFS, seems it could provide the ability to
directly boot a system from ro-NFS and have it rw on the client machine with a
rw memory fs overlayed over the root...  and, perhaps, on shutdown, the memory
fs could be tarred somewhere on the server and then re-overlayed on the client
at the next bootup... anyway, just another crazy idea :)

Sorry for reopening this bug for the second time!

Thanks!

Comment 6 Chris Gianelloni (RETIRED) gentoo-dev 2005-07-21 08:31:14 UTC
No problem... nothing wrong with reopening a bug if it isn't fixed... =]

As for unionfs... there's no automated way to do what you want... there *is* a
method of using unionfs to write to any device genkernel can see, however.  So
you could specify unionfs=/dev/sda1 (where /dev/sda1 is a USB stick), but
there's nothing to auto-save the memory portion of it to anywhere.  The only
thing that does saving is the unionfs= specification.

Perhaps if you have a workable solution, or just a good idea on implementation,
it would be good to open a new bug on it.
Comment 7 Tim Yamin (RETIRED) gentoo-dev 2005-07-24 10:17:30 UTC
Fixed in 3.3, thanks! Feel free to reopen (again) if issues still occur.
Regarding unionfs you're best opening a new bug if you have a good solution or
idea for implementation as Chris suggested.