Skip to contentSkip to conversation

initramfs programs (was [RFC] klibc requirements)

DISCUSSION Eric S. Raymond 11 participants 22 messages Jan 9, 2002 – Jan 18, 2002

lore
Share & tools
lore
#0 lore raw

greg k-h:

Quoted 1 line

What does everyone else need/want there?

dmidecode, so the init script can dump a DMI report in a known location such as /var/run/dmi.

I want this for autoconfiguration purposes. If I can have it, I won't need /proc/dmi.

Signature · 6 lines
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

I cannot undertake to lay my finger on that article of the
Constitution which grant[s] a right to Congress of expending, on
objects of benevolence, the money of their constituents.
	-- James Madison, 1794
#1 lore raw
Quoted 8 lines · Eric S. Raymond

greg k-h:

Quoted 1 line

What does everyone else need/want there?

dmidecode, so the init script can dump a DMI report in a known location such as /var/run/dmi.

I want this for autoconfiguration purposes. If I can have it, I won't need /proc/dmi.

Why can't this happen inside the regular startup scripts? They know where to put such files; the kernel-level stuff doesn't--I can't think of any current situation where the kernel writes to an arbitrary file in the filesystem as it boots. Sure, /var/run is in the FHS, but that doesn't mean every system will have it.

IMHO, since /var/run/dmi is not needed by any stage of the kernel boot, it should be created in the regular startup scripts (invoked by init(8)).

-Doug

Signature · 2 lines
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863
#2 lore raw
In reply to Eric S. Raymond
Quoted 5 lines · Eric S. Raymond

greg k-h:

Quoted 1 line

What does everyone else need/want there?

dmidecode, so the init script can dump a DMI report in a known location such as /var/run/dmi.

Why do you need that during that stage of the boot process? The DMI tables won't go away.

Besides, is there a way to put them in such a place that when mounting the real root partition, they won't go away? Or, is the initramfs partition going to persist during runtime?

However, we may needs parsers to do IRQ routing. Yes, that means (dramatic horror music) an ACPI interpreter and/or PIRQ table parser.

Which brings me to the question about initramfs configurability. Different systems have different needs during that process. It seems that we need a generic way to build applications for initramfs (and link them against the libc that's used) and build initramfs images.

If building the image is part of the kernel build process, then it's not an issue. But, it would be nice, IMHO, to separate the two; so you could build a new initramfs image and tack it on to an already built kernel...

-pat

#3 lore raw
In reply to Eric S. Raymond

Doug McNaught <[email protected]>:

Quoted 17 lines
Quoted 8 lines · Eric S. Raymond

greg k-h:

Quoted 1 line

What does everyone else need/want there?

dmidecode, so the init script can dump a DMI report in a known location such as /var/run/dmi.

I want this for autoconfiguration purposes. If I can have it, I won't need /proc/dmi.

Why can't this happen inside the regular startup scripts? They know where to put such files; the kernel-level stuff doesn't--I can't think of any current situation where the kernel writes to an arbitrary file in the filesystem as it boots. Sure, /var/run is in the FHS, but that doesn't mean every system will have it.

Quoted 3 lines

IMHO, since /var/run/dmi is not needed by any stage of the kernel boot, it should be created in the regular startup scripts (invoked by init(8)).

You're right, I don't need this to be done at kernel level. I do need it to be done *everywhere*. I'm not sure how else to guarantee this will happen.

Signature · 5 lines
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

The American Republic will endure, until politicians realize they can
bribe the people with their own money.
	-- Alexis de Tocqueville
#4 lore raw
In reply to Eric S. Raymond
Quoted 2 lines · Eric S. Raymond

You're right, I don't need this to be done at kernel level. I do need it to be done *everywhere*. I'm not sure how else to guarantee this will happen.

Time to call in your chits with Red Hat and the other distributors. ;)

-Doug

Signature · 2 lines
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863
#5 lore raw
In reply to Eric S. Raymond

Patrick Mochel <[email protected]>:

Quoted 11 lines · Eric S. Raymond
Quoted 6 lines

