# virtualbox-ose 6.1.36 can't open URLs or User Manual



## ko56 (Oct 1, 2022)

Hi,

I'm running FreeBSD 13.1, and have virtualbox-ose 6.1.36 installed from the pkg.  The problem is that the VM manager (not the guest!)
cannot open any URLs.   E.g. if I select Help -> VirtualBox Web Site, I get the message

`Failed to open https://www.virtualbox.org. Make sure your desktop environment can properly handle URLs of this type.`

Similarly, for the User Manual, Help -> Contents says

`Failed to open file:///usr/home/ko/.config/VirtualBox/UserManual.pdf. Make sure your desktop environment can properly handle URLs of this type.`

Does anyone have any ideas?


----------



## _martin (Oct 1, 2022)

What DE (desktop environment) are you using ?


----------



## _martin (Oct 2, 2022)

The only DE I have on FreeBSD at hand right now is fluxbox. There I have the same issue as you're describing. I did a quick check on why that is. Long story short VirtualBox should be able to detect 4 browsers automatically (via QT's DesktopServices API): google-chrome,firefox,mozilla and opera. I don't understand why it's failing on that (seems /usr/local/bin is not used in PATH search). But that API is aware of two environment variables: BROWSER and DEFAULT_BROWSER. So if you put that into your profile next run of manager would be able to resolve it.

I use bash so in my ~/.bashrc I've added: 
	
	



```
export BROWSER="/usr/local/bin/firefox"
```


----------



## ko56 (Oct 2, 2022)

Thanks.  I use xfce. I also looked at the source and got as far as QT's DesktopServices API, but I gave up after that.
Using `export BROWSER=/usr/local/bin/firefox` did the trick.


----------



## T-Daemon (Oct 2, 2022)

ko56 said:


> Similarly, for the User Manual, Help -> Contents says
> 
> `Failed to open file:///usr/home/ko/.config/VirtualBox/UserManual.pdf. Make sure your desktop environment can properly handle URLs of this type.`


Package (or port) emulators/virtualbox-ose is build without a manual:

```
/usr/ports/emulators/virtualbox-ose % make showconfig
     MANUAL=off: Build with user manual
```
Download the manual and place it in the VirtualBox's search path.


----------



## ko56 (Oct 2, 2022)

T-Daemon said:


> Package (or port) emulators/virtualbox-ose is build without a manual:
> 
> ```
> /usr/ports/emulators/virtualbox-ose % make showconfig
> ...



Yes, I saw that when I looked at the port's Makefile.  
But when I pressed Help->Contents for the first time, the manual got downloaded (by default, I guess) into the path I showed above: `/usr/home/ko/.config/VirtualBox/UserManual.pdf`.  Where should it be?


----------



## T-Daemon (Oct 2, 2022)

ko56 said:


> But when I pressed Help->Contents for the first time, the manual got downloaded (by default, I guess) into the path I showed above: `/usr/home/ko/.config/VirtualBox/UserManual.pdf`


That path looks odd. On my system the missing manual is searched under /usr/local/share/doc/virtualbox-ose/UserManual.pdf (pop-up window), which would be the correct path:

emulators/virtualbox-ose/pkg-plist:

```
%%MANUAL%%%%DOCSDIR%%/UserManual.pdf
```
`DOCSDIR` gets expanded to PREFIX/share/doc/PORTNAME (/usr/local/share/doc/virtualbox-ose/).


----------



## _martin (Oct 2, 2022)

ko56 said:


> Thanks. I use xfce. I also looked at the source and got as far as QT's DesktopServices API, but I gave up after that.


You were on the right track then.  I was not in mood to compile the VirtualBox on my odroid box, I kinda forgot FreeBSD doesn't ship debug symbols with prebuilt packages.

I wanted to keep the answer simple so I didn't share the source links. But as you did look, I will. So the issue is here, in detectWebBrowser() which gets called by DesktopServices when you open the help items (URI handlers).
In my setup (fluxbox) code should land in line 155 where it starts parsing the static browser names. Check executable is wrapper around findExecutable() where the issue is, at least most likely. It seems the proper env PATH isn't used. As a test I created symlink  /usr/bin/firefox pointing to actual location in /usr/local. It worked without the additional environment variables. Removing the link made it fail again.
I didn't have time yet to check, I will recompile virtualbox and most importantly QT with debug option to see what it does.


----------



## ko56 (Oct 2, 2022)

T-Daemon said:


> That path looks odd. On my system the missing manual is searched under /usr/local/share/doc/virtualbox-ose/UserManual.pdf (pop-up window), which would be the correct path:
> 
> emulators/virtualbox-ose/pkg-plist:
> 
> ...



As a test, I renamed `/usr/home/ko/.config/VirtualBox/UserManual.pdf` to `/usr/home/ko/.config/VirtualBox/UserManual-ko.pdf`.

Now when I click on Help->Contents, I get

`Could not find the VirtualBox User Manual /usr/local/share/doc/virtualbox-ose/UserManual.pdf.
Do you wish to download this file from the Internet?`

If I say yes, I get

`The VirtualBox User Manual has been successfully downloaded from [URL]https://download.virtualbox.org/virtualbox/6.1.36/UserManual.pdf[/URL] and saved locally as /usr/home/ko/.config/VirtualBox/UserManual.pdf.`

