I have a script on home called startvm.sh:
Code: Select all
#!bin/bash
#Inciamos el primer paso de la VM
echo "startvm";
VBoxManage startvm OmnitecOsaccess --type headless &
sleep 10;
#Iniciamos la VM encrpytada con la clave
echo "initencrypt";
VBoxManage controlvm "OmnitecOsaccess" addencpassword "OmnitecOsaccessDisc" /home/omnitec/claveDiscoRetama &
But when i use my systemd service startvm.service:
Code: Select all
User=omnitec
Group=omnitec
# Type=simple
# PIDFile=/run/my-service.pid
RemainAfterExit=yes
ExecStart=/home/omnitec/startvm.sh
# ExecReload=/home/transang/startup.sh reload
# ExecStop=/home/transang/startup.sh stop
# TimeoutSec=30
# Restart=on-failure
# RestartSec=30
# StartLimitInterval=350
# StartLimitBurst=10
[Install]
WantedBy=multi-user.target
-- Logs begin at Tue 2021-10-19 12:55:47 UTC, end at Tue 2021-10-19 13:05:01 UTC. --
Oct 19 12:56:28 ubuntumvhost systemd[1]: Started Starts VPN.
Oct 19 12:56:28 ubuntumvhost startvm.sh[762]: startvm
Oct 19 12:56:28 ubuntumvhost startvm.sh[772]: WARNING: The character device /dev/vboxdrv does not exist.
Oct 19 12:56:28 ubuntumvhost startvm.sh[772]: Please install the virtualbox-dkms package and the appropriate
Oct 19 12:56:28 ubuntumvhost startvm.sh[772]: headers, most likely linux-headers-generic.
Oct 19 12:56:28 ubuntumvhost startvm.sh[772]: You will not be able to start VMs until this problem is fixed.
Oct 19 12:56:29 ubuntumvhost startvm.sh[764]: VBoxManage: error: The virtual machine 'OmnitecOsaccess' has terminated >
Oct 19 12:56:29 ubuntumvhost startvm.sh[764]: VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), componen>
Oct 19 12:56:29 ubuntumvhost startvm.sh[764]: Waiting for VM "OmnitecOsaccess" to power on...
Oct 19 12:56:38 ubuntumvhost startvm.sh[762]: initencrypt
Oct 19 12:56:39 ubuntumvhost startvm.sh[940]: VBoxManage: error: Machine 'OmnitecOsaccess' is not currently running
What am i doing wrong?
Thankyou