greg k-h:

Quoted 1 line

What does everyone else need/want there?

dmidecode, so the init script can dump a DMI report in a known location such as /var/run/dmi.

Why do you need that during that stage of the boot process? The DMI tables won't go away.

I know. My proposal to put dmidecode in initramfs is an alternative to /proc/dmi, one which won't involve having dmidecode run in kernelspace.

The underlying problem is that dmidecode needs access to kmem, and I can't assume that the person running my configurator will be root.

Signature · 7 lines
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

The whole of the Bill [of Rights] is a declaration of the right of the
people at large or considered as individuals...  It establishes some
rights of the individual as unalienable and which consequently, no
majority has a right to deprive them of.
         -- Albert Gallatin, Oct 7 1789
#16 lore raw
In reply to Eric S. Raymond
Quoted 3 lines · Eric S. Raymond

You're right, I don't need this to be done at kernel level. I do need it to be done *everywhere*. I'm not sure how else to guarantee this will happen.

Then add an init script and include installation of it to the installation steps of your autoconfigurator (it has to be installed anyway). If a distributor packages your program, he will include the init script into his package and enable it according to his init policy, or write an own init script, if your provided one doesn't fit.

That's the way it works for network daemons etc. for years.

Andreas

Signature · 3 lines
       Andreas Ferber - dev/consulting GmbH - Bielefeld, FRG
     ---------------------------------------------------------
         +49 521 1365800 - [email protected] - www.devcon.net
#17 lore raw
In reply to Eric S. Raymond

Andreas Ferber <[email protected]>:

Quoted 8 lines

Then add an init script and include installation of it to the installation steps of your autoconfigurator (it has to be installed anyway). If a distributor packages your program, he will include the init script into his package and enable it according to his init policy, or write an own init script, if your provided one doesn't fit.

That's the way it works for network daemons etc. for years.

This sounds like good advice. The autoconfigurator is part of CML2, which I expect to be distributed with the kernel. Does that change your advice at all?

Signature · 5 lines
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

"Those who make peaceful revolution impossible 
will make violent revolution inevitable."
	-- John F. Kennedy
#6 lore raw
In reply to Eric S. Raymond
Quoted 2 lines · Eric S. Raymond

The underlying problem is that dmidecode needs access to kmem, and I can't assume that the person running my configurator will be root.

But you can "su -c" (also sudo, I suppose). If that person doesn't have root, then building a kernel isn't going to do them much good.

Matthew.

#7 lore raw
In reply to Eric S. Raymond

Matthew Kirkwood <[email protected]>:

Quoted 6 lines
Quoted 2 lines

The underlying problem is that dmidecode needs access to kmem, and I can't assume that the person running my configurator will be root.

But you can "su -c" (also sudo, I suppose). If that person doesn't have root, then building a kernel isn't going to do them much good.

We've been over this already. No, the configurator user should *not* have to su at any point before actual kernel installation. Bad practice, no doughnut.

Signature · 5 lines
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

"The power to tax involves the power to destroy;...the power to
destroy may defeat and render useless the power to create...."
	-- Chief Justice John Marshall, 1819.
#18 lore raw
In reply to Eric S. Raymond
Followup to:  <[email protected]>
By author:    "Eric S. Raymond" <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 9 lines

Andreas Ferber <[email protected]>:

Quoted 7 lines

Then add an init script and include installation of it to the installation steps of your autoconfigurator (it has to be installed anyway). If a distributor packages your program, he will include the init script into his package and enable it according to his init policy, or write an own init script, if your provided one doesn't fit.

Quoted 6 lines
Quoted 1 line

That's the way it works for network daemons etc. for years.

This sounds like good advice. The autoconfigurator is part of CML2, which I expect to be distributed with the kernel. Does that change your advice at all?

The program at hand is actually dmiparse or whatever it's called. If dmiparse isn't available, or its input data, print an eror message.

-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]>
#13 lore raw
In reply to Eric S. Raymond
Followup to:  <[email protected]>
By author:    "Eric S. Raymond" <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 5 lines

