NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: graphical desktop in virtualbox



On Mon, 6 Apr 2020 at 09:52, Sad Clouds <cryintothebluesky%gmail.com@localhost> wrote:
>
> There were many responses to you original email, but I couldn't
> quite figure out if anyone suggested a practical solution to your
> problem. I'm interested to know the answer as well, as I also run
> NetBSD as a VirtualBox VM.
>
> I didn't think VirtualBox extensions were usable with NetBSD guests,

They are...

> so I've used a different solution - TigerVNC. It is one of a few
> software packages that also works reasonably well on sparc64. If you
> need details on how to set it up to run remote X11 session, then drop
> me a quick email and I'll give you a copy of my scripts.



Here we are, all credit to Valery Ushakov. There are quite a bit of
mail exchanges on port-amd64 regarding these, but the gist is as
follows.

1. Install devel/kbuild and devel/yasm. Earlier versions of kbuild
were unusable and there was a package in wip, now the version present
in pkgsrc works just fine.

2. make sure /usr/src and /usr/xsrc are populated with the sources for
the exact version you are running; I have them nfs-mounted from my
build host. As the build process requires the exact system sources, it
would be perhaps difficult or impossible to have this in pkgsrc;
adding the necessary bits to the NetBSD source tree on the other hand
would be a lot of work for not that big return.

3. Download the sources from Oracle VirtualBox, at the moment
https://download.virtualbox.org/virtualbox/6.1.4/VirtualBox-6.1.4.tar.bz2
.

4. Extract the sources somewhere, cd to VirtualBox-6.1.4.

5. Create LocalConfig.kmk with the following contents:

VBOX_WITHOUT_HARDENING := 1
VBOX_ONLY_ADDITIONS := 1
VBOX_WITH_ADDITION_DRIVERS := 1
VBOX_WITH_X11_ADDITIONS := 1
VBOX_ONLY_ADDITIONS_WITHOUT_RTISOMAKER := 1

ifeq ($(KBUILD_TARGET), netbsd)
TEMPLATE_VBOXGUESTR3EXE_LIBS     = $(TEMPLATE_VBOXR3EXE_LIBS) crypt
endif

6. Apply the following small patch (perhaps an oversight by whoever
has commited the corresponding file at VirtualBox, it works for me):

# cat sleepqueue-r0drv-netbsd.patch

--- src/VBox/Runtime/r0drv/netbsd/sleepqueue-r0drv-netbsd.h.ORIG
2020-04-06 10:03:05.099721005 +0100
+++ src/VBox/Runtime/r0drv/netbsd/sleepqueue-r0drv-netbsd.h
2020-04-06 10:03:22.569466321 +0100
@@ -37,7 +37,7 @@
 #include <iprt/time.h>

 static syncobj_t vbox_syncobj = {
-        SOBJ_SLEEPQ_FIFO,
+        SOBJ_SLEEPQ_LIFO,
         sleepq_unsleep,
         sleepq_changepri,
         sleepq_lendpri,

(The error message in the build process suggests it).

7. Go ahead with the build process:

kmk KBUILD_VERBOSE=2 BUILD_TYPE=release

The above should finish without an error and leave you with

 # ls -l out/netbsd.amd64/release/bin/additions
total 32224
-rwxr-xr-x 2 root wheel 8519872 Apr  6 10:05 VBoxClient
-rwxr-xr-x 2 root wheel 8962432 Apr  6 10:05 VBoxControl
-rwxr-xr-x 2 root wheel 8359344 Apr  6 10:05 VBoxService
-rwxr-xr-x 1 root wheel  331312 Apr  6 10:05 vboxguest.kmod
-rwxr-xr-x 2 root wheel  357864 Apr  6 10:05 vboxvideo_drv_110.so
-rwxr-xr-x 2 root wheel  343312 Apr  6 10:05 vboxvideo_drv_111.so
-rwxr-xr-x 2 root wheel  343216 Apr  6 10:05 vboxvideo_drv_112.so
-rwxr-xr-x 2 root wheel  354712 Apr  6 10:05 vboxvideo_drv_113.so
-rwxr-xr-x 2 root wheel  354680 Apr  6 10:05 vboxvideo_drv_114.so
-rwxr-xr-x 2 root wheel  354952 Apr  6 10:05 vboxvideo_drv_115.so
-rwxr-xr-x 2 root wheel  356712 Apr  6 10:05 vboxvideo_drv_116.so
-rwxr-xr-x 2 root wheel  355672 Apr  6 10:05 vboxvideo_drv_117.so
-rwxr-xr-x 2 root wheel  358424 Apr  6 10:05 vboxvideo_drv_118.so
-rwxr-xr-x 2 root wheel  350448 Apr  6 10:05 vboxvideo_drv_13.so
-rwxr-xr-x 2 root wheel  346232 Apr  6 10:05 vboxvideo_drv_14.so
-rwxr-xr-x 2 root wheel  344536 Apr  6 10:05 vboxvideo_drv_15.so
-rwxr-xr-x 2 root wheel  378928 Apr  6 10:05 vboxvideo_drv_16.so
-rwxr-xr-x 2 root wheel  360632 Apr  6 10:05 vboxvideo_drv_17.so
-rwxr-xr-x 2 root wheel  361008 Apr  6 10:05 vboxvideo_drv_18.so
-rwxr-xr-x 2 root wheel  362296 Apr  6 10:05 vboxvideo_drv_19.so
-rwxr-xr-x 2 root wheel  288936 Apr  6 10:05 vboxvideo_drv_70.so
-rwxr-xr-x 2 root wheel  285664 Apr  6 10:05 vboxvideo_drv_71.so

8. Now I usually place all these files in /usr/local/bin/additions
directory, to keep them away from the system and allow me to easlily
replace them.

9. Create the directory for the kernel module:

# mkdir /stand/amd64/9.99.54/modules/vboxguest ###(obviously adjust to
your NetBSD version)
# cp /usr/local/bin/additions/vboxguest.kmod
/stand/amd64/9.99.54/modules/vboxguest

