Skip to content
Snippets Groups Projects
user avatar
Nikolai Hartmann authored
bab4ce22
History
Name Last commit Last update
etc
var/local/mkosi
README.md

Files/Directories

Build new image

cd /var/local/mkosi
# if not existing yet
mkdir mkosi.cache

If not done yet, install latest version of mkosi in a virtualenv

python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install git+https://github.com/systemd/mkosi.git

Otherwise, just activate the virtualenv

source .venv/bin/activate

Build the image

mkosi -i -t directory -o /var/lib/machines/xcache-$(date +%Y-%m-%d-%H%M)

To start xcache with the new image create a symlink and restart

ln -s /var/lib/machines/<image-to-use> /var/lib/machines/xcache
machinectl stop xcache
machinectl start xcache

Get shell in running container

Workaround from https://unix.stackexchange.com/questions/238478/how-to-run-a-command-inside-a-running-systemd-container/391671#391671
(in newer versions of systemd one could use machinectl shell but that might also require newer versions of systemd inside the container)

nsenter --target=$(machinectl show --property Leader xcache | sed "s/^Leader=//") --mount --uts --ipc --net --pid