Matthew Kirkwood <[email protected]>:

Quoted 3 lines
Quoted 2 lines

The underlying problem is that dmidecode needs access to kmem, and I can't assume that the person running my configurator will be root.

Quoted 8 lines
Quoted 3 lines

But you can "su -c" (also sudo, I suppose). If that person doesn't have root, then building a kernel isn't going to do them much good.

We've been over this already. No, the configurator user should *not* have to su at any point before actual kernel installation. Bad practice, no doughnut.

We have also been over the fact that dmidecode, if written appropriately, could be setuid, or call a "dmicat" setuid program. This is a dmidecode implementation detail.

-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]>
#8 lore raw
In reply to Eric S. Raymond
Quoted 10 lines · Eric S. Raymond
Quoted 6 lines
Quoted 2 lines

The underlying problem is that dmidecode needs access to kmem, and I can't assume that the person running my configurator will be root.

But you can "su -c" (also sudo, I suppose). If that person doesn't have root, then building a kernel isn't going to do them much good.

We've been over this already. No, the configurator user should *not* have to su at any point before actual kernel installation. Bad practice, no doughnut.

Why bad practice? Anyway, you can:

if [ /proc/ -nt /var/run/dmidecode ]; then
echo We need to run some code as root. echo -n Enter root\'s\
su -c 'dmidecode > /var/run/dmidecode'
fi

Which provides at least a way to have your config tool work without having to bloat the initramfs.

Matthew.

#19 lore raw
In reply to Eric S. Raymond
Quoted 4 lines · Eric S. Raymond
Quoted 1 line

That's the way it works for network daemons etc. for years.

This sounds like good advice. The autoconfigurator is part of CML2, which I expect to be distributed with the kernel. Does that change your advice at all?

Yes, a little bit. Make dmidecode (or whatever you also need for preparation steps that have to be done as root) a separate package, which has to be installed before "make autoconfig" works, and write that down in Documentation/Changes.

This gives you several benefits:

- you don't depend on the version of the /running/ kernel for "make autoconfig" to work (/dev/kmem is available for a /long/ time now).
- you can install and run dmidecode on one machine, copy the retrieved data to another machine and autoconfigure/build the kernel there.

Distributions can install the package by default, to make it work for your grandmother as well, if that's what you want.

Andreas

Signature · 3 lines
       Andreas Ferber - dev/consulting GmbH - Bielefeld, FRG
     ---------------------------------------------------------
         +49 521 1365800 - [email protected] - www.devcon.net
#9 lore raw
In reply to Eric S. Raymond

Matthew Kirkwood <[email protected]>:

Quoted 6 lines
Quoted 3 lines

We've been over this already. No, the configurator user should *not* have to su at any point before actual kernel installation. Bad practice, no doughnut.

Why bad practice? Anyway, you can:

Quoted 8 lines

if [ /proc/ -nt /var/run/dmidecode ]; then
echo We need to run some code as root. echo -n Enter root\'s\
su -c 'dmidecode > /var/run/dmidecode'
fi

Which provides at least a way to have your config tool work without having to bloat the initramfs.

OK. One more time.

The autoconfigurator is *not* mean to be run at boot time, or as root.

It is intended to be run by ordinary users, after system boot time. This is so they can configure and experimentally build kernels without incurring the "oops..." risks of going root.

Therefore, the above 'solution' is not acceptable.

Signature · 7 lines
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

A man who has nothing which he is willing to fight for, nothing 
which he cares about more than he does about his personal safety, 
is a miserable creature who has no chance of being free, unless made 
and kept so by the exertions of better men than himself. 
	-- John Stuart Mill, writing on the U.S. Civil War in 1862
#11 lore raw
In reply to Eric S. Raymond
Followup to:  <[email protected]>
By author:    "Eric S. Raymond" <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 11 lines

OK. One more time.

The autoconfigurator is *not* mean to be run at boot time, or as root.

