Questions tagged [systemd-nspawn]

For questions pertaining to systemd-nspawn, a utility to spawn a command or OS in a light-weight container. Use this tag for questions about systemd-nspawn itself, using systemd-nspawn, or questions about issues arising inside a container spawned by systemd-nspawn where that is significant.

Filter by
Sorted by
Tagged with
0
votes
1answer
26 views

What can happen if you rm -rf a systemd-nspawn container directory from host while running?

I was running a systemd-nspawn container with command: systemd-nspawn --console=passive -qbUD container-directory 2>&1 >/dev/null & to provide a clean build environment. While cleaning ...
0
votes
0answers
25 views

systemd-run on nspawn for unprivileged users

I would like to run some programs in a systemd-nspawn container, and ideally not have to use sudo every time I want to start a program in the container. Assuming it has been started like so: # ...
2
votes
1answer
111 views

Why systemd-nspawn is slower than docker,podman and qemu?! how to Improve nspawn performance?

Why nspawn is slow compared to docker podman and even qemu?! CPU tasks take twice of the time it takes in docker, podman or qemu Here is a benchmark test I did: First I disabled all the spectre/...
0
votes
0answers
20 views

LLMNR persistence across reboots?

I currently manage a homelab server that hosts several containers (systemd-nspawn, all using systemd-networkd for networking). These containers interact with each other over the container network and ...
0
votes
0answers
34 views

Use adb (android debug bridge) in systemd-nspawn container

I would like to use adb inside an systemd-nspawn container. Unfortunately I cannot access the phone inside the container (connected via USB). pi@debian-buster-64:~ $ export ADB_TRACE=usb pi@debian-...
0
votes
2answers
157 views

How to debootstrap Centos?

