Closed angryzor closed 7 months ago
Ok, I took some time to look at this myself and it seems to be multiple problems:
The new version of the guest additions starts the resizing service as VBoxClient --vmsvga-session
, a new service that relies on a kernel module called vmwgfx
. This kernel module shows errors on my machine. I'm currently not sure if they are relevant:
May 28 08:42:48 devbox kernel: [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
May 28 08:42:48 devbox kernel: [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
Aside from that, VBoxClient --vmsvga-session
first tries to connect to this kernel module using IPC, fails, then falls back to VBoxClient --vmsvga
using a fork, and fails that as well:
17:03:10.957034 main VBoxClient 7.0.8 r156879 (verbosity: 4) linux.amd64 (Apr 17 2023 18:38:34) release log
17:03:10.957035 main Log opened 2023-07-20T17:03:10.957031000Z
17:03:10.957138 main OS Product: Linux
17:03:10.957168 main OS Release: 6.1.37
17:03:10.957195 main OS Version: #1-NixOS SMP PREEMPT_DYNAMIC Sat Jul 1 11:16:27 UTC 2023
17:03:10.957220 main Executable: /nix/store/53d62dqgh899r0lwrr34qh8pvmnqp1g2-VirtualBox-GuestAdditions-7.0.8-6.1.37/bin/VBoxClient
17:03:10.957221 main Process ID: 1659
17:03:10.957221 main Package type: LINUX_64BITS_GENERIC
17:03:10.957289 main VBoxClient 7.0.8 r156879 started. Verbose level = 4. Wayland environment detected: no
17:03:10.957315 main Service: VMSVGA display assistant
17:03:10.959266 main Initializing service ...
17:03:10.959286 main VBoxClient VMSVGA: probing Desktop Environment helper 'GNOME3'
17:03:10.959292 main VBoxClient VMSVGA: probing Desktop Environment helper 'GENERIC'
17:03:10.959633 dcm-task VBoxClient VMSVGA: vbcl_hlp_generic_display_change_event_monitor_worker started
17:03:10.960153 main VBoxClient VMSVGA: attempt to start display change monitor thread, rc=VINF_SUCCESS
17:03:10.960163 main VBoxClient VMSVGA: using Desktop Environment specific display helper 'GENERIC'
17:03:10.960181 main VBoxClient VMSVGA: Error: unable to connect to IPC server, rc=VERR_FILE_NOT_FOUND
17:03:10.960258 dcm-task VBoxClient VMSVGA: vbcl_hlp_generic_display_change_event_monitor_worker ended
17:03:10.960268 main VBoxClient VMSVGA: helper service terminated, rc=VINF_SUCCESS
17:03:10.960280 main VBoxClient VMSVGA: starting legacy service, rc=VERR_FILE_NOT_FOUND
17:03:10.960283 main VBoxClient VMSVGA: Service is not availabe, skipping
17:03:10.960329 main VBoxClient VMSVGA: End of log file - Log started 2023-07-20T17:03:10.957031000Z
The reason for the first failure is that it is trying to access a socket through an absolute path that doesn't exist:
/** Local IPC name prefix for portable names. */
#define RTLOCALIPC_POSIX_NAME_PREFIX "/tmp/.iprt-localipc-"
static int rtLocalIpcPosixConstructName(struct sockaddr_un *pAddr, uint8_t *pcbAddr, const char *pszName, bool fNative)
{
const char *pszNativeName;
int rc = rtPathToNative(&pszNativeName, pszName, NULL /*pszBasePath not support*/);
if (RT_SUCCESS(rc))
{
size_t cchNativeName = strlen(pszNativeName);
size_t cbFull = !fNative ? cchNativeName + sizeof(RTLOCALIPC_POSIX_NAME_PREFIX) : cchNativeName + 1;
if (cbFull <= sizeof(pAddr->sun_path))
{
RT_ZERO(*pAddr);
#ifdef RT_OS_OS2 /* Size must be exactly right on OS/2. */
*pcbAddr = sizeof(*pAddr);
#else
*pcbAddr = RT_UOFFSETOF(struct sockaddr_un, sun_path) + (uint8_t)cbFull;
#endif
#ifdef HAVE_SUN_LEN_MEMBER
pAddr->sun_len = *pcbAddr;
#endif
pAddr->sun_family = AF_LOCAL;
if (!fNative)
{
memcpy(pAddr->sun_path, RTLOCALIPC_POSIX_NAME_PREFIX, sizeof(RTLOCALIPC_POSIX_NAME_PREFIX) - 1);
memcpy(&pAddr->sun_path[sizeof(RTLOCALIPC_POSIX_NAME_PREFIX) - 1], pszNativeName, cchNativeName + 1);
}
else
memcpy(pAddr->sun_path, pszNativeName, cchNativeName + 1);
}
else
rc = VERR_FILENAME_TOO_LONG;
rtPathFreeNative(pszNativeName, pszName);
}
return rc;
}
The reason for the failure in the fallback is similar. It is trying to run /usr/bin/VBoxClient --vmsvga
:
/** Defines the DRM client executable (image). */
# define VBOX_DRMCLIENT_EXECUTABLE "/usr/bin/VBoxDRMClient"
# define VBOX_DRMCLIENT_LEGACY_EXECUTABLE "/usr/bin/VBoxClient"
/** Defines the guest property that defines if the DRM resizing client needs to be active or not. */
# define VBOX_DRMCLIENT_GUEST_PROP_RESIZE "/VirtualBox/GuestAdd/DRMResize"
VBGLR3DECL(int) VbglR3DrmLegacyClientStart(void)
{
#if defined(RT_OS_LINUX)
const char *apszArgs[3] = { VBOX_DRMCLIENT_LEGACY_EXECUTABLE, "--vmsvga", NULL };
return VbglR3DrmStart(VBOX_DRMCLIENT_LEGACY_EXECUTABLE, apszArgs);
#else
return VERR_NOT_SUPPORTED;
#endif
}
which also doesn't exist on NixOS.
These absolute paths are not patched up by the derivation:
[nix-shell:~]$ strings $(which VBoxClient) | grep /usr
/usr/X11/bin/xrandr
/usr/bin/VBoxClient
/usr/bin/VBoxDRMClient
/usr/lib/pam.d/
/usr/bin:/bin:/usr/sbin:/sbin
/usr/bin:/bin
/usr/bin
/usr/local/bin
It looks like the first failure is caused originally by the same problem as the second failure:
00:22:42.099971 VMMDev: Guest Log: 16:55:51.835845 main VBoxService 7.0.8 r156879 (verbosity: 0) linux.amd64 (Apr 17 2023 18:38:33) release log
00:22:42.099984 VMMDev: Guest Log: 16:55:51.835847 main Log opened 2023-07-20T16:55:51.835840000Z
00:22:42.100273 VMMDev: Guest Log: 16:55:51.836165 main OS Product: Linux
00:22:42.100307 VMMDev: Guest Log: 16:55:51.836206 main OS Release: 6.1.37
00:22:42.100340 VMMDev: Guest Log: 16:55:51.836238 main OS Version: #1-NixOS SMP PREEMPT_DYNAMIC Sat Jul 1 11:16:27 UTC 2023
00:22:42.100377 VMMDev: Guest Log: 16:55:51.836270 main Executable: /nix/store/53d62dqgh899r0lwrr34qh8pvmnqp1g2-VirtualBox-GuestAdditions-7.0.8-6.1.37/bin/VBoxService
00:22:42.100384 VMMDev: Guest Log: 16:55:51.836271 main Process ID: 668
00:22:42.100387 VMMDev: Guest Log: 16:55:51.836272 main Package type: LINUX_64BITS_GENERIC
00:22:42.110010 VMMDev: Guest Log: 16:55:51.845886 main VMSVGA DRM resizing client not started, rc=VERR_FILE_NOT_FOUND
00:22:42.110123 VMMDev: Guest Log: 16:55:51.846011 main 7.0.8 r156879 started. Verbose level = 0
00:22:42.110347 VMMDev: Guest Log: 16:55:51.846225 main vbglR3GuestCtrlDetectPeekGetCancelSupport: Supported (#1)
->
VBGLR3DECL(int) VbglR3DrmClientStart(void)
{
#if defined(RT_OS_LINUX)
const char *apszArgs[2] = { VBOX_DRMCLIENT_EXECUTABLE, NULL }; /** @todo r=andy Pass path + process name as argv0? */
return VbglR3DrmStart(VBOX_DRMCLIENT_EXECUTABLE, apszArgs);
#else
return VERR_NOT_SUPPORTED;
#endif
}
I'll see if I can make a patch.
@angryzor Thanks for opening this issue and for the root-cause analysis you have done.
Do you still plan on trying to make a patch for this or would it be good if someone else picked this up?
I am having the same problem. Is anybody planning on fixing this? If not is it possible to patch this individually? If so what do we need to do to fix it?
Note you can get resizing to work if you "downgrade" to VBoxSVGA
(instead of VMSVGA
) and if you disable 3D acceleration.
Still would be good to get this fixed to work with the preferred graphics driver.
The new version of the guest additions starts the resizing service as
VBoxClient --vmsvga-session
, a new service that relies on a kernel module calledvmwgfx
. This kernel module shows errors on my machine. I'm currently not sure if they are relevant:May 28 08:42:48 devbox kernel: [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel. May 28 08:42:48 devbox kernel: [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
vmwgfx
is VMWare's guest driver. I would be surprised if Virtual Box was using it.
@angryzor Thanks for opening this issue and for the root-cause analysis you have done.
Do you still plan on trying to make a patch for this or would it be good if someone else picked this up?
I've been a bit preoccupied with other things lately, I'm sorry for the radio silence. The issue is that this is a lot more complex than I initially thought. I thought it was just some variables to be set during compilation or a small patch to be added to the derivation, but this specific guest additions package currently packages a binary distribution built by Oracle itself, so the strings are compiled into the binary.
I could try using buildFHSEnv to create an FHS wrapper environment, but it's kind of dirty since the source code for the guest additions seems to be available: the main virtualbox package is built from source and the source package it uses includes (as far as I can see, unless I'm missing something) the source code for the guest additions, so I'm not sure why the guest additions package instead uses the prebuilt binaries.
The better solution is probably to instead rework the package to build from source... However, I'm a bit out of my depth with building an entire package from scratch, and also kind of afraid that I would break things with such a large change.
I'll have another look at it this weekend, if I can't figure it out I'll pass on the torch.
The new version of the guest additions starts the resizing service as
VBoxClient --vmsvga-session
, a new service that relies on a kernel module calledvmwgfx
. This kernel module shows errors on my machine. I'm currently not sure if they are relevant:May 28 08:42:48 devbox kernel: [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel. May 28 08:42:48 devbox kernel: [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
vmwgfx
is VMWare's guest driver. I would be surprised if Virtual Box was using it.
It does, their VMSVGA driver is an implementation of VMWare's protocol.
Having the similar issue with VirtualBox. Is anyone still working on it?
Hi everyone. I have been able to fix this issue. Documenting it here in case someone in the future would need. The issue is due to Wayland (sigh). I am using Gnome with GDM. When I logged in, I need to switch session from gnome
to gnome-xorg
. Afterward, I fired up the terminal and execute VBoxClient --vmsvga
and it worked!!!
I am now able to use multiple screens feature as well as auto resizing.
@AnhQuanTrl Knowing that switching back to X is a workaround is good; thanks for sharing that. I wouldn't call it a fix, though. Something still needs to be discovered or fixed to support Wayland sessions.
I think the issue is because the initialization code to start VBoxClient-all
is in /etc/gdm/Xsession
but Xsession only get sourced if using X11. It is just a hypothesis though.
The new version of the guest additions starts the resizing service as
VBoxClient --vmsvga-session
, a new service that relies on a kernel module calledvmwgfx
. This kernel module shows errors on my machine. I'm currently not sure if they are relevant:May 28 08:42:48 devbox kernel: [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel. May 28 08:42:48 devbox kernel: [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
vmwgfx
is VMWare's guest driver. I would be surprised if Virtual Box was using it.
as the smvga-driver used in Virtualbox is taken from vmware it makes sense to rely on vmgfx.
Graphics Controller: Specifies the graphics adapter type used by the guest VM. Note that
you must install the Guest Additions on the guest VM to specify the VBoxSVGA or VMSVGA
graphics controller. The following options are available:
– VBoxSVGA: The default graphics controller for new VMs that use Windows 7 or later. This graphics controller improves performance and 3D support when compared to the
legacy VBoxVGA option.
- VBoxVGA: Use this graphics controller for legacy guest OSes. This is the default graphics controller for Windows versions before Windows 7 and for Oracle Solaris. 3D acceleration is not supported for this graphics controller.
- VMSVGA: Use this graphics controller to emulate a VMware SVGA graphics device. This is the default graphics controller for Linux guests.
- None: Does not emulate a graphics adapter type
Hi, I am a new user of NixOS and would like to learn how to work with NixOS through VirtualBox. Is there currently a known working configuration that won't require me to run the VBoxClient everytime I start the system? I am ok with it being X11 instead of wayland, as long as it enables me to comfortably work with a NixOS desktop environment with guest additions working until a permanent fix has been developed.
Is there currently a known working configuration that won't require me to run the VBoxClient everytime I start the system?
Thanks @Yarny0, have had an opportunity to try it out on a fresh AMD64 Gnome install. nixos-rebuild
is complaining about the single quote after getExe
. If I remove that instead I get attempt to call something which is not a function but a string with context
. These are not things I am experienced enough with to debug I am afraid. After all I am just installing to be able to learn NixOS. Perhaps it's better for me to write off running NixOS as a desktop guest in VirtualBox as unsupported and try a server installation instead, using SSH to dial in?
nixos-rebuild
is complaining about the single quote aftergetExe
.
Oh, on which channel are you? The functions getExe
and getExe'
are actually two different functions with exactly these names (the single quote is just part of the function name of the second function).
But: getExe'
is quite new and not available in NixOS 23.05.
You can replace the offending line with this one, which should have the same outcome (not tested!):
PATH=${path}:$PATH ${virtualboxGuestAdditions}/bin/VBoxClient --vmsvga
I have downloaded the standard ISO from https://nixos.org/download.html#nixos-iso Looking at the last line of my config this seems to indeed be 23.05. Your alternative line seems to have worked. It produced a valid rebuild after which I did a reboot. However I still don't seems to have things like automatic resizing and clipboard support working. Do they need to be enabled separately somehow?
Clipboard etc. should also work without auto-resizing. Is virtualisation.virtualbox.guest.enable = true;
enabled in your config? Is any of the vboxclient-Processes running when you're logged in (ps aux | grep -i vbox
)?
Yes, virtualbox is enabled in the configuration. VBoxService --foreground
is running as root, but no VBoxClient
.
It works with this configuration (host and guest fresh NixOS 23.05, vbox-fix.nix
is the workaround module stated earlier).
Maybe my solution isn't compatible with your display manager something, or similar...
You might try this config and then gradually change it towards yours until it breaks.
Otherwise, I'm out of ideas.
@Yarny0 Ok, that seems to work for now. Will try to reconstruct the default Gnome installation and see what element breaks VBox support. Thanks for your help so far. Will post back any findings.
Surprisingly it looks like having a regular user already breaks it a little. When I log in with a non-root user it complains that it failed to register resizing support. However the second time I log in it is ok, though resizing takes about 20 seconds, where as root it is nearly instant. As soon as I either enable the GDM display manager or the Gnome desktopmanager resizing stops working both for root and regular users.
I am currently rewriting the guest addition package description. Current state: resizing and clipboard are working on gnome with wayland as well as X11.
If someone wants to give it a try. My changes can be found here: https://github.com/FriedrichAltheide/nixpkgs/tree/release-23.11-virtualboxGuestAdditionsFixes
FWIW, I gave both your release-23.11 branch and #290122 a spin and they seem to work.
I'm new to NixOS; this is how I figured out to test:
nixos-rebuild -I nixpkgs=https://github.com/FriedrichAltheide/nixpkgs/archive/refs/heads/release-23.11-virtualboxGuestAdditionsFixes.tar.gz switch
or:
nixos-rebuild -I nixpkgs=https://github.com/FriedrichAltheide/nixpkgs/archive/refs/heads/virtualbox-guest-additions-fixes.tar.gz switch
Not sure if there's a better or more targeted way to test.
x86_64 Linux guest, Windows host. Virtualbox 7.0.14
Total noob question. I was investigation this exact issue. How that it's merge how do I update my version? nixos-rebuild switch --upgrade
. I was dabbling with unstable but this is not a program as far as I get it. Sorry for the dumb questions, but would love to get this tested on my VM.
You need to wait for the PR to reach the channel you're using, and then nixos-rebuild switch --upgrade
. You can use https://nixpk.gs/pr-tracker.html?pr=290122 to track it.
Cool, so it will get to unstable first, and then I still need somehow update from the unstable branch. Will continue googling then.
I've seen that the package is now on unstable, and have bee trying to build and failing. Lot's of learning, but I assume I'm doing something dumb. https://discourse.nixos.org/t/install-unstable-virtualbox-7-0-14/42502/2
Describe the bug
Before a recent update of my system (running VirtualBox Guest Additions 6.1.40 r154048), guest screen resizing worked using the VMSVGA video adapter. A recent update of NixOS updates the Guest Additions to 7.0.8 r156879 and now this feature is no longer working properly.
Steps To Reproduce
virtualisation.virtualbox.guest.enable = true;
.Expected behavior
Guest screen should resize to fill window.
Additional context
Relevant diff of the VBox log between the 2 NixOS generations:
Note the line
VMSVGA DRM resizing client not started, rc=VERR_FILE_NOT_FOUND
I found out that
VBoxClient --vmsvga
is not running (ps
output):Manually running
/nix/store/53d62dqgh899r0lwrr34qh8pvmnqp1g2-VirtualBox-GuestAdditions-7.0.8-6.1.37/bin/VBoxClient --vmsvga
fixes the problem for the current session.Notify maintainers
@K900 , @erdnaxe
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.