1

I am testing systemd-nspawn and launch a base system testcont (previously created with debootstrap) either via

# systemd-nspawn -bD testcont --network-bridge=br1

or

# systemctl start systemd-nspawn@testcont.service

In the first case I can pass some arguments to systemd-nspawn (notably the bridge I want to use) - how can I do that in the second case?

For services I create myself I have the relevant /etc/systemd/systemd/<something>.service file I can adapt but in the case above the service is somehow magically started though systemd-nspawn@ and there is no configuration file I could find.

WoJ
  • 3,607
  • 9
  • 49
  • 79

1 Answers1

0

The systemd-nspawn@testcont.service is an instance from /usr/lib/systemd/system/systemd-nspawn@.service

if you want to customise, you can

cp /usr/lib/systemd/system/systemd-nspawn@.service /etc/systemd/system/
sed -i.bak s/--network-veth/--network-bridge=br1/g /etc/systemd/system/systemd-nspawn@.service

then all new

systemctl start systemd-nspawn@testcont.service

will be started with --network-bridge=br1

if you don't want --network-bridge=br1 by default, one could create a specific systemd-nspawn-br1, again :

cp /usr/lib/systemd/system/systemd-nspawn@.service /etc/systemd/system/systemd-nspawn-br1@.service
sed -i.bak s/--network-veth/--network-bridge=br1/g /etc/systemd/system/systemd-nspawn-br1@.service

start with: systemctl start systemd-nspawn-br1@testcont.service