Skip to main content

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
0 answers
20 views

Possible to setup veth with -n but not -b in systemd-nspawn?

making first experiments with systemd-nspawn. I would like to set up a container to run a single application with isolation. So far my command line is sudo systemd-nspawn -M mycontainer -x -U --user=...
callegar's user avatar
  • 111
0 votes
1 answer
48 views

How to increase kernel parameter (`msgmnb`) for a systemd-nspawn container

I have a systemd-nspawn container in which I am trying to change the kernel parameter for msgmnb. When I try to change the kernel parameter by directly writing to the /proc filesystem or using sysctl ...
Yeow_Meng's user avatar
  • 409
0 votes
1 answer
76 views

How to declare systemd dependency for a nspawn service that depends on WireGuard interfaces?

I have a nspawn service that needs to take a WireGuard interface from the host. fw0.nspawn [Network] Interface=wg0 According to nspawn man page, I will also need this systemd drop-in. [Unit] Wants=...
Waiho's user avatar
  • 33
1 vote
1 answer
22 views

Automate passing JBOSS installer arguments using Expect Command

I have a JBOSS Installer which when run manually it will prompt for input and below is the sample of the execution is as below [sp@sp baseInstaller]$ ./advStart.sh config Buildfile: /home/sp/jboss/sp/...
sabarish jackson's user avatar
0 votes
0 answers
73 views

systemd-nspawn: how to select root partition if ambiguous on image?

I have pendrive which (as /dev/sdb) after opening LUKS device on dev/sdb4 looks NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sdb 8:16 1 ...
drwx's user avatar
  • 1
2 votes
0 answers
226 views

Cannot write to /dev/fb0 in systemd-nspawn container

I've created a systemd-nspawn container in which /dev/fb1 from the host is bound as /dev/fb0. I've set PrivateUsers=off in the .nspawn config file, and the file ownership and permissions of /dev/fb0 ...
Clydog's user avatar
  • 31
0 votes
0 answers
43 views

Linux container initialization script utilizing systemd

I am trying to make a template filesystem for my systemd-nspawn container. The container filesystem will be cloned from this template by btrfs snapshot. I needs the container to run a initialization ...
Waiho's user avatar
  • 33
0 votes
1 answer
474 views

How to make a restrictive syscall *whitelist* with systemd-nspawn?

I'm trying to lock down a container using systemd-nspawn, so that only the specific syscalls I whitelist are allowed. Per the documentation, there's a pretty lax filter in place by default, ...
SwarmOfBees's user avatar
0 votes
1 answer
718 views

Failed to get login PTY: Failed to activate service 'org.freedesktop.systemd1'

Been trying to understand and play around with systemd-nspawn because I'd like to run a Debian Testing install for myself without enabling the testing repos on my main Debian stable system. I wrote ...
mrjpaxton's user avatar
2 votes
0 answers
307 views

How do I give my container a static ip address (systemd-nspawn)

My container changes its ip address extremely often, almost every boot. I tried giving it a static ip address so my script knows how to ssh into it but nothing I did seemed to work. So I tried looking ...
Andrew Benor's user avatar
0 votes
1 answer
191 views

How can i map multiple ports in systemd-nspawn container?

I'm writing a container manager script which depends on nspawn, and the container is using a Virtual Ethernet Connection(-n opt). but it looks like that nspawn only support port mapping for single ...
Tsing Kwai's user avatar
2 votes
0 answers
203 views

How are ulimits determined for processes running in unpriviledged containers?

Recently, while I was building something in an unprivileged nspawn container (for CI), with the host system running arch linux, I repeatedly ran into an EMFILE error, from yarn, indicating that I'm ...
Graham Leach-Krouse's user avatar
0 votes
0 answers
606 views

Why do systemd-nspawn's network namespaces not work correctly without systemd running inside the container?

I am trying to run a systemd-nspawn container without an init system and inside of a systemd-nspawn-managed network namespace. My container is a stock Fedora 35 image, and I am invoking it like so: ...
pipe_connector's user avatar
4 votes
1 answer
1k views

How do I wait for a systemd-nspawn container to boot?

I have a script that contains the following: sudo machinectl start "$machinename" sudo systemd-run -PM root@"$machinename" "$command" Failed to connect to bus: No such ...
25pwn's user avatar
  • 43
2 votes
1 answer
543 views

How to resolve a systemd-nspawn container?

I have a nspawn container: root@nomad-02:~# machinectl list MACHINE CLASS SERVICE OS VERSION ADDRESSES debian container systemd-nspawn debian 11 192.168.88.171… 1 machines listed....
nomad87's user avatar
  • 21
4 votes
1 answer
2k views

Start Desktop Environment From Chroot

Is it possible to start a desktop environment entirely in systemd-nspawn or chroot? I want to be able to boot to a console, then optionally enter a chroot and launch Gnome or another desktop ...
grandinero's user avatar
0 votes
1 answer
280 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 ...
user457494's user avatar
4 votes
1 answer
5k 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/...
Badr Elmers's user avatar
0 votes
0 answers
369 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-...
alex1452's user avatar
5 votes
2 answers
3k 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 ...
beep's user avatar
  • 225
3 votes
0 answers
5k 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 (...
aaronk6's user avatar
  • 141
1 vote
2 answers
1k 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 ...
Pascal's user avatar
  • 153
14 votes
1 answer
4k 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 ...
sjy's user avatar
  • 896
2 votes
1 answer
2k 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 ...
Botspot's user avatar
  • 151
1 vote
1 answer
659 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 ...
Botspot's user avatar
  • 151
0 votes
1 answer
1k 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/...
mbigras's user avatar
  • 3,170
3 votes
1 answer
306 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 ...
Mark's user avatar
  • 733
3 votes
1 answer
3k 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. ...
vivi's user avatar
  • 131
-3 votes
1 answer
718 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 ...
Tim's user avatar
  • 103k
6 votes
1 answer
2k 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 (...
humanityANDpeace's user avatar
3 votes
0 answers
53 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 ...
WoJ's user avatar
  • 1,585
9 votes
0 answers
3k 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 ...
goyozi's user avatar
  • 161
2 votes
2 answers
2k 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 ...
Martin's user avatar
  • 21
2 votes
2 answers
6k 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 ...
Evan Carroll's user avatar
  • 31.8k
3 votes
2 answers
4k 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), ...
Evan Carroll's user avatar
  • 31.8k
2 votes
1 answer
1k 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/...
enthu's user avatar
  • 71
0 votes
1 answer
298 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 ...
mirthybrink's user avatar
1 vote
0 answers
1k 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=/...
dstonek's user avatar
  • 199
2 votes
2 answers
5k 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 ...
tobiasBora's user avatar
  • 4,301
0 votes
0 answers
757 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 ...
GeekMagus's user avatar
  • 301
1 vote
1 answer
1k 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. ...
krokoziabla's user avatar
3 votes
1 answer
5k 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 ...
krokoziabla's user avatar
1 vote
1 answer
614 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 ...
Syco's user avatar
  • 196
0 votes
1 answer
854 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 ...
Mark's user avatar
  • 733
1 vote
0 answers
302 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 ...
WoJ's user avatar
  • 1,585
3 votes
2 answers
3k 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 # ...
Ava's user avatar
  • 143
0 votes
1 answer
308 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 ...
sourcejedi's user avatar
  • 51.1k
1 vote
0 answers
203 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 ● [email protected] - Container unstable-...
sourcejedi's user avatar
  • 51.1k
0 votes
1 answer
1k 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 ...
rudib's user avatar
  • 1,632
2 votes
0 answers
556 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 ...
WoJ's user avatar
  • 1,585