Category Archives: Virtualization

Home / Virtualization
9 Posts

Some types of Synology are able to run VirtualBox as a hypervisor. With a hypervisor you are able to run a virtualized computer as if it was a physical computer. The Package Center resource http://spk.diablos-netzwerk.de offers a package for Synology DistStations with the following architecture: x86, cedarview, bromolow, evansport, avoton and braswell. If you want to know what architecture your DiskStation has, you can find it out here. Your DiskStation also has to have at least DSM version 5.2-5644. Finally you have to have your web services operational on your DiskStation. This post describes the steps I took to let VirtualBox run on my DiskStation.

Installation

If your DiskStation meets all the requirements mentioned above, you can add the address http://spk.diablos-netzwerk.de to the repositories of your Package Center. You also have to enable the option to see beta packages in your Package Center; the VirtualBox package is still beta. When you finished this VirtualBox will show up in the available packages list of your Package Center. Just click the install button of VirtualBox and complete the wizard. Make sure you select the option to always authenticate when you logon to the management interface phpvirtualbox. This will be published on your web server you might have made available to the internet. If you select not to authenticate everyone has access to your management console and your virtual machines(!). The installation takes a while. It probably downloads additional files. When the installation is done you have to install the VirtualBox Extension pack

VirtualBox Extension pack

The extension pack installs support for USB 2.0 and USB 3.0 devices, VirtualBox RDP and PXE boot for Intel cards. The extension pack has to have the same version number as VirtualBox. If you installed VirtualBox version 5.0.16 you have to download version 5.0.16 of the Extension pack. The version of your VirtualBox is shown in the package center of your DuskStation. In this post version 5.0.16 is used in the examples.

All downloads can be found at http://download.virtualbox.org/virtualbox/. As you can see this folder has a all the history of VirtualBox. Change to the directory of the required version to find the Extension pack of your version. You are now able to reconstruct the URL of the file you need. The following steps guides you to the installation procedure of the extension pack:

  1. Stop all the running virtual machines in the management console of your VirtualBox installation.
  2. Stop VirtualBox in the Package Manager on your DiskStation.
  3. Open an SSH connection to your DIskStation as user ‘root’.
  4. Execute tho folowing commands in the SSH Terminal:
    cd /opt/VirtualBox
    wget http://download.virtualbox.org/virtualbox/5.0.16/Oracle_VM_VirtualBox_Extension_Pack-5.0.16.vbox-extpack
    ./VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-5.0.16.vbox-extpack
  5. Start VirtualBox in the Package Manager on your DiskStation.

This completes the installation tasks.

Configuration

You have to accomplish a couple of configurations before you should start using VirtualBox. The following paragraphs will show you what to configure.

Change admin password

The management interface is a web interface that can be accessed on http://[ip address or host name of your diskstation]/phpmyadmin. If the installation was successful you have to authenticate here with the default username/password combination admin/admin. As you can see this is an obvious combination that can be guessed or be found by everyone. The least you have to do is to change this accounts password to a strong one. Even better is to create a new administrator account with another username and a strong password and delete the default ‘admin’ account. You also want to consider a regular non-admin account for daily use of the phpmyadmin.

Secure the web interface

The management web interface phpmyadmin is a regular page that can be accessed from everywhere on the world if you made your webserver public accessible. It’s highly unlikely you want everybody having access to your virtual machines, because they also might gain access to your data. To avoid that you have to restrict the access to the management web interface. The first step was forcing to logon every time you want to access the management web interface.

Unfortunately the logon page is accessed through an unsecured http-session. This implies that the username and password you provide in the logon page is send in plain text to the webserver. This is vulnerable to eavesdropping. You can try to force the logon page to a secure https-session, but in my case this leads to errors. This makes why you don’t want to have the management web console accessible from the internet at all.

To deny the access from the internet you can use a .htaccess file in the folder on your webserver that hosts the VirtualBox management console. To do this you have to find the location where the management console is stored and create a textfile in this folder named .htaccess. (Be aware of the leading period in the filename.) The example below is a network based restriction. This means that all hosts from the given network have access, all other will be denied. A host with the ip address 192.168.1.100 will have access to the web management console, 192.168.1.24 too but all others outside the 192.168.1 network haven’t. Put the following lines in the just created .htaccess file and save the file. (Don’t use Windows Notepad.)

order deny,allow
deny from all
allow from 192.168.1.0/24

