From: John R Moser <jmoser5@student.ccbc.cc.md.us>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: initrd help -- umounts root after pivot_root
Date: Thu, 30 Oct 2003 19:18:39 -0500 (EST) [thread overview]
Message-ID: <Pine.A32.3.91.1031030191344.46426A@student.ccbc.cc.md.us> (raw)
Been trying with 2.4.20, 2.4.22, 2.6.0-test9, how the heck do I get this
to work?
I set everthing up on /dev/shm type tmpfs, then
cd /dev/shm
mkdir initrd
pivot_root . initrd
So yay, it's set up so that the cd is pointed to by a lotta links in
tmpfs, and the stuff that needs to be rw (like /etc) is on the tmpfs.
That's good.
Of course, the kernel unmounts / and then swears that it can't find init
when the linuxrc exits.
The documentation says that linuxrc should pivot_root to the real root in
Documentation/initrd.txt so I thought that's what the script sholud do.
Apparently the doc is bad/old.
Any ideas?
script follows.
====/linuxrc
#!/bin/sh
# linuxrc for Genoppix initrd
# Basicly mounts the cdrom, sets up rw stuff, spins the root image
# around to the root, and exits.
echo "Genoppix Initrd Loaded, linuxrc executing in 5 seconds..."
sleep 5
mount none -t proc /proc
echo "Mounting cdrom..."
CDROM="/dev/cdrom"
if [ ! -e $CDROM ]; then
CDROM="/dev/cdroms/cdrom0"
fi
mount $CDROM /mnt/root || (echo "FATAL: Cannot mount cdrom!" && sh)
echo "mounting tmpfs..."
mount none -t tmpfs /dev/shm || (echo "FATAL: Cannot mount tmpfs!" && sh)
echo "Building symlinks to cd root..."
cd /dev/shm
ln -s /mnt/root/* .
sleep 2.5
echo "Setting mnt and home to rw root..."
rm -f root home mnt
mkdir root home mnt
#echo "linking cdroot's new location to what will be cdroot's old
location..."
#ln -s /mnt/initrd/mnt/root /dev/shm/mnt/root
echo "mounting cdrom at new root..."
mount $CDROM /dev/shm/mnt/root
echo "Pivoting root to shared memory filesystem..."
cd /dev/shm
mkdir initrd
pivot_root . initrd || (echo "Cannot pivot root!" && sh)
mount -t proc none /proc
echo "copying /etc to a rw /etc..."
rm -f etc
mount -t devfs none /dev
cp -R /mnt/root/etc .
echo "Root pivoted, making users..."
sleep 1
echo "creating homes for default users..."
cd /home
mkdir jak
mkdir tails
mkdir fox
mkdir krystal
chgrp users *
chown jak jak
chown tails tails
chown fox fox
chown tails tails
chown krystal krystal
echo "exiting linuxrc and starting init ;)
next reply other threads:[~2003-10-31 0:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-31 0:18 John R Moser [this message]
2003-10-31 18:47 ` Chris Lingard
2003-10-31 12:46 Bob Chiodini
2003-10-31 18:13 ` Maciej Zenczykowski
2003-10-31 21:59 ` H. Peter Anvin
2003-11-03 13:47 ` Bob Chiodini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.A32.3.91.1031030191344.46426A@student.ccbc.cc.md.us \
--to=jmoser5@student.ccbc.cc.md.us \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®