I've been working with systemd-nspawn and have a couple of containers that I'd like to automatically start at system start.
I'm using arch linux and according to the archwiki entry, the following code should do the trick
# systemctl enable [email protected]
# systemctl start [email protected]
Assuming the container MyContainer
is in /var/lib/machines and was created with something like:
# pacstrap -i -c -d /var/lib/machines/MyContainer base
I can start the container with:
# sudo systemd-nspawn -b -D /var/lib/machines/MyContainer
and
# systemctl start [email protected]
as well as
# machinectl start MyContainer
but I just can't get the container to start at boot and running sudo systemctl status [email protected]
right after boot doesn't show any errors. Does anyone know what I need to do? Does there maybe need to be another service running?
After doing a little more research, I discovered the problem. It's not that another service needs to be running, but instead another target, specifically machines.target
, so running
systemctl enable machines.target
in addition to the commands above made it so that MyContainer
starts at boot.
As a side note, this wasn't immediately clear because when I call
systemctl list-units --all --type=target
on both of my computers (both running arch linux), machines.target
is not included in the list. Not sure why, but that was the fix.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다