I need to run a Windows desktop application to keep track of my expanse. Because CodeWeavers needs Android and Asus ChromeBox CN60 doesn’t have Android support yet according to the list, the only solution is remote access.
Eventually, I realize the lack of RDP-compatible client on ChromeOS makes it impossible to access VirtualBox from CN60.
Table of Contents
Install VirtualBox and Related Packages
First, to access VM remotely, it needs to be launched by VirtualBox on Ubuntu first.
Next, I need the Oracle VM VirtualBox Extension Pack on communication. It implements the VirtualBox Remote Display Protocol (VRDP) based on the VirtualBox Remote Desktop Extension (VRDE) interface. There are also other third-party solutions. With this package, the display can be sent to the remote client while the mouse and keyboard signal from the remote client can be sent back to the VM. Chapter 7. Remote Virtual Machines explains in detail on the topic.
Last, to manage from a web browser, phpVirtualBox simplifies the job.
Install VirtualBox and Extension Pack
Download both from here. They need to be the same version number. For example, if VirtualBox 6.0.4 is installed, get the VirtualBox 6.0.4 Oracle VM VirtualBox Extension Pack.
The one in “Ubuntu Software” is an older version on 2019/4/11. It doesn’t work on Ubuntu 18.10. I install both and get into troubles. Finally, I use dpkg to remove the older version and reinstall the official, it works. Also, there is no extension pack in “Ubuntu Software”. Use the latest version on the official web site is the best source.
Because this is just a quick test, I launch manually binding localhost 127.0.0.1:
$sudo vboxwebsrv -H 127.0.0.1
Install Apache, PHP, and UFW
To launch phpVirtualBox, Apache and PHP must run first. Uncomplicated Firewall (UFW) is suggested to manage firewall rules easier. More usage detail is here. Run these commands to install necessary packages, run Apache with PHP support, and allow Apache to pass through the firewall:
$sudo apt-get update $sudo apt-get install apache2 $sudo apt-get install php libapache2-mod-php php-soap php-xml $sudo apache2 -k restart $sudo apt-get install ufw $sudo ufw enable $sudo ufw allow "Apache"
To check what has been added to the firewall rules:
$sudo ufw status
Create a “/var/www/index.php” as below. Load “http://localhost/index.php” to see if Apache and PHP work properly.
<?php phpinfo(); ?>
Download from the master branch on GitHub and unzip. If the master branch doesn’t support current VirtualBox, try the developer branch. Unzip and rename the downloaded file into the folder “phpvirtualbox”. Copy to “/var/www” where $USER is the user name used to login to Ubuntu:
$sudo cp -r /home/$USER/Downloads/phpvirtualbox /var/www/html
Next, prepare the basic configuration. Create one from copying the example file:
$sudo cp /var/www/html/phpvirtualbox/config.php-example /var/www/html/virtualbox/config.php
For better security, it’s a good idea to create a new user account in Ubuntu to launch vboxwebsrv. Provide the user name and password running vboxwebsrv in “config.php” to replace ‘vbox’ and ‘pass’ as below. It’s detail explained in Cannot login to vboxwebsrv #89 by 3PO commented on Jan 26, 2018.
var $username = 'vbox'; var $password = 'pass';
Please also read this because the vboxwebsrv won’t be launched automatically in Ubuntu due to systemd.
For a quick test, ignore the security settings and launch manually binding localhost 127.0.0.1:
$sudo vboxwebsrv -H 127.0.0.1
A more detailed explanation is here.
If Apache, PHP, and phpVirtualBox are installed and the vboxwebsrv is launched, a login dialog appears loading “http://localhost/phpvirtualbox”. The default user name and password for phpVirtualBox are both “admin”.
It’s a good habit to change the default password immediately.
After importing VM and enable remote display, the server side is ready for test.
The default user name and password for phpVirtualBox are both “admin”. Change the login user’s password from [File] → [Change Password].
To manage users, open the “Preferences” dialog by [File] → [Preferences]. Switch to [Users] section to create, remove, promote to administers, and change password.
Enable Remote Display
Open the “Settings” dialog of the VM which needs to be connected remotely. Switch to [Display] section. In the [Remote Display] tab, tick the [Enable Server] and assign the port number for this VM in [Server Port].
Last, allow this port number to pass through the firewall. If the port number is 3390, run this command to allow:
$sudo ufw allow 3390
For higher security specifying both allow port and IP address range from 192.168.1.0 to 192.168.1.255, use IP Calculator to get the netmask 24 and run this command instead:
$sudo ufw allow from 192.168.1.0/24 to any port 3390
Ubuntu Documentation explains UFW in detail. Here are my firewall rules. :
$sudo ufw status Status: active To Action From -- ------ ---- Apache ALLOW Anywhere 3390 ALLOW 192.168.1.0/24 Apache (v6) ALLOW Anywhere (v6)
Connect to VirtualBox
The built-in console in phpVirtualBox needs the Adobe Flash Player. Since Google decides to remove Flash completely by the end of 2012, I look for other solutions.
Because VRDP is backward-compatible to Microsoft’s Remote Desktop Protocol (RDP), any RDP client should be able to remote control the VM. Here is a list of my test results.
If more than one client needs to connect to the same VM at the same time, tick the [Allow Multiple Connections] in the [Remote Display] tab. Both clients have control of the VM at the same time.
Strangely, phpVirtualBox has problems saving settings in [Authentication Method] and [Allow Multiple Connections]. Sometimes it works. VirtualBox desktop application doesn’t have this issue.
Linux: GNOME Remote Desktop Viewer
It’s default installed in Ubuntu 18.10. Select [Protocol] “RDP” and assign [Host] as [IP Adress]:[Port Number] of the VM.
For example, if the IP address of VirtualBox is 192.168.1.50 and the VM is assigned with 3390 as the [Server Port] for remote display, the [Host] is “192.168.1.50:3390”.
Use the [Bookmarks] menu to manage hosts.
If the VM is already connected by others and doesn’t allow for multiple connections, GNOME Remote Desktop crashes immediately.
Like GNOME Remote Desktop Viewer, it works perfectly. But CoRD is unstable, I have several crashes during testing.
Use the [Servers] button to manage hosts.
Android: Remoter RDP Client
To launch the keyboard within the remote client, touch the screen with three fingers or use the red circle on the upper right corner to select the [Windows Keyboard]. The Android keyboard has no use to control remote server.
Use the [+NEW CONNECTION] button to create hosts and long press on a connection to edit or delete.
Android: Microsoft Remote Desktop
Microsoft Remote Desktop doesn’t work.
It displays “… the PC can’t be found…” using the port 3389 connecting to the VM. The error code is 0x104.
The warning message “Identity of remote PC cannot be verified” using other ports. There seems to be a protocol error. The error code is 0xd06.
Eventually, I give it up.
Find Who is Running vboxwebsrv
To verify if the user running vboxwebsrv is the same to config.php, run to identify:
$ps aux | grep vboxwebsrv
Check IP Address for the Host
My favorite ifconfig is not a built-in command in Ubuntu 18.10. It needs to install net-tools to use. Therefore, I use hostname instead:
Disable phpVirtualBox Authentication
Uncomment the following line in config.php to disable authentication when login to phpVirtualBox:
#var $noAuth = true;
Check the OS Detail
The Ubuntu version and code name are detailed in “/etc/os-release”. Useful when VirtualBox won’t start after an update. Sometimes the kernel has changed, and VirtualBox needs an update, too.
Manage a .deb Package
dpkg is the tool to manage packages. Here is a list of frequently used parameters:
- -i + package file name: install a package file
- -r + package name: remove a package
- -P + package name: remove a package and its configuration files
- -l | less: list all installed packages by page
dpkg-reconfigure is to reconfigure and repair an installed package. Therefore, it needs the package name.
Here are some examples:
$sudo dpkg -i virtualbox-6.0_6.0.4-128413~Ubuntu~bionic_amd64.deb #sudo dpkg-reconfigure virtualbox-6.0
VNC and Windows RDP Solutions
For noVNC, websockify needs to be launched on the server side. Use a modern browser to access. There is no need to install any client software because the server uses HTML5 technology.
For RDP Wrapper, it supports Windows only. After installation, use any compatible RDP client to access.
- AskUbuntu: How can I get vboxweb to start properly at boot
- AskUbuntu: How do I find my internal ip address?
- AskUbuntu: How do I install a .deb file via the command line?
- Asus ChromeBox
- Ciiag: Poor Mans Virtualized Server
- CodeWeavers: How to install CrossOver Chrome OS
- Digital Ocean: How To Install the Apache Web Server on Ubuntu 18.04
- GitHub: noVNC
- GitHub: phpvirtualbox
- GitHub: phpvirtualbox: Issues: Cannot login to vboxwebsrv #89
- GitHub: phpvirtualbox: Wiki: Common phpVirtualBox Errors and Issues
- GitHub: phpvirtualbox: Wiki: Getting started
- GitHub: phpvirtualbox: Wiki: vboxweb service Configuration in Linux
- GitHub: phpvirtualbox: Wiki: Web server and PHP installation
- GitHub: RDP Wrapper
- Google Play: Microsoft Remote Desktop
- Google Play: Remoter RDP Client
- IP Calculator
- Linuxize: How to Install PHP on Ubuntu 18.04
- Migrate Windows Virtual Machine from VirtualBox to QEMU/QNAP Virtualization Station
- nixCraft: How to check os version in Linux command line
- SourceForge: CoRD
- SourceForge: Wiki: phpVirtualBox: Home
- SourceForge: Wiki: phpVirtualBox: vboxweb-service Configuration in Linux
- Step to Install: Step to install .deb file using command line terminal in Ubuntu
- The Chromium Projects: Chrome OS Systems Supporting Android Apps
- TurnKey Linux: Forums: Turnkey PHPVirtualBox Tutorial
- Ubuntu Documentation: UFW
- Ubuntu Wiki: Releases
- VirtualBox: User Manual: Chapter 7. Remote Virtual Machines
- VirtualBox: Download VirtualBox
- Website for Students: Manage Headless VirtualBox Host On Ubuntu 16.04 LTS With PhpVirtualBox, Apache2 And PHP 7.1