I have set up a Ubuntu 16.04 host with a 16.04 client, which has it's disks as LVM partitions. I encrypted them and I wrote a script to start the VM and to enter the decryption password. This works fine, as log as I am calling the script as the main user. As the systemd service handling is run as root, I need to be able to run the script as root.
But when I call the script as root with sudo, I get following error:
Code: Select all
VBoxManage: error: Failed to initialize COM because the global settings directory '/root/.config/VirtualBox' is not accessible!Of course I tried to start it as the main user with sudo, it fails with the same error:
Code: Select all
sudo -u andi bash -c "cd /home/andi/opt/VBoxManage; ./start-encrypted-vm.sh"Code: Select all
...
VBoxManage: error: Failed to initialize COM because the global settings directory '/root/.config/VirtualBox' is not accessible!
...