Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NFS-root: remount too late, booting fails
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Mummelnase
n00b
n00b


Joined: 19 Dec 2008
Posts: 14

PostPosted: Fri Dec 19, 2008 9:33 am    Post subject: NFS-root: remount too late, booting fails Reply with quote

Hi everyone,

I just installed a machine that gets it's / from a NFS server.
The kernel get's booted by Grub from a small Flash:

Code:
kernel /boot/kernel-2.6.26-gentoo-r4 root=/dev/nfs nfsroot=192.168.10.10:/www ip=192.168.10.100:192.168.10.10::255.255.255.0:alpha2nas:eth1:off


This works fine, but when the services get initialised, I just get "read only filesystem" messages.

Changing the line for root in /etc/fstab to
Code:
192.168.10.10:/www      /               nfs             auto,remount,nolock,rw  0 0

didn't help since it's too late already when this file is used.
I kind of fixed this problem for now by adding
Code:
mount -n -o remount,rw -

to /etc/init.d/checkroot at the first line of start(), the system boots just fine with that.

Since I expect this dirty workaround is in danger to be reverted with an update ti the init-files I'd rather solve this problem conforming to gentoo-standards.

Can onyone help me with this?
Back to top
View user's profile Send private message
richard.scott
Veteran
Veteran


Joined: 19 May 2003
Posts: 1497
Location: Oxfordshire, UK

PostPosted: Fri Dec 19, 2008 11:18 am    Post subject: Reply with quote

If your doing what I think your doing then this bug report will help:

https://bugs.gentoo.org/show_bug.cgi?id=246759

its a bug in /usr/share/genkernel/generic/linuxrc

you'll need to edit this file before creating the initrd for your flash image.
Back to top
View user's profile Send private message
Mummelnase
n00b
n00b


Joined: 19 Dec 2008
Posts: 14

PostPosted: Fri Dec 19, 2008 12:43 pm    Post subject: Reply with quote

Thanks for your reply.

By "flash" I meant a DOM sitting on IDE0, with grub installed and the kernel available to boot.
The kernel itself has compiled in the necessary filesystems, nfs, root on nfs, etc.

Booting as such from the NFS works fine, but the root-fs is initially mounted readonly, thus the init-processes can't write on / until it's remounted RW, which doesn't happen automatically.

I added the NFS-option "remount,rw" to the kernel options (see above), where it's being ignored, and to /etc/fstab, where it's too late in the init procedure.

Manually adding the line "mount -n -o remount,rw /" to /etc/init.d/checkroot helped, but I consider this as as an ugly workaround...
Back to top
View user's profile Send private message
richard.scott
Veteran
Veteran


Joined: 19 May 2003
Posts: 1497
Location: Oxfordshire, UK

PostPosted: Fri Dec 19, 2008 12:55 pm    Post subject: Reply with quote

I'm booting a cd image via PXE and needed to tweak the linuxrc file to get it to work correctly for me.

Perhaps in your case you could tweak /usr/share/genkernel/generic/initrd.scripts as this is where the nfs root is mounted with the ro command.

trouble is I've just noticed this in /usr/share/genkernel/generic/ initrd.scripts:

Code:
                               good_msg "Attempting to mount NFS root on ${NFSROOT}"
                                mount -t nfs -o ro,nolock,rsize=1024,wsize=1024 ${NFSROOT} ${NEW_ROOT}
                                if [ "$?" = '0' ]
                                then
                                        REAL_ROOT="/dev/nfs"
                                else
                                        bad_msg "NFS Mounting failed. Is the path correct ?"
                                fi
                                # FIXME: Need to start portmap and the other rpc daemons in
                                # order to remount rw.


it seems your fudge is the best way of doing what you want? unless your able to start portmap this early in the boot process?

If you want to keep from editing the checkroot script then why not create a new init.d script that runs early in the boot process?
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 918
Location: Switzerland

PostPosted: Fri Dec 19, 2008 2:59 pm    Post subject: Reply with quote

Code:
#!/sbin/runscript                                     
# Copyright 1999-2007 Gentoo Foundation               
# Distributed under the terms of the GNU General Public License v2

depend() {
        before *
}               

start() {
        local retval=0

        if [[ ! -f /fastboot && -z ${CDBOOT} ]] \
        && ! is_net_fs / && ! is_union_fs / ; then
                if touch -c / >& /dev/null ; then
                      ebegin "WtF... nothing to remount here!"
#                       mount -n -o remount,ro /                         
                        eend $?                                           
                fi         


This is the head of my /etc/init.d/checkroot.... look at the "ebegin" part! :wink:

edit
--actually both "patches" are necessary atm, if you have a squash or similar on nfs... in plain nfs, you won't hit the linuxrc-bug!

Cheers
_________________
Power to the people!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum