[systemd-devel] Booting to systemd in a chroot

JT Olds jtolds at xnet5.com
Thu May 14 09:32:37 PDT 2015


Thanks Lennart,

I tried pivot_root briefly last night after emailing but my initial attempt
didn't work. Unfortunately I next tried switch_root, which, lol, wiped my
root partition.

I'll try pivot_root when I get a working computer again.

Thanks again
-JT

On Thu, May 14, 2015, 10:25 AM Lennart Poettering <lennart at poettering.net>
wrote:

> On Thu, 14.05.15 06:12, JT Olds (jtolds at xnet5.com) wrote:
>
> > Hey folks!
> >
> > I'm getting lots of systemd errors like
> > `Failed at step NAMESPACE spawning /usr/lib/rtkit/rtkit-daemon: Invalid
> > argument` and just wondering what I'm doing wrong.
> >
> > For background: I have a linux computer that's running Debian Wheezy. I
> > want to install and dual boot Jessie, but without creating a new
> partition,
> > so I want to do it in a chroot (cause why not, I should be able to,
> > right?).
>
> Sorry, but this simply cannot work: a chroot() is too weak, and
> doesn't mix well with file system namespacing (which triggers the
> errors you are seeing). Proper file system namespacing hides the fact
> pretty well that things are namespaced, but chroot does
> not. Especially if you then mix namespacing and chroot things become
> ugly...
>
> Hence, please do not use chroot for what you are trying to do. Please
> either use namespacing (i.e. mount --move) or privot_root() for this.
>
> > I ran `debootstrap jessie /jessie` and got a full Jessie
> > installation in that subfolder (via tasksel and everything). I then
> edited
> > GRUB to have a menu option that boots linux like this:
> >
> > linux /jessie/vmlinuz root=UUID=<uid> rw init=/jessie/chrootinit
> > initrd /jessie/initrd.img
> >
> > Last, I created chrootinit that wraps systemd:
> >
> > #!/bin/bash
> > exec chroot /jessie /sbin/init "$@"
>
> This should work fine if you use pivot_root instead of chroot. Both
> tools are part of util-linux.
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150514/e5e2835b/attachment.html>


More information about the systemd-devel mailing list