linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* initrd help -- umounts root after pivot_root
@ 2003-10-31  0:18 John R Moser
  2003-10-31 18:47 ` Chris Lingard
  0 siblings, 1 reply; 6+ messages in thread
From: John R Moser @ 2003-10-31  0:18 UTC (permalink / raw)
  To: Linux Kernel Mailing List

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 ;)


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: initrd help -- umounts root after pivot_root
@ 2003-10-31 12:46 Bob Chiodini
  2003-10-31 18:13 ` Maciej Zenczykowski
  2003-10-31 21:59 ` H. Peter Anvin
  0 siblings, 2 replies; 6+ messages in thread
From: Bob Chiodini @ 2003-10-31 12:46 UTC (permalink / raw)
  To: linux-kernel

On Thu, 2003-10-30 at 19:18, John R Moser wrote: 
> 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
John,

It does not appear that the kernel(s) will support the root fs on
tmpfs.  Looking through the init kernel code:  It boils down to a block
device with real major and minor number or NFS.

Could you set up a ramdisk to do the same thing as /dev/shm?  Also,
you'll have to tell the kernel where root is, either a boot parameter
(root=xxx) or with the rdev command.

Bob...


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-11-03 13:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-31  0:18 initrd help -- umounts root after pivot_root John R Moser
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).