Is there a way to create a Centos system inside a chroot using something similar to debootstrap for Debian/Ubuntu? I’d need it for a container project where Docker is NOT a solution(I’d use systemd ...
0
votes
0answers
66 views

Is it possible to run machinectl with non-root privileges?

Having set up (in Debian bullseye) some containers with systemd-nspawn, I usually access them with ssh or machinectl shell. Only the former is possible as non-root user. I was wondering if there was a ...
0
votes
0answers
34 views

systemd service private network with veth

I'd like to run a systemd service with PrivateNetwork=true but I'd like to get a veth with the host like I get when running nspawn with -n, --network-veth. Is there a way I can achieve that behavior?
0
votes
0answers
352 views

hostnamectl fails with “Connection timed out” when running inside a systemd-nspawn container

I’m using systemd-nspawn and qemu-arm-static to boot into a Raspberry Pi OS image to apply customizations to the stock image before flashing it onto an SD card. The host machine is Ubuntu 20.10 (...
0
votes
0answers
17 views

How to run emulate Screen/Display and pass it to container?

I want to debug windows manager (kwin_wayland). I don't have second machine handy to use it for remote debugging. So virtualization is my best option. I dont want to use KVM. instead I want to use LXC/...
0
votes
0answers
28 views

Setting security extended file attribute in nspawn returns “Operation not permitted”

I have built an nspawn container. It starts with the -U (--private-users) option, so creates a user namespace. setfattr -n security.NTACL from the container returns Operation not permitted. The same ...
1
vote
0answers
320 views

How to disable X11 extension (MIT-SHM) for systemd-nspawn container?

X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 130 (MIT-SHM) Minor opcode of failed request: 3 (X_ShmPutImage) Value in ...
1
vote
0answers
77 views

How to pass environment variables to systemd-nspawn container?

$ systemd-nspawn -bUM $container -E DISPLAY="$DISPLAY" > (...) $ cat /proc/1/environ > (...) DISPLAY=:0 But echo $DISPLAY outputs nothing, since the variable is passed to systemd ...
1
vote
0answers
66 views

How to update UID/GID in /etc/passwd and /etc/group when using --private-users=pick with systemd containers

sorry for the stupid question as am noob. I have OpenSuseLeap container on my manjaro Linux, I used to login into it and everything was working. I was happy with the command:- sudo systemd-nspawn -b -...
1
vote
2answers
326 views

Install Debian Package in chroot

I am building a minimal Debian image with debootstrap, chroot in it and installing grub. Now I need to install some custom self created debian packages. These packages have postinst scripts running ...
12
votes
1answer
986 views

How can I make a device available inside a systemd-nspawn container with user namespacing?

I would like to mount an encrypted image file using cryptsetup inside a systemd-nspawn container. However, I get this error message: [root@container ~]# echo $key | cryptsetup -d - open luks.img luks ...
1
vote
1answer
491 views

Booting a systemd container - how to bypass console login?

I am using systemd-nspawn to boot a linux container and load its lxsession in a VNC-style nested X server. (Xephyr) I have created a script to do this. One of the main problems with the script is the ...
1
vote
1answer
218 views

Systemd-nspawn boot container, then run lxsession automatically; How to do this?

I am making a script that uses systemd-nspawn to boot a second linux root filesystem in a container. The script is currently using this line to boot the container: systemd-nspawn -b --machine ...
0
votes
1answer
414 views

Manage a systemd-nspawn container as a systemd unit

Question How do I manage a systemd-nspawn container as a systemd unit? Setup Install an image # machinectl pull-raw --verify=no https://ftp.halifax.rwth-aachen.de/fedora/linux/releases/30/Cloud/...
3
votes
1answer
159 views

PLATFORM variable for qemu / system-nspawn

I'm customizing a Raspbian installation using qemu, i.e.: systemd-nspawn -q --bind /usr/bin/qemu-arm-static -D $MOUNTPATH /bin/bash << EOF DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND ...
1
vote
1answer
904 views

systemd-nspawn/machinectl and macvlan

I would like to create a nspawn container connected to the network via macvlan and dhcp. All documentation I have found were very instructive but did not offer a step by step procedure for this setup. ...
-3
votes
1answer
367 views

What is “a light-weight namespace container” created by systemd-spawn?

man systemd-nspawn says systemd-nspawn may be used to run a command or OS in a light-weight namespace container. In many ways it is similar to chroot(1), but more powerful since it fully ...
6
votes
1answer
877 views

Why does `systemd-nspawn -n` network namespace not show in `ip netns list`?

tl;dr Linux has namespaces, in particular, network namespaces. It seems the namespace supposedly created via the -n flag when running systemd-nspwawn does not show up when employing ip netns list (...
2
votes
0answers
25 views

How to ensure a container is started after another?

I use systemd-nspawn to run containers. There are mostly independent, except for two which should be started one after the other. Is there a way to ensure this? Something similar to After= for ...
7
votes
0answers
768 views

systemd-nspawn: how to allow access to all devices?

I'm trying to create a rough equivalent of Docker's --privileged in a systemd container, but I've got no idea how to allow the container to access all of the devices available on the host (without ...
2
votes
1answer
822 views

How to make systemd-nspawn work with ufw firewall?

I'm running a systemd-nspawn container (Debian 9, host also Debian 9) with VirtualEthernet=yes and some ports forwarded, e.g. Port=tcp:443:443. I.e. a web server runs in the container and should be ...
2
votes
2answers
4k views

Running systemd utilities like systemctl under an nspawn?

If I have a directory that I bootstraped with debootstrap that I got inside of running systemd-nspawn what do I have to do make its internal systemd functional? $ sudo systemd-nspawn -D ./foo ...
1
vote
1answer
2k views

systemd-nspawn vs chroot and bind mount?

Does systemd-nspawn do special inside to a chroot or does it just provide a different method of running chroot + the appropriate ro --bind mounts for proc, sys. The docs say, similar to chroot(1), ...
2
votes
1answer
734 views

CPU usage limit to systemd-nspawn container is not working

I am using systemd-nspawn(systemd version 237) in Yocto's embedded Linux environment. This is the content of /etc/systemd/system/systemd-nspawn\@.service.d/override.conf file ExecStart=/usr/bin/...
0
votes
1answer
105 views

non-interactive password change of nspawn container

I want to change passwd of root of nspawn container, as I am creating container via ansible just after I created rootfs, as at very first it doesn't have any root password. is it a good idea to ...
1
vote
0answers
919 views

systemd: autossh service active but ssh exited with error

#/lib/systemd/system/autossh.service [Unit] Description=Auto Reverse SSH Requires=systemd-networkd-wait-online.service After=systemd-networkd-wait-online.service [Service] Type=forking ExecStart=/...
2
votes
2answers
3k views

systemd-nspawn: redirect ports and keep internet

I'd like to know how to be able to: redirect ports between host and container (like for example forwarding the host 23 port to the container 22 port) be able to connect to the internet, for example ...
0
votes
0answers
525 views

ntpd in systemd-nspawn

I'm playing with containerizing various parts of my server infrastructure and one of the services I would like to run in container is ntp daemon. I'm using systemd-nspawn (systemd 233) as a ...
1
vote
1answer
853 views

systemd-nspawn: DHCP Discover cannot pass through a bridge from a container

What I have: A Gentoo host and an Ubuntu container. What I want: To connect the container to the network and to the host. What I'm doing: I've created a bridge on the host and added my NIC to it. ...
3
votes
1answer
2k views

systemd-nspawn: file-system permissions for a bound folder

What I have: A Gentoo host and an Ubuntu container. What I want: Mount /home from the host to the container and use it there as normal. What I'm doing: Start the container with -U --bind=/home ...
1
vote
1answer
370 views

systemd-nspawn inside lxc container

I've a nice chroot environment built with centos 7. I start it using systemd-nspawn. Everything works correctly in my local machine and in all the servers I've seen until now. Today I was asked to put ...
0
votes
1answer
555 views

Generate ssh keys in systemd-nspawn

I wrote a couple of scripts to download, customize and prepare a Raspbian image for Raspberry Pi. Because the root file-system will be mounted in read-only I have to create the ssh keys BEFORE running ...
1
vote
0answers
208 views

What is the interface to which nspawn binds by default?

I have a container created via debootstrap and it has network connectivity when started as systemd-nspawn -D thecontainerdir -b I have several network interfaces and would like it to bind to one of ...
2
votes
1answer
1k views

Enabling networking in a systemd-nspawn container

I'm trying to setup container that has access to the internet but have been unsuccessful so far. # sudo systemd-nspawn -nb -M debian-tree # systemctl enable --now systemd-networkd systemd-resolved # ...
0
votes
1answer
221 views

Firefox+noscript v.s. systemd-nspawn - ABE denial

[ABE] < LOCAL> Deny on {GET http://jessie/icons/openlogo-75.png <<< http://jessie/ - 1} SYSTEM rule: Site LOCAL Accept from LOCAL Deny i.e. pages on http://jessie ...
1
vote
0answers
156 views

debian unstable crash

Debian unstable, running in an nspawn container on Debian Jessie, crashed. On the host: $ sudo systemctl status systemd-nspawn@unstable-srv ● systemd-nspawn@unstable-srv.service - Container unstable-...
0
votes
1answer
744 views

System setup using systemd-nspawn

Can I use systemd-nspawn to setup a "chroot" install(in that case debian using debootstrap) before booting it? I.e. unattended install and setup. I need to set the keymap, hostname, maybe timezone ...
2
votes
0answers
399 views

Can I get a DHCP address from within a container via the DHCP server the host is on?

I have a host (ubuntu xenial) running a container via systemd-nspawn (also xenial): systemd-nspawn --directory=gogs --network-macvlan=ens192 --boot ens192 is the host interface which gets its IP ...
3
votes
1answer
3k views

systemd-nspawn container with separate IP address (network namespace) not working

Looking at the documentation for systemd-nspawn, it must have been intended to have a very user-friendly way to launch containers in a different network namespace. You use the -n option, and simply ...
2
votes
0answers
859 views

How to restart a systemd-nspawn container after the guest issues a reboot command?

I have systemd-nspawn containers which are enabled and start upon the boot of the host server. The problem I have is that they do not understand the reboot command issued on the guest: the container ...
2
votes
1answer
1k views

Why does the nspawn of an ubuntu image fail?

I would like to systemd-nspawn an Ubuntu image (yakkety, the host is on yakkety as well). This used to work without problems, so I guess something changed in the last ~6 months. I created an image ...
1
vote
0answers
295 views

How to restore correct ownership in nspawn containers after upgrade?

I upgraded from Ubuntu 16.04 to 16.10. I am running a few containers with systemd-nspawn. After the upgrade, some of the permissions in containers are not mapped correctly: root@delug:/tmp# ls /root ...
2
votes
1answer
643 views

Minimal system-nspawn container for process tree isolation with embedded applications

Is it possible to use nspawn for a single executable? My goal is just to isolate the process tree of the application, not portability. Let's say you wrote an application in C, built for your target ...
5
votes
1answer
2k views

systemd-nspawn OS container is unusable because I can't set the root password

I combined the detailed instructions from the original blog post, and the more up to date instructions from the man page (using dnf instead of yum). # sudo dnf -y --releasever=24 --installroot=$HOME/...
2
votes
1answer
1k views

systemd-networkd .network ignored within systemd-nspawn container

I'm fiddling with systemd-nspawn containers on my RaspberryPi. So far booting works fine. I use the --network-veth and --network-bridge=br0 options and bridging did work well with a kvm virtual ...