Now the management console is not accessible from the internet anymore. (Unless you use a VPN.) Now you can start creating virtual machines in VirtualBox. Be aware that Virtual machines are memory and cpu power consuming. A DiskStation is not primary designed to act as a full blown server. Don’t expect miracles from it when it comes to performance.

Guests

This section is not about how to install a guest operating system in VirtualBox. There are plenty sites elsewhere that describes just that. Besides that it is quiet intuitive to install a guest operating system. This section has some paragraphs on how to install the VirtualBox Guest Additions with drivers and software to let the guest operating system optimal as a guest system in VirtualBox. The web management console is not as mature a the management console you have when you install VirtualBox on a Windows system. Below are the descriptions per operating system I used. All descriptions are based on the VirtualBox Guest Additions ISO-file that can be downloaded from the same location as you downloaded the Extension Pack described earlier in this post. (For the example version of this post the location will be http://download.virtualbox.org/virtualbox/5.0.16/VBoxGuestAdditions_5.0.16.iso. Make sure you use the version that fits with your VirtualBox installation and save it somewhere where you can find it back; you’ll need this for almost every new guest operating system you install.)

In all cases connect the ISO file as a DVD to the guest operating system you want to install the VirtualBox Guest Additions to through the web management console before you start.

Debian/Ubuntu

  1. Open a TTY session in the virtual machine;
  2. Gain root access by typing the su command and pressing enter;
  3. Enter the root password and press enter;
  4. Update your APT database with apt-get update;
  5. Install the latest security updates with apt-get upgrade;
  6. Install required packages with apt-get install build-essential module-assistant;
  7. Configure your system for building kernel modules by running m-a prepare;
  8. run mount /media/cdrom if the ISO isn’t already mounted.
  9. Run sh /media/cdrom/VBoxLinuxAdditions.run, and follow the instructions on screen.

On this website there are several descriptions of how to create a virtual Synology DiskStation in VirtualBox. For every new release of DSM there was a new description. The reason to create these descriptions was that there was very little information about how to do this and the information was hard to find. Since then there became more and more sites that specialized them self in just this subject.

There are a couple of sites I use myself to figure out what to do to create a virtual DiskStation for testing purposes:

The descriptions there are more or less like those posted here. Making those descriptions is a couple of hours work and doesn’t bring any extras anymore. That’s why I decided not to create any new descriptions when a new release of DSM occurs. Instead of that you can visit the sources I use mentioned above.

The old descriptions will stay online and can be used for referential purposes. Most of the time the way to virtualize a new DSM more or less the same method of the previous version of DSM is being used. Feel free to use them to help you getting the newest version of DSM working.

Really soon after Synology’s release of DSM 5.2 the guys form XPEnology where able to release a DSM 5.2 that can be virtualized with VirtualBox. To obtain the bits to create a virtual DSM 5.2 you have to download the XPEnoboot boot image and the DSM 5.2 bits. Both can be found here at XPEnology.me

The installation description is the same as I wrote for the previous version: Synology Virtual DiskStation 5.1 with VirtualBox. You can start from the paragraph Preparing VirtualBox. Where in the article is being referred to the boot image by XPEnoboot_DS3615xs_5.1-5022.2.iso it must be replaced with the boot image you just downloaded. (XPEnoboot_DS3615xs_5.2-5565.2.iso).

In the paragraph Installing DSM 5.1 you are encouraged to use the installation method of DSM by downloading it from Synology by using the automatic installation. You also can choose for the Manual Installation. You are then able to use the DSM version downloaded from XPEnology.me.

When you also want to install updates for you virtual DSM then you have to restart your virtual DiskStation. In the boot menu of XPEnoboot you have to choose the option XPEnoboot 5.2-5565.1 Install/Upgrade at startup. After your virtual DIskStation is back online you can do a manual update through the Control Panel –> Update & Restore function of your virtual DiskStation. You can use the update file that also is available at the download location through XPEnology.me After the update is completed, you have to reboot to run your virtual DiskStation in normal mode again.

The description in this post leads to a working version of Synology DiskStation Manager 5.2. The intention of this post is to give you the opportunity to experiment with a DiskStation without risking your physical DiskStation. If you like DSM, consider buying one of their products http://www.synology.com/products/index.php?lang=enu

Source: XPEnology.me

A Virtual Synology DiskStation 5.2 is available. See here: Virtual Synology DiskStation 5.2 with VirtualBox

It took a while before the guys of XPEnology had figured out how to make version 5.1 of DSM working on other hardware than Synology’s. It must have been a tough job. Fortunately they announced a released of a new version of XPEnology witch is capable of running DSM 5.1. (Hurray)

Unfortunately, a couple of days later they felt that they have to withdraw the release because of major issues. It seems that the release looses it’s volumes, malfunctioning apps and widgets that does not work anymore after 12-24 hours of running. For the purpose of just testing something without jeopardizing your production DiskStation however this may not a big issue. I’ll keep monitoring the progress they make.

The description in this post leads to a working version of Synology DiskStation Manager 5.1. The intention of this post is to give you the opportunity to experiment with a DiskStation without risking your physical DiskStation. If you like DSM, consider buying one of their products http://www.synology.com/products/index.php?lang=enu

Prerequisites

You have to have a working installation of VirtualBox. You can download VirtualBox at https://www.virtualbox.org/wiki/Downloads. Make sure you also install the VirtualBox Extension Pack.

You also need the latest ISO of XPEnology. Due to the issues they have. it’s currently withdrawn from the regular download location. For as long as it lasts, you can download the required image (XPEnoboot_DS3615xs_5.1-5022.0.iso) from DropBox here. When the people of XPEnology have fixed the issues and released a new version, the link here will be altered accordingly. There is a new XPEnology boot image (XPEnoboot_DS3615xs_5.1-5022.2.iso) available that fixes the serious issues in the previous version. You can download it form here.

I managed to install the Virtual DSM webbased (http://find.synology.com). During this installation it will download the DSM software and start installation. If you insist of using the Synology Assistant or want to do a custom installation, you’ll need to download the DSM software for the DS3615xs here.

Preparing VirtualBox

Before you can start installing DSM, you’ll need to have a VirtualBox session in place. The next steps explain how to do that. It assumes you have installed VirtualBox and the extension pack.

Create the virtual machine

VirtualDSM51_01
Create a new Virtual Machine and make sure it’s type is Linux and has Linux 2.4 (64bit) as version. Click Next to continue.

VirtualDSM51_02
Give the virtual machine enough memory to use. 1024 MB (1 GB) is a good start. Click Next to continue.

VirtualDSM51_03
DO NOT add a virtual hard drive now. Click Create to create the new virtual Machine.

Configure the virtual machine

You have to configure the newly created virtual machine to make the virtual DiskStation work properly. The following steps describe how to do that.

VirtualDSM51_04
Open the settings of your newly created virtual machine.

VirtualDSM51_05
Select System and open the processor tab. Select the amount of CPU’s you want to use.

VirtualDSM51_06
Select Storage and attach the downloaded XPEnology ISO image (XPEnoboot_DS3615xs_5.1-5022.2.iso) to the DVD/CD player attached tot the IDE controller.

VirtualDSM51_07
Attach to the SATA controller the amount of ‘physical’ hard disks you want to use. A single disk will do if you just want to test some software. If you want to test stuff like SHR or RAID, then use multiple disks. Use disk sizes that suites your needs.

VirtualDSM51_08
The picture above shows three virtual ‘physical’ disks attached to the virtual machine.

VirtualDSM51_09
Select the Network section of the settings and select the first adapter. Set this adapter to Bridged Adapter. You can use more adapters if you want to by enabling Adapter 2 onwards.

Make sure you click the OK button to save the settings you just made.

You now are ready to start the virtual machine for the first time to install DSM 5.1.

VirtualDSM51_10
For installation purposes you have to select XPEnoboot 5.1-5022.0 Install/Upgrade. When the startup is done, you will see a login prompt. You are now ready to start the installation of DSM 5.1

Installation of DSM 5.1

There are several ways to start the installation DSM. The most enhanced way is to use Synology Assistant. Synology Assistant can be downloaded from Synology’s website. It’s also possible to do the installation with Synology Web Assistant. To start the web assistant just enter http://find.synology.com in the address bar of your favorite browser.

VirtualDSM51_11
Select the DiskStation you want to install (that is the one you just started in VirtualBox) if you have more DiskStations in your LAN. Click the Connect button.

VirtualDSM51_12
Click the Set up button to start the installation.

VirtualDSM51_13
You can do a manual installation if you want to. This gives you some options regarding the disk configuration. For simple testing you can use the common installation. Press the Install Now button.

VirtualDSM51_14
You have to confirm that all data on your virtual disk(s) will be destroyed. Check the checkbox and click OK to confirm that you are OK with this.

VirtualDSM51_15
Now the installation starts. During this installation the DSM software will be downloaded from Synology, the disks will be formatted and the DSM software will be installed. When the installation is done, it will reboot the virtual machine and returns with the screen below.

VirtualDSM51_16
By clicking the Next button the configuration of your DiskStation starts. You can create an Admin account, set a password for it and some other mandatory stuff to start using the DiskStation. After that you are ready to start using your virtual DiskStation with DSM 5.1.

The next step is to start configuring your volumes and start installing additional software if you want to.

Source: XPEnology.nl

Lately I discovered a package for Intel based DiskStations that installs a ‘headless’ VirtualBox with ‘phpVirtualBox’ as management console for DiskStations with a suitable 32/64-bit Intel processor. You probably need some extra GB of RAM memory to accommodate the virtual machine(s) and you’re good to go. (Check your DiskStations hardware here.)

You can find the package in the Italian Synology forum’s package center and make sure you enabled the Beta’s in your package center. You can download the 4.3.12 version directly here. The next thing to do is to install the package on your DiskStation via Package Center. It’s asking the following settings:

VirtualBoxSpk02
Enter your Admin password and set the checkboxes Enable advanced configuration and Enable startup of VM’s if you need these features and click Next.

VirtualBoxSpk03

Click Next.

 

VirtualBoxSpk04

Click Apply to start the installation of VirtualBox on your DiskStation.

The installation of this package installs a headless version of VirtualBox on your DiskStation and a web interface to be able to manage your virtual machines. This web interface can be reached at:

http://{Name or IP of your Diskstation}/phpvirtualbox

This website has an initial account of admin/admin use this to login and alter the password as soon as you are logged in. You also might want to secure this more if you are publishing a website from your DiskStation to the internet.

This post is not meant to explain how the management interface of VirtualBox works. The web interface works nearly exactly how the headed version of VirtualBox works. There are three things that needs attention in this specific situation: The remote desktop server port, the location of your virtual machines and the mouse and keyboard configuration.

Mouse and keyboard

You might run into problems that you are unable to use your keyboard or mouse in the virtual machine.

VirtualBoxSpk08

VirtualBox defines for each new virtual machine a PS/2 mouse and a PS/2 keyboard. You can change this in the settings of the virtual machine bij selecting the Input tab in General. Select an USB keyboard and an USB mouse and save the changes.

Location of the virtuals

By default VirtualBox stores the virtual machines in the home directory of the user that runs the VirtualBox software. In one of the first installation steps you had to enter the Admin password. This implies that the root account is running the software and that virtual machines are stored in the root’s home directory (/root/VirtualBox VMs). And that is a location you do NOT want to store large files from virtual machines. Sooner or later this will compromise the availability of your DiskStation, it fills the system partition!

VirtualBoxSpk07

The best thing to do is to create a new shared folder (i.e. VirtualMachines). This folder resides not in the systems partition. Open in the web interface the File menu and select Preferences… In General change the Default Machine Folder to the just created shared folder. (i.e. /volume1/VirtualMachines). Click OK to confirm the changes.

Remote desktop server port

Because the installation of VirtualBox is headless, you need a way to access the virtual machines remotely. Fortunately VirtualBox has a feature for this: VRPC. VRPC is downwards compatible with the Microsoft Remote Desktop client. VirtualBox also provides a broker that manages the access to the virtual machines. Therefor you need to give each virtual machine its own port in the Remote Display settings in the Display settings of the virtual machine.

VirtualBoxSpk05

By default VirtualBox assigns a range of  Server ports. (9000-9100) The downside of this is that it is not always certain what port will be assigned. This is inconvenient when you want to access the machine remotely without peeking into the web interface what port the virtual machine currently uses. By assigning a specific port for a specific machine, you will overcome this. You also have to enable the Server by setting the checkbox.

When you want to access a certain virtual machine you don’t target the machine you would like to work with, but the machine hosting the virtual machine with the Server port. (i.e. rpc://DiskStation:9000) The broker of VirtualBox makes sure you access the machine you want to.

VirtualBoxSpk06

The web interface shows the used port for each machine. You can click this to start the RPC session wit the given machine.

Don’t expect too much of the performance of the virtual machine. After all it’s a NAS running a hypervisor. It might become useful to have this feature.