lkml.org 
[lkml]   [2003]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectinitrd help -- umounts root after pivot_root
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 ;)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.036 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site