[systemd-devel] Booting to systemd in a chroot

Kai Krakow hurikhan77 at gmail.com
Thu May 14 13:15:59 PDT 2015

JT Olds <jtolds at xnet5.com> schrieb:

> 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.

Since you are reinstalling anyways, I'd suggest trying out btrfs as your 
filesystem. Create separate subvolumes for each OS and you can get rid of 
chrooting anything. Plus, you can share your home subvolume if you like.

Just take care that btrfs is still under fast development, so both OS should 
run a sufficiently recent kernel. At least I'd advice you to use the oldest 
kernel of the OS set to format btrfs, and not enable incompatible features 

The cool factor is, BTW, that you could deduplicate all your OS 
installations so file systems blocks become shared that are equal throughout 
the OS set, resulting in lower disk space usage.

> 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
Replies to list only preferred.

More information about the systemd-devel mailing list