pivot_root and initrd
Would it even be worthwhile to propose a patch that would set a flag when pivot_root is called during an initrd and prevent change_root from occuring once the linuxrc thread exits?
Your method of placing "initrx=xxx" and "root=xxx" is similar to my method of stuffing those values into /proc/sys/kernel/real_root_dev once the pivot_root is complete; I am not really happy with that solution, not the least of which because it is an undocumented work-around and somewhat unexpected behavior for a system call that is to (presumably) replace or augment change_root.
I was also hoping that Warner or Hans would chime-in either in defense of the current documentation or with clarifications...
E
Quoted 16 lines · HPA
Quoted 6 lines
I am mystified that the call to 'exec
/sbin/init' works if you are using the standard (you mention "based on RedHat7.1" util-linux")/sbin/initproggie, and that a standard RH7.1 initscripts would not complain when the root filesystem is already mounted r/w.I would also guess that you are susceptible to the kernel's
change_rootcall if your/sbin/initterminates. I'll have to play with the disk a bit.I modify the initscripts to not try to fsck and remount the root -- its a ramfs (tmpfs in a later version) after all. If I had been mounting a filesystem off the harddisk I would either have mounted it readonly and left the init scripts as-is, or fscked it before mounting.
I pass the following command line options to the kernel (this is set up in isolinux.cfg):
append initrd=initrd.gz root=/dev/ram0 init=/linuxrc single
By specifying root=/dev/ram0 and an explicit init (which I'm calling /linuxrc but could just as easily have called
/sbin/init) I'm telling the kernel that this is the final root, and effectively turn off most of the initrd legacy weirdness.If
/sbin/initexits, the kernel panics, just like it would normally do if init goes away.
Followup to: <[email protected]> By author: Eric <[email protected]> In newsgroup: linux.dev.kernel
Quoted 12 lines
Would it even be worthwhile to propose a patch that would set a flag when
pivot_rootis called during an initrd and preventchange_rootfrom occuring once the linuxrc thread exits?Your method of placing "initrx=xxx" and "root=xxx" is similar to my method of stuffing those values into
/proc/sys/kernel/real_root_devonce thepivot_rootis complete; I am not really happy with that solution, not the least of which because it is an undocumented work-around and somewhat unexpected behavior for a system call that is to (presumably) replace or augmentchange_root.
Quoted 3 lines
I was also hoping that Warner or Hans would chime-in either in defense of the current documentation or with clarifications...
The right thing is to get rid of the old initrd compatibility cruft, but that's a 2.5 change.
-hpa
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt <[email protected]>
In article <[email protected]>,
H. Peter Anvin <[email protected]> wrote:
| The right thing is to get rid of the old initrd compatibility cruft, | but that's a 2.5 change.
Get rid of??? As long as you have some equivalent capability to get
the system up.
Signature · 3 lines
bill davidsen <[email protected]> His first management concern is not solving the problem, but covering his ass. If he lived in the middle ages he'd wear his codpiece backward.
Quoted 8 lines · bill davidsen
In article <[email protected]>,
H. Peter Anvin <[email protected]> wrote:| The right thing is to get rid of the old initrd compatibility cruft, | but that's a 2.5 change.
Get rid of??? As long as you have some equivalent capability to get
the system up.
pivot_root(2) in combination with pivot_root(8)
Rik
Signature · 3 lines
DMCA, SSSCA, W3C? Who cares? http://thefreeworld.net/ (volunteers needed) http://www.surriel.com/ http://distro.conectiva.com/
In article <[email protected]>, Rik van Riel <[email protected]> wrote:
| On Tue, 23 Oct 2001, bill davidsen wrote: | > In article <[email protected]>, | > H. Peter Anvin <[email protected]> wrote: | > | > | The right thing is to get rid of the old initrd compatibility cruft, | > | but that's a 2.5 change. | > | > Get rid of??? As long as you have some equivalent capability to get | > the system up. | | pivot_root(2) in combination with pivot_root(8)
I wasn't really asking about changing root after the system is up, the part needed is the uncompressing of the filesystem into a ramdisk root f/s or some such. After that it's pretty much open to any of several techniques.
Getting the modules loaded to support the root f/s and run a little rc file to get things going is the bootstrap operation, and that's where initrd is vital. You really don't want to build a kernel for every machine if you have more than a few! One kernel and a few config and initrd files is vastly easier.
What replaces the initial step?
Signature · 3 lines
bill davidsen <[email protected]> His first management concern is not solving the problem, but covering his ass. If he lived in the middle ages he'd wear his codpiece backward.
Followup to: <ujkB7.3878$1%[email protected]> By author: [email protected] (bill davidsen) In newsgroup: linux.dev.kernel
Quoted 5 lines
I wasn't really asking about changing root after the system is up, the part needed is the uncompressing of the filesystem into a ramdisk root f/s or some such. After that it's pretty much open to any of several techniques.
Quoted 8 lines
Getting the modules loaded to support the root f/s and run a little rc file to get things going is the bootstrap operation, and that's where initrd is vital. You really don't want to build a kernel for every machine if you have more than a few! One kernel and a few config and initrd files is vastly easier.
What replaces the initial step?
We will definitely have initrd or initramfs to do this (initramfs is using the initrd protocol to populate a ramfs from a tar/cpio image.) However, when it comes up, it will be the root as far as the kernel is concerned, and run /sbin/init (unless overridden on the kernel command line, of course) like any other boot. None of this change_root and /linuxrc special casing garbage.
-hpa
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt <[email protected]>
Quoted 2 lines · H. Peter Anvin
The right thing is to get rid of the old initrd compatibility cruft, but that's a 2.5 change.
Yes, change_root is obsolete (and relies on assumptions that are no longer valid in several cases), and there has been plenty of time for distributors to switch. An early funeral in 2.5 is a good idea.
- Werner
Signature · 3 lines
_________________________________________________________________________ / Werner Almesberger, Lausanne, CH [email protected] / /_http://icawww.epfl.ch/almesberger/_____________________________________/
Quoted 7 lines · Werner Almesberger
Quoted 2 lines · H. Peter Anvin
The right thing is to get rid of the old initrd compatibility cruft, but that's a 2.5 change.
Yes,
change_rootis obsolete (and relies on assumptions that are no longer valid in several cases), and there has been plenty of time for distributors to switch. An early funeral in 2.5 is a good idea.
Hmm. I need to install a SCSI driver, presumably from initrd RAM disk as currently works. Will the new pivot-root be transparent?
Cheers,
Dick Johnson
Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).
I was going to compile a list of innovations that could be attributed to Microsoft. Once I realized that Ctrl-Alt-Del was handled in the BIOS, I found that there aren't any.
Quoted 8 lines · Richard B. Johnson
Quoted 5 lines · Werner Almesberger
Quoted 3 lines · H. Peter Anvin
The right thing is to get rid of the old initrd compatibility cruft, but that's a 2.5 change.
Quoted 8 lines
Quoted 4 lines
Yes,
change_rootis obsolete (and relies on assumptions that are no longer valid in several cases), and there has been plenty of time for distributors to switch. An early funeral in 2.5 is a good idea.Hmm. I need to install a SCSI driver, presumably from initrd RAM disk as currently works. Will the new pivot-root be transparent?
It's not transparent, you need to change your initrd.
-hpa
Quoted 15 lines · H. Peter Anvin
Quoted 13 lines · Richard B. Johnson
Quoted 9 lines · Werner Almesberger
Quoted 3 lines · H. Peter Anvin
The right thing is to get rid of the old initrd compatibility cruft, but that's a 2.5 change.
Yes,
change_rootis obsolete (and relies on assumptions that are no longer valid in several cases), and there has been plenty of time for distributors to switch. An early funeral in 2.5 is a good idea.
Quoted 8 lines
Quoted 3 lines
Hmm. I need to install a SCSI driver, presumably from initrd RAM disk as currently works. Will the new pivot-root be transparent?
It's not transparent, you need to change your initrd.
-hpa
Presently, when /initrd/{ash.static} runs off the end of the
/initrd/linuxrc script, the kernel tries to mount the root
defined for LILO. So I add some program that executes 'pivot-root' instead of just letting the script run off the end?
Cheers,
Dick Johnson
Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).
I was going to compile a list of innovations that could be attributed to Microsoft. Once I realized that Ctrl-Alt-Del was handled in the BIOS, I found that there aren't any.
Quoted 6 lines · Richard B. Johnson
Presently, when /initrd/{ash.static} runs off the end of the
/initrd/linuxrc script, the kernel tries to mount the root
defined for LILO. So I add some program that executes 'pivot-root' instead of just letting the script run off the end?
You do something like:
cd /newrootpivot_root /newroot /newroot/oldroot
exec /sbin/init < /dev/console > /dev/console 2>&1