Gentoo Archives: gentoo-catalyst

From: Paul Smith <psmith@××××××.com>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] How is initrd built?
Date: Fri, 08 Jul 2005 01:44:42
Message-Id: vpdrll4inkaz.fsf@lemming.engeast.baynetworks.com
In Reply to: Re: [gentoo-catalyst] How is initrd built? by Paul Smith
1 %% I wrote:
2
3 sp> So, the next problem is that after the init is done and the system
4 sp> starts to boot, various things fail because /etc/fstab is empty.
5
6 sp> I don't see anywhere in the "normal" boot process that /etc/fstab is
7 sp> built... am I missing something? Is it as simple as "cp /proc/mounts
8 sp> $CHROOT/etc/fstab"?
9
10 OK, I found this problem. This code in linuxrc in genkernel is bogus:
11
12 cat /${UNION}/etc/fstab | sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' > /${UNION}/etc/fstab
13
14 We are cat'ing a file in a pipeline, and redirecting the output back to
15 that same file; that is not safe. In fact, sometimes when I run this it
16 works but most of the time I get a zero-length fstab file. When I get an
17 empty file the normal boot fails because it tries to do invalid things
18 like remount the union filesystem, which is not supported.
19
20 This is fixed easily enough by using sed -i instead:
21
22 sed -i -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab
23
24 However, it's actually not really clear to me what this is trying to do.
25 The comment is at best very confusing to me:
26
27 # Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on unionfs dirs.
28
29 The above sed doesn't touch anything related to livecd; it's managing
30 "/", which will be (when we chroot) the unionfs. And, why changing it
31 to say "ro" in /etc/fstab will STOP the system from trying to remount it
32 "rw" is really a mystery to me...??
33
34 --
35 -------------------------------------------------------------------------------
36 Paul D. Smith <psmith@××××××.com> HASMAT--HA Software Mthds & Tools
37 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
38 -------------------------------------------------------------------------------
39 These are my opinions---Nortel Networks takes no responsibility for them.
40 --
41 gentoo-catalyst@g.o mailing list

Replies

Subject Author
Re: [gentoo-catalyst] How is initrd built? Chris Gianelloni <wolf31o2@g.o>