Next, I created `/usr/local/share/doc/virtualbox-ose`and put the manual there.  Now I get

`Failed to open file:///usr/local/share/doc/virtualbox-ose/UserManual.pdf. Make sure your desktop environment can properly handle URLs of this type.`


----------



## ko56 (Oct 2, 2022)

_martin said:


> You were on the right track then.  I was not in mood to compile the VirtualBox on my odroid box, I kinda forgot FreeBSD doesn't ship debug symbols with prebuilt packages.
> 
> I wanted to keep the answer simple so I didn't share the source links. But as you did look, I will. So the issue is here, in detectWebBrowser() which gets called by DesktopServices when you open the help items (URI handlers).
> In my setup (fluxbox) code should land in line 155 where it starts parsing the static browser names. Check executable is wrapper around findExecutable() where the issue is, at least most likely. It seems the proper env PATH isn't used. As a test I created symlink  /usr/bin/firefox pointing to actual location in /usr/local. It worked without the additional environment variables.


`/usr/bin` sounds like a Linux remnant to me.


_martin said:


> Removing the link made it fail again.
> I didn't have time yet to check, I will recompile virtualbox and most importantly QT with debug option to see what it does.



Well, thanks, but it may not be worth it to spend all this effort on it.


----------



## T-Daemon (Oct 2, 2022)

ko56 said:


> As a test, I renamed `/usr/home/ko/.config/VirtualBox/UserManual.pdf` to `/usr/home/ko/.config/VirtualBox/UserManual-ko.pdf`.
> 
> Now when I click on Help->Contents, I get
> 
> ...


Manual downloaded from the VirtualBox gui and placed in .config/Virtualbox. After failure to open moved to /usr/local/share/doc/virtualbox-ose/UserManual.pdf.

Apparently my window manager (x11-wm/openbox) can't "handle URLs of this type" neither way:

```
Qt WARNING: Unable to detect a launcher for 'file:///home/online/.config/VirtualBox/UserManual.pdf'

Qt WARNING: Unable to detect a launcher for 'file:///usr/local/share/doc/virtualbox-ose/UserManual.pdf'
```

It's not an issue for me, I prefer the html manual.


----------



## facedebouc (Oct 2, 2022)

ko56 said:


> `Failed to open file:///usr/local/share/doc/virtualbox-ose/UserManual.pdf. Make sure your desktop environment can properly handle URLs of this type.`


You're right, I get the same error message. But if I launch this URL with
`xdg-open "file:///home/joe/.config/VirtualBox/UserManual.pdf"` it works. This file is opened with my favorite PDF reader.


----------



## ko56 (Oct 2, 2022)

facedebouc said:


> You're right, I get the same error message. But if I launch this URL with
> `xdg-open "file:///home/joe/.config/VirtualBox/UserManual.pdf"` it works. This file is opened with my favorite PDF reader.


But you're doing this by hand, not through VirtualBox, right?  (It also works for me to open this file by hand with my PDF reader.)


----------



## facedebouc (Oct 2, 2022)

ko56 said:


> But you're doing this by hand, not through VirtualBox, right?  (It also works for me to open this file by hand with my PDF reader.)


So it seems there is a bug with VirtualBox.


----------



## _martin (Oct 2, 2022)

T-Daemon said:


> It's not an issue for me, I prefer the html manual.


If you have any pdf reader installed that xdg-open is able to open manager should be able to open it. It's the same issue as with the web browser. Some sort of PATH parsing is not done correctly in QT library. This is also why ko56 has above error on pdf too (coming from the same API call).



ko56 said:


> Well, thanks, but it may not be worth it to spend all this effort on it.


Yeah, I won't spend too much time on it. If anything I'm just curious why.


----------



## _martin (Oct 3, 2022)

I've opened a PR 266778.

After quick debugging of QT's DesktopServices I've noticed VirtualBox process has PATH set to a default one. I was digging through the VBox code when I realized /usr/local/bin/virtualbox is a shell script that is actually overwriting user's PATH. One could edit this script and expand PATH to include at least /usr/local/bin.


----------



## T-Daemon (Oct 3, 2022)

Thank you for the effort _martin.

After including `/usr/local/bin` to PATH in the virtualbox script, URLs from gui 'Help' menu are launched with the default internet browser, UserManual.pdf (Help -> Contents or F1) with a pdf viewer, if present.


----------



## ko56 (Oct 3, 2022)

T-Daemon said:


> Thank you for the effort _martin.
> 
> After including `/usr/local/bin` to PATH in the virtualbox script, URLs from gui 'Help' menu are launched with the default internet browser, UserManual.pdf (Help -> Contents or F1) with a pdf viewer, if present.


Thanks _martin !


----------



## Voltaire (Oct 23, 2022)

Does Alpine Linux still have network connectivity for you? (the standard version, not the VM version)

I have the following two problems:










*Edit*
I didn't have _vboxnet_enable="YES"  _in rc.conf
This was the issue..
VirtualBox works well again for me:


----------