10. I modify my /etc/rc.local, adding

....
if [ -x /stand/amd64/`uname -r`/modules/vboxguest/vboxguest.kmod ]; then
        /sbin/modload vboxguest
fi

if [ -x /usr/local/bin/additions/VBoxService ]; then
        /usr/local/bin/additions/VBoxService --pidfile /var/run/VBoxService.pid
fi
.....

On first execution of '/sbin/modload vboxguest' you will get

# ls -l /dev/vboxguest
crw-rw-rw- 1 root wheel 357, 0 Nov  8 00:07 /dev/vboxguest

So, no need to create it.

11. Now try

. /etc/rc.local

You shoould get:

 . /etc/rc.local
Starting local daemons:09:24:55.136639 main     VBoxService 6.1.4
r136177 (verbosity: 0) netbsd.amd64 (Apr  5 2020 14:07:20) release log
09:24:55.136656 main     Log opened 2020-04-06T09:24:55.136618000Z
09:24:55.136769 main     OS Product: NetBSD
09:24:55.136786 main     OS Release: 9.99.54
09:24:55.136797 main     OS Version: NetBSD 9.99.54 (GENERIC_KASLR)
#0: Sun Apr  5 12:22:39 BST 2020
sysbuild@ymir:/home/sysbuild/amd64/obj/home/sysbuild/src/sys/arch/amd64/compile/GENERIC_KASLR
09:24:55.136806 main     Executable: /usr/local/bin/additions/VBoxService
09:24:55.136811 main     Process ID: 9510
09:24:55.136820 main     Package type: BSD_64BITS_GENERIC
09:24:55.138890 main     6.1.4 r136177 started. Verbose level = 0

and in the log file

[  3649.241416] vboxguest0 at pci0 dev 4 function 0: VirtualBox Guest
[  3649.252985] vboxguest0: interrupting at ioapic0 pin 20
[  3649.252985] wsmouse1 at vboxguest0 mux 0

12. Make sure you get

/usr/local/bin/additions/VBoxClient --display
/usr/local/bin/additions/VBoxClient --clipboard

executed whenever you start X (in your .xinitrc, .xsession or the
environment you are using).

As I mentioned before, dynamic resizing now works, but not seamless.
You also can't mount a shared folder (that's never been an issue for
me).

13. Make sure "ws" driver is used for the mouse.

Chavdar














--
----


Home | Main Index | Thread Index | Old Index