It is intended to be run by ordinary users, after system boot time. This is so they can configure and experimentally build kernels without incurring the "oops..." risks of going root.

Therefore, the above 'solution' is not acceptable.

If /var/run/dmidata [or whatever you call it] isn't available, put an error box on the screen and say "complain to your distribution vendor."

End of story.

-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]>
#14 lore raw
In reply to H. Peter Anvin
Quoted 3 lines

We have also been over the fact that dmidecode, if written appropriately, could be setuid, or call a "dmicat" setuid program. This is a dmidecode implementation detail.

We've also proved the DMI data is too unreliable to be used, so the entire problem space is irrelevant

#10 lore raw
In reply to Eric S. Raymond
Quoted 7 lines · Eric S. Raymond
Quoted 5 lines

if [ /proc/ -nt /var/run/dmidecode ]; then
echo We need to run some code as root. echo -n Enter root\'s\
su -c 'dmidecode > /var/run/dmidecode'
fi

The autoconfigurator is *not* mean to be run at boot time, or as root.

Under normal circumstances.

Quoted 3 lines

It is intended to be run by ordinary users, after system boot time. This is so they can configure and experimentally build kernels without incurring the "oops..." risks of going root.

Then ship it in a separate package with initscripts. Either CML2 is well enough designed that the autoconfigurator will not need to change as the kernel does, or all your overengineering was for nought.

Quoted 1 line

Therefore, the above 'solution' is not acceptable.

To who? It provides as way for your configurator to function out-of-the-box until distributions choose whether it's worth their while to support your scheme.

Matthew.

#15 lore raw
In reply to Alan Cox
Quoted 5 lines · Alan Cox
Quoted 3 lines

We have also been over the fact that dmidecode, if written appropriately, could be setuid, or call a "dmicat" setuid program. This is a dmidecode implementation detail.

We've also proved the DMI data is too unreliable to be used, so the entire problem space is irrelevant

That's not a problem, remember Eric volunteered to maintain the enormous black list 8-)

Signature · 2 lines
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs
#20 lore raw
In reply to Eric S. Raymond
Quoted 5 lines · Eric S. Raymond

greg k-h:

Quoted 1 line

What does everyone else need/want there?

dmidecode, so the init script can dump a DMI report in a known location such as /var/run/dmi.

No, this belongs in a distribution's init scripts. Initramfs is stuff that is needed before mounting real root, not everything that must be done before we have a login prompt.

Signature · 1 line
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.."
#21 lore raw
In reply to Eric S. Raymond

Hi!

Quoted 2 lines

You're right, I don't need this to be done at kernel level. I do need it to be done *everywhere*. I'm not sure how else to guarantee this will happen.

Ehm? autoconfig is not good enough reason to force *everyone* to do dmi scanning. I don't give a damn about autoconfig, and you are not going to force it to my machines. Stop trying.

It may be reasonable if you wanted major distros to have that. Just don't say *everyone*.
Pavel

Signature · 2 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
#12 lore raw
In reply to Eric S. Raymond

Hi!

Quoted 16 lines
Quoted 6 lines
Quoted 3 lines

We've been over this already. No, the configurator user should *not* have to su at any point before actual kernel installation. Bad practice, no doughnut.

Why bad practice? Anyway, you can:

Quoted 7 lines

if [ /proc/ -nt /var/run/dmidecode ]; then
echo We need to run some code as root.
echo -n Enter root\'s> > su -c 'dmidecode > /var/run/dmidecode'
fi

Which provides at least a way to have your config tool work without having to bloat the initramfs.

OK. One more time.

Quoted 7 lines

The autoconfigurator is *not* mean to be run at boot time, or as root.

It is intended to be run by ordinary users, after system boot time. This is so they can configure and experimentally build kernels without incurring the "oops..." risks of going root.

Therefore, the above 'solution' is not acceptable.

Therefore, autoconfigurator is not acceptable. Tada.

You can't go around saying "my autoconfigurator needs this so put it into kernel". autoconfigurator is not important enough to touch kernel/initrd.
Pavel

Signature · 2 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.