Skip to content

Instantly share code, notes, and snippets.

@jdnavarro
Created January 27, 2016 14:19
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jdnavarro/65c8284cc67a6ae2c5ee to your computer and use it in GitHub Desktop.
Save jdnavarro/65c8284cc67a6ae2c5ee to your computer and use it in GitHub Desktop.
Bootstrap systemd-nspawn Fedora container from an Arch Linux host

Install yum from AUR

$ yaourt -Sy yum

Add bootstrap repos to /etc/yum.d/boot.repo

[fedora]
name=fedora
baseurl=https://archives.fedoraproject.org/pub/fedora/linux/releases/23/Everything/x86_64/os/
enabled=1

[updates]
name=updates
baseurl=https://archives.fedoraproject.org/pub/fedora/linux/updates/23/x86_64/
enabled=1

Optionally if using btrfs:

# btrfs subvolume create /var/lib/machines/fedora

Bootstrap:

# yum --installroot=/var/lib/machines/fedora install systemd passwd dnf fedora-release NetworkManager

Set root password:

# systemd-nspawn -M fedora
# passwd
...
C-]]]

Start and login into the container:

# machinectl start fedora
# machinectl login fedora
# dnf update
...
@jdnavarro
Copy link
Author

I first tried it with dnf, which is in AUR, instead of yum, but for some reason, when bootstrapping it can't find dnf and fedora-release packages.

@akadata
Copy link

akadata commented Sep 13, 2019

do you need to install dnf and /etc/fedora-release into the container? copy it/them in first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment