Am Donnerstag, dem 01.09.2022 um 14:59 -0300 schrieb Sergio Belkin: > > This is the unit file: > [Unit] > Description=VirtualBox VM %i > After=network.target vboxdrv.service > Before=runlevel2.target shutdown.target > > [Service] > Type=forking > Restart=no > TimeoutSec=5min > IgnoreSIGPIPE=no > KillMode=process > GuessMainPID=no > RemainAfterExit=no > > #ExecStart=/usr/lib/virtualbox/VBoxHeadless --comment RHEL7 --startvm > f02a9f08-2ff2-4a92-b3cd-a8dfb17513c6 --vrde config > ExecStart=/usr/bin/VBoxManage startvm %i --type headless > ExecStop=/usr/bin/VBoxManage controlvm %i acpipowerbutton > > [Install] > WantedBy=default.target > > (End of file) > > What is the proper way to configure this kind of unit? > > Thanks in advance > Is this really a forking process? Or do you just instruct some daemon via a RPC call to start your VM? In this case no actuall process would be there. If there is a forking process, can you instruct VBoxManage to run in the foreground? Or do you need to start some daemon process first and if not already running, than VBoxManage does so? This would explain the lingering processes. In generall your KillMode=process is what keeps the other processes running in the cgroup. Just remove it. Also, your Before= line is bogus. And if your vboxdrv.service just contains the lines to load the vbox modules, you would be far better of with some snippet in /etc/modules-load.d Oh, and as you run in user mode, _all_ your Before= and After= entries are useless, as user units can't see and reference system units. So yeah, your goal would be to see how you can actually start the VM process via CLI and nothing else. BR Silvio