1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
Thanks for the suggestions. I added the "v3" option to the kernel so it uses |
5 |
NFS v3 protocol. I fixed my problem with X locking up. For some reason I had |
6 |
SMP and Preemption turned on in my client kernel. Not sure if SMP is the |
7 |
problem (but it is unnecessary), but preemption has been known not to play |
8 |
nice sometimes, I think it wasn't doing well with the NFS root. Anyhow, I got |
9 |
my X to start and login to the server, yeah! agetty still doesn't work, but I |
10 |
don't care :) Other than the kernel recompile, I left everything else the |
11 |
same. |
12 |
|
13 |
Thanks for the suggestions. |
14 |
|
15 |
On Saturday 14 December 2002 09:12 pm, Istvan Marko wrote: |
16 |
> Pat Double <double@×××××××××.com> writes: |
17 |
> > I'm having trouble setting up a diskless Gentoo client. I have a Gentoo |
18 |
> > server that will serve the root filesystem via NFS. |
19 |
> |
20 |
> Pat, |
21 |
> |
22 |
> I have a Gentoo based netbooted setup that works quite well. In many |
23 |
> ways it's similar to yours but I took a different approach for certain |
24 |
> things. I don't have a solution for your specific problem but maybe |
25 |
> |
26 |
> you will find my notes below useful: |
27 |
> > The client's root has been setup using a stage1 tarball and going |
28 |
> > through the bootstrap, etc. process to get xfree merged. (The client |
29 |
> > will only provide an XDM login into the server so I don't need a lot |
30 |
> > of packages). |
31 |
> |
32 |
> Same here, except that I don't need X on the systems my setup is |
33 |
> intended for so I haven't installed XFree86 (but I see no reason why |
34 |
> it wouldn't work). I did the initial bootstrap using the chroot method |
35 |
> (on a redhat box). I never mount my master tree directly on a live |
36 |
> system's root, I use chroot whenever I need to emerge additional |
37 |
> packages. |
38 |
> |
39 |
> > I've gotten far in the process: A correct kernel with NFS root support |
40 |
> > has been setup. I've used the mknbi program to create a bootable network |
41 |
> > image. I have a floppy disk that will grab the kernel from the server |
42 |
> > using the etherboot package. A tftp server is setup correctly to server |
43 |
> > the kernel. The kernel boots, finds the nfs server and mounts the correct |
44 |
> > filesystem. |
45 |
> |
46 |
> I use PXE capable ethernet cards (Intel e100, 3com) and pxegrup (part |
47 |
> of the grub package) to load the kernel. It is also possible to build |
48 |
> a network enabled grub floppy if the ethernet cards used are not PXE |
49 |
> capable. The advantage of using pxegrub is that you get the same |
50 |
> flexibility and the menu system you get with normal grub. |
51 |
> |
52 |
> > It does go through the boot sequence. I have modified /sbin/rc to |
53 |
> > create /etc, /var , /tmp and /root on tmpfs and copy the /etc and |
54 |
> > /var files from the root filesystem into the temporary copy. I am |
55 |
> > mounting /mnt/.etc-tmpfs to tmpfs, copying the files and then using |
56 |
> > mount -o bind to mount /mnt/.etc-tmpfs to /etc. Same with /var. /tmp |
57 |
> > and /root is directly mounted to tmpfs with no files in them. |
58 |
> |
59 |
> I took a different approach here. I keep the root filesystem on tmpfs |
60 |
> and mount only /usr via NFS. I guess the simplest way to explain how |
61 |
> this works is by going through the boot process: |
62 |
> |
63 |
> 1. BIOS loads pxegrub from the tftp server. |
64 |
> |
65 |
> 2. pxegrub loads the kernel image from tftp and NFS mounts a root |
66 |
> filesystem. I use the following kernel command line: |
67 |
> |
68 |
> kernel /bzImage ip=::::::autoconf root=/dev/nfs |
69 |
> nfsroot=1.2.3.4:/linux-netboot/initfs,v3 |
70 |
> |
71 |
> The root filesystem that gets NFS mounted here is minimal, its purpose |
72 |
> is to setup the real root filesystem and mount /usr. It consists of a |
73 |
> statically linked /bin/busybox binary, an /sbin/init shell script, an |
74 |
> /etc/fstab (could do away with this), a couple device entries in /dev |
75 |
> (/dev/console is needed) and the tar archive containing the template |
76 |
> root filesystem. /bin/sh, echo, mkdir, mount and tar are all symlinks |
77 |
> to the busybox binary. And there is a statically linked pivot_root |
78 |
> binary, compiled from the util-linux sources. |
79 |
> |
80 |
> 3. The /sbin/init, a shell script, is started by the kernel. |
81 |
> |
82 |
> 4. This /sbin/init shell script creates a tmpfs filesystem under |
83 |
> /sysroot and populates it from the template tar archive. |
84 |
> |
85 |
> 5. The /sbin/init shell script NFS mounts /sysroot/usr, this will end |
86 |
> up as /usr after step 6. |
87 |
> |
88 |
> 6. Once /sysroot is populated the /sbin/init shell script uses |
89 |
> pivot_root to change the root file system over to |
90 |
> /sysroot. pivot_root is normally used by initrd setups but it works |
91 |
> great in this situation as well. |
92 |
> |
93 |
> 7. And finally /sbin/init uses chroot to invoke the real gentoo |
94 |
> /sbin/init |
95 |
> |
96 |
> 8. The regular gentoo /sbin/init and init scripts run performing the |
97 |
> normal startup. I have a line in /etc/conf.d/local.start to umount |
98 |
> /initfs (which is where the initial NFS root gets moved by |
99 |
> pivot_root) |
100 |
> |
101 |
> |
102 |
> Here is the /sbin/init script I use: |
103 |
> |
104 |
> #! /bin/sh |
105 |
> mount /proc |
106 |
> echo "Mounting filesystems" |
107 |
> mount /sysroot |
108 |
> cd /sysroot |
109 |
> echo "Extracting root" |
110 |
> tar xzf /root.tar.gz |
111 |
> cd / |
112 |
> mount /sysroot/usr |
113 |
> mkdir /sysroot/initfs |
114 |
> cd /sysroot |
115 |
> echo "done" |
116 |
> umount /proc |
117 |
> pivot_root . initfs |
118 |
> exec chroot / /sbin/init |
119 |
> |
120 |
> and the corresponding /etc/fstab: |
121 |
> |
122 |
> proc /proc proc defaults |
123 |
> /dev/shm /sysroot tmpfs defaults |
124 |
> 1.2.3.4:/linux-netboot/usr /sysroot/usr nfs nfsvers=2,ro,nolock,nocto |
125 |
> |
126 |
> |
127 |
> root.tar.gz contains the parts of the gentoo install that are not |
128 |
> under /usr, in my setup this is about 17MB. This might seem a lot but |
129 |
> keep in mind the memory used by tmpfs is swappable. If you are low on |
130 |
> RAM and don't have a local disk to swap to you could reduce this by |
131 |
> NFS mounting /bin and /lib in addition to /usr. I generate root.tar.gz |
132 |
> with the following command: |
133 |
> |
134 |
> tar cvzf ../initfs/root.tar.gz --exclude './usr/*' --exclude='./var/db/*' |
135 |
> --exclude='./var/tmp/portage/*' --exclude='./var/cache/*' |
136 |
> --exclude='./var/log/*' --exclude='./mnt/.init.d/*' . |
137 |
> |
138 |
> > I have disabled the filesystem checks as well. |
139 |
> |
140 |
> One of my goals was to keep changes to the Gentoo init scripts |
141 |
> minimal so I accomplished this by ln -s /bin/true /sbin/fsck.tmpfs |
142 |
> |
143 |
> [...] |
144 |
> |
145 |
> > Is there a known bug in the kernel or perhaps devfs? Should I not |
146 |
> > being using devfs with /dev on nfs? I can move a copy of /dev to a |
147 |
> > tmpfs if necessary, that's about the only thing I haven't tried. |
148 |
> |
149 |
> I am not sure what is causing the problems you described. devfs works |
150 |
> well for me, keeping /dev on NFS on the other hand can be problematic, |
151 |
> especially with NFS v2. With your setup you might need to ensure that |
152 |
> no_root_squash (or the equivalent) is set in /etc/exports on the |
153 |
> server and you could try adding ,v3 at the end of the nfsroot option |
154 |
> in the kernel command line forcing the kernel mount of / to v3 (it |
155 |
> uses v2 by default for some reason) |
156 |
> |
157 |
> Also, check out this thread on some NFS performance issues I hit on |
158 |
> netbooted systems and the workaround: |
159 |
> http://article.gmane.org/gmane.linux.nfs/1870 |
160 |
> (This is not directly related but you might come across it later) |
161 |
> |
162 |
> Let me know if you have any questions about the setup I use, there are |
163 |
> probably many details I forgot about. |
164 |
> |
165 |
> Good luck, |
166 |
|
167 |
- -- |
168 |
Pat Double, double@×××××××××.com |
169 |
"In the beginning God created the heaven and the earth." |
170 |
-----BEGIN PGP SIGNATURE----- |
171 |
Version: GnuPG v1.2.1 (GNU/Linux) |
172 |
|
173 |
iD8DBQE+ApNKdOmLNuoWoKgRAtLaAJ4g+Lxhx5ZA+NSZgolv+Hmd3nhplwCePX5x |
174 |
YajdfL3Pp5SJuS56CWzhz5U= |
175 |
=fc8x |
176 |
-----END PGP SIGNATURE----- |
177 |
|
178 |
|
179 |
-- |
180 |
gentoo-dev@g.o mailing list |