Skip to contentSkip to conversation

chroot= as a new kernel parameter

PATCH Bodo Eggert 1 participant 2 messages Mar 3, 2008 – Mar 6, 2008 7 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 6 lines · Pavel Machek
Quoted 6 lines

On Sat, Mar 1, 2008 at 8:09 PM, Pawel Plociennik <[email protected]>

Quoted 3 lines

In the short this patch has added a new chroot= kernel parameter which can be used to changing a chroot of an init process before it will has been runed.

Quoted 6 lines
Quoted 3 lines

Wouldn't booting with 'init=/usr/sbin/chroot /path /sbin/init' achieve the same effect?
Haven't tested it, just wondering.

This breaks down when there's no distribution installed in /, or when distro in / is badly broken.

Yes.

Real life example: I set up a system in qemu and moved it to ~/temp/foo in order to test it before overwriting the old system. I had to boot into /bin/sh, mount the home disc and chroot into that directory.

OTOH, I'm not sure if the kernel would have found my home if it were on LVM.

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 7 lines · Guillaume Chazarain

On Wed, Mar 5, 2008 at 2:38 PM, Pawel Plociennik <[email protected]>

Quoted 3 lines

At last my patch is as simple as possible and it has *only* a *few lines of the code* and it can be used as *independent* method to various *hundred* distroes.

Your method requires a certain kernel, mine does not ;-)

Your method requires to type the whole bible on the command line.

Quoted 10 lines
Quoted 6 lines

static void run_init_process(char *init_filename) {
+ if (chroot_str)
+ if (sys_chroot(chroot_str) < 0)
+ printk(KERN_WARNING "chroot=%s failed\n",
chroot_str); +

As I said before, this chroot= option can be used for security reason instead of testing purpose, and in this case, continuing booting after a failed chroot sounds like a security issue.

Even if not, continuing on unknown/bad options is a BAD idea. If I made a typo in the path, the wrong system would be started, leaving me to choose between waiting (felt) five minutes until I can shut it down cleanly or to hard reboot and fsck.