Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-10-2008, 06:34 AM
|
#1
|
Member
Registered: Mar 2007
Location: Stuttgart, Germany
Distribution: gentoo
Posts: 72
Rep:
|
Mounting rootfs via nfs: Remounting rw does not work
Hello
Objective:
==========
I am setting up an embedded computer as diskless host.
It boots the linux kernel via pxe. Root file system is
to be supplied via nfs.
Question
========
What do I need to do to have the client mount rootfs via nfs read write as part of the startup sequence ?
What works and what does not work ?
====================================
- pxe boots the linux kernel
- the kernel mounts the nfs file system as read only
- init is started
- linux is booted properly, i.e. no kernel panic because rootfs is not available or something alike
- init start an rc script -- remouting the rootfs read-write apparently does not work. Once I am logged in, and trying to touch a file, I get a message saying that the file system is mounted read only
- if I issue mount command to remount the rootfs read-write from the shell, it works. The rootfs is then remounted read write.
Setup
=====
1) server:
----------
- gentoo linux
- kernel 2.6.18-gentoo
- nfsd
- dhcpd
- tftp started via xinetd
2) client:
----------
- booting via pxe
- I use busybox 1.10 as shell
Config Files
============
1) dhcpd.conf:
--------------
...
subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.40 192.168.1.60;
option broadcast-address 192.168.1.255;
option routers 192.168.1.2;
server-name "ztron.home.test.net";
next-server 192.168.1.1;
option root-path "192.168.1.1:/var/nfs/ts5600"; # NFS Root Path for the client
option tftp-server-name "192.168.1.1"; # This is if the TFTP server is located on a different server than DHCP
filename "/bootImage.nbi";
}
# this is the node I want to boot diskless
host vmic7750 {
hardware ethernet 00:20:38:00:67:c0;
option root-path "192.168.1.1:/var/nfs/vmic7750";
option tftp-server-name "ztron.test.gloetzner.net";
filename "/pxelinux.0";
}
2) exports
----------
# /etc/exports: NFS file systems being exported. See exports(5).
/var/nfs/ts5600 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
/var/nfs/moebius 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
/var/nfs/vmic7750 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)
3) inittab of client (provided by nfs rootfs )
----------------------------------------------
::sysinit:/etc/rc
# Trap CTRL-ALT-DELETE
tty1::respawn:/sbin/getty 38400 tty1 linux
tty2::respawn:/sbin/getty 38400 tty2 linux
# Stuff to do when restarting the init process
::restart:/sbin/init
# Stuff to do before rebooting
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
4) rc (provided by nfs rootfs )
-------------------------------
#!/bin/sh
sleep 2
echo "Mount ROOTFS RW"
mount -n -o remount,ro /
sleep 2
mount -n -o remount,rw,noatime /
echo "Mount proc FS"
mount /proc
#/bin/mount -av
echo "Set hostname"
/bin/hostname vmic
echo "start sshd"
/usr/sbin/sshd
5) fstab(provided by nfs rootfs )
---------------------------------
192.168.1.1:/var/nfs/vmic7750 / nfs rw,rsize=8192,wsize=8192,timeo=24,intr
#192.168.1.1:/var/nfs/vmic7750 / nfs rsize=8192 0 0
/proc /proc proc defaults
Client's tty output
==================
<boot sequence output>
...
VFS: Mounted root (nfs filessystem) readonly
Freeing unused kernel memory: 128 k freed
Mount ROOTFS RW
mount: cannot read /proc/mounts: No such file or directoy
mount: cannot read /proc/mounts: No such file or directoy
Mount proc FS
Set hostname
start sshd
Net: Registered protocol family 1
vmic login:
LogFile
=======
Apr 10 12:11:25 ztron dhcpd: DHCPDISCOVER from 00:20:38:00:67:c0 via eth0
Apr 10 12:11:26 ztron dhcpd: DHCPOFFER on 192.168.1.49 to 00:20:38:00:67:c0 via eth0
Apr 10 12:11:27 ztron dhcpd: DHCPREQUEST for 192.168.1.49 (192.168.1.1) from 00:20:38:00:67:c0 via eth0
Apr 10 12:11:27 ztron dhcpd: DHCPACK on 192.168.1.49 to 00:20:38:00:67:c0 via eth0
Apr 10 10:11:27 ztron in.tftpd[10512]: RRQ from 192.168.1.49 filename /pxelinux.0
Apr 10 10:11:27 ztron in.tftpd[10512]: tftp: client does not accept options
Apr 10 10:11:27 ztron in.tftpd[10513]: RRQ from 192.168.1.49 filename /pxelinux.0
Apr 10 10:11:27 ztron in.tftpd[10514]: RRQ from 192.168.1.49 filename /pxelinux.cfg/01-00-20-38-00-67-c0
Apr 10 10:11:27 ztron in.tftpd[10515]: RRQ from 192.168.1.49 filename /bzImage.vmic7750
Apr 10 12:11:33 ztron dhcpd: DHCPREQUEST for 192.168.1.49 (192.168.1.1) from 00:20:38:00:67:c0 via eth0
Apr 10 12:11:33 ztron dhcpd: DHCPACK on 192.168.1.49 to 0:20:38:00:67:c0 via eth0
Apr 10 12:11:33 ztron rpc.mountd: authenticated mount request from 192.168.1.49:940 for /var/nfs/vmic7750 (/var/nfs/vmic7750)
Thanks
Tilman
|
|
|
04-10-2008, 06:47 AM
|
#2
|
Senior Member
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Rep:
|
This is a total shot in the dark... but you might want to try mounting /proc before you do the remount of the nfs partition read write....
|
|
|
04-10-2008, 04:09 PM
|
#3
|
Member
Registered: Mar 2007
Location: Stuttgart, Germany
Distribution: gentoo
Posts: 72
Original Poster
Rep:
|
And it is a hit. Mounting proc first allows to remount the rootfs read-write.
Do you happen to know why that is ? Apparently, mount needs some information from the proc file system...
|
|
|
04-10-2008, 05:28 PM
|
#4
|
Senior Member
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Rep:
|
Ya.. /proc/mount should basically mirror the /etc/mtab file. My best guess is it can't create the /etc/mtab file because root is ro and thus it needs proc for the existing mount information to do the remount.. or something like that.
|
|
|
04-10-2008, 06:18 PM
|
#5
|
Member
Registered: Mar 2007
Location: Stuttgart, Germany
Distribution: gentoo
Posts: 72
Original Poster
Rep:
|
sounds logic and consistent...
thanks for your help
Tilman
|
|
|
04-10-2008, 11:57 PM
|
#6
|
Senior Member
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Rep:
|
No problem, glad I could offer some assistance.
|
|
|
All times are GMT -5. The time now is 10:09 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|