Created attachment 778115 [details, diff] Patch to replace the use of whoami with $LOGNAME/$USER This bug report has been submitted upstream as ticket #20928 (https://www.virtualbox.org/ticket/20928), but Gentoo-specific modifications will override an eventual upstream fix. See that ticket for more complete details and replication steps. VirtualBox, via gentoo/app-emulation/virtualbox/files/virtualbox-ose-6-wrapper, checks for the presence of a VBoxSVC process owned by the current user and will delete a user-specific directory in /tmp if no process is found. But the process check uses the "whoami" command to get the current username and the deletion uses the environment variables $LOGNAME or $USER. Certain implementations of su, such as the one from util-linux, does not update $LOGNAME or $USER when switching to the root user, but whoami will return "root". Thus, if a user named "vmuser" runs VirtualBox through su, it will search for processes owned by root but delete the socket belonging to vmuser. The removal of these files will then lead to bad side effects for VMs that were previously running, as future calls to VirtualBox will create a new IPC socket in /tmp. When using this new socket, all VMs will be shown as being powered off when they might still be running. It is also possible to start another instance of a running VM, which leads to disk corruption when both instances attempt to write to the same disk image. I have attached a small patch to replace the use of whoami with $LOGNAME/$USER, and hereby make this modification available under the MIT license. The patch needs to be applied to gentoo/app-emulation/virtualbox/files/virtualbox-ose-6-wrapper and not the VirtualBox source tree, as the relevant files from upstream will be replaced by the wrapper. The result of "emerge --info" is attached to this bug report.
Created attachment 778118 [details] Result of "emerge --info"
This is pretty serious and it's a Gentoo-specific regression. The patch seems reasonable enough.
Hello, I don't know if this is related, but I ran into a bug today that might be related. My server hadn't been stopped for 6 months, and it had gone from version 6.1.28-r2 to version 6.1.32-r1 without virtualbox being restarted. After an unfortunate power outage, I had to restart my server, and then I couldn't launch a virtual machine anymore because of the error described here https://forums.virtualbox.org/viewtopic.php?f=7&t =105337 And I was able to circumvent the problem by manually launching /usr/lib64/virtualbox/VBoxXPCOMIPCD and /usr/lib64/virtualbox/VBoxSVC beforehand. And indeed, I run my virtual machine using su. I don't know if the problem is solved by the unstable version 6.1.34
I'll commit the fix for this in 3 days (16th) if no response.
(In reply to Christophe PEREZ from comment #3) > My server hadn't been stopped for 6 months, and it had gone from version > 6.1.28-r2 to version 6.1.32-r1 without virtualbox being restarted. > After an unfortunate power outage, I had to restart my server, and then I > couldn't launch a virtual machine anymore because of the error described > here https://forums.virtualbox.org/viewtopic.php?f=7&t=105337 > [...] > And indeed, I run my virtual machine using su. I haven't seen the NS_ERROR_SOCKET_FAIL message, but it does sound like that problem could be related to this bug. Gentoo switched to a different implementation of su (which will trigger this bug) in December, so that could be what caused your system to break: https://gitweb.gentoo.org/repo/gentoo.git/commit/sys-apps/util-linux?id=c550eb53b108fcf6d4e2a38778230bc9a7d078e8
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32e104524f206f4c02aa95f739995ad084c57201 commit 32e104524f206f4c02aa95f739995ad084c57201 Author: Lars Wendler <polynomial-c@gentoo.org> AuthorDate: 2022-06-15 12:36:35 +0000 Commit: Lars Wendler <polynomial-c@gentoo.org> CommitDate: 2022-06-15 12:37:52 +0000 app-emulation/virtualbox: Revbumps to remove uage of whoami Thanks-to: Johan Hedlin <Busan15@protonmail.com> Closes: https://bugs.gentoo.org/843776 Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> app-emulation/virtualbox/files/virtualbox-ose-6-wrapper | 2 +- .../{virtualbox-6.1.32-r1.ebuild => virtualbox-6.1.32-r2.ebuild} | 0 .../{virtualbox-6.1.34.ebuild => virtualbox-6.1.34-r1.ebuild} | 0 3 files changed, 1 insertion(+), 1 deletion(-)