Today I've seen an issue similar to this one: VBoxManage: won't start virtuals machines NS_ERROR_FAILURE (0x80004005) but in a completely different inexplicable context I can describe here.
In a distribution based on Ubuntu 20.04, I was able to issue this command from a normal user:
$ whoami my-user-name $ VBoxManage startvm --type headless my.app-name
But I was not able to execute the same command from Java, specifically from Tomcat9, from the same user:
ProcessBuilder pb = new ProcessBuilder("bash", "-c", "whoami"); // my-user-name Process p = pb.start(); ProcessBuilder pb = new ProcessBuilder("bash", "-c", "VBoxManage ..."); Process p = pb.start();
In this last case I was obtaining this error:
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine
Note that I was also able to issue that command successfully from an emergency
tty console, or from any other non-interactive shells, but not from Java executed by the Tomcat process.
Everyone on the Internet just suggests to reinstall VirtualBox but this is a completely irrelevant solution for this case (also because I tried multiple times reinstalling Tomcat or VirtualHost without changing anything). Also they suggest to adopt
--type headless but I already did.
Any troubleshooting tip?