I just had a frustrating couple of hours trying to get remote desktop working for a Virtualbox guest.
First, even though the settings screen implies that you merely need to turn remote support on you must also have the virtualbox extension pack installed.
Secondly, if you get "connection refused" or similar errors from the rdesktop client then you are probably using virtualbox 5.0.40
It wasn't until I upgraded virtualbox to 5.1.16 that it just magically started working. grrr
Showing posts with label Virtualbox. Show all posts
Showing posts with label Virtualbox. Show all posts
Saturday, 26 August 2017
Virtualbox remote desktop
Friday, 21 July 2017
Booting Windows as either dual-boot physical machine or as a Virtual machine
How to boot Windows as either dual-boot physical machine or as a Virtual machine
Here is a scenario.
You have a Linux PC that you want to also dual boot to Windows. That's not hard to do right?
Unfortunately though, we all know dual booting is a bit of a pain when you just want to do something quick in Windows. You need to close everything you are doing in Linux just to boot into Windows.
One solution to that is to run Windows in a VM, that's been possible for years now right? Well the problem with that is that sometimes you need to run native Windows to say, play a 3D game.
You could maintain 2 Windows systems, one via dual-booting and the other as a VM but who wants to maintain two copies of Windows?
This is what I do.
Our starting point is a Linux system on one disk (/dev/sda). We will be installing Windows on to a separate disk that is currently empty (/dev/sdb)
You can check your disks using this command:
Let's get started!
In your Linux installation you want to add your user to the "disk" group:
Note: You will need to logoff and log back in again for this change to take effect.
Install Virtualbox:
Insert your Windows CD into the virtual machine (either as a physical CD or an ISO image).
Start the VM and go through the normal Windows installation process, then log into Windows.
Open the registry editor. Edit the following keys and set them all to 0:
Shutdown the VM
You will need to add your Windows disk to grub:
Once you are in Windows, you will have to do all the usual driver installs etc but you already knew that right?
Have fun!
Note: Tested with Ubuntu 16.04.1 host and Windows 7/10 guests
Here is a scenario.
You have a Linux PC that you want to also dual boot to Windows. That's not hard to do right?
Unfortunately though, we all know dual booting is a bit of a pain when you just want to do something quick in Windows. You need to close everything you are doing in Linux just to boot into Windows.
One solution to that is to run Windows in a VM, that's been possible for years now right? Well the problem with that is that sometimes you need to run native Windows to say, play a 3D game.
You could maintain 2 Windows systems, one via dual-booting and the other as a VM but who wants to maintain two copies of Windows?
This is what I do.
Our starting point is a Linux system on one disk (/dev/sda). We will be installing Windows on to a separate disk that is currently empty (/dev/sdb)
WARNING: If you muck this up you can destroy all the data on your Linux system. Make sure you have backups of everything and you are abso-fricking-lutely sure you have identified the correct drive devices
You can check your disks using this command:
sudo fdisk -l
For the remainder of this tutorial I will be using /dev/sdb for the drive that will host Windows 7.Let's get started!
In your Linux installation you want to add your user to the "disk" group:
sudo usermod -a -G disk brettg
This allows your user to access the physical drive that Windows 7 is installed on.Note: You will need to logoff and log back in again for this change to take effect.
Install Virtualbox:
sudo apt install virtualbox
Create a place for your Virtualbox disk images:
mkdir -p $HOME/VirtualboxImages/
Create a new virtual disk that references the physical drive that Windows 7 will be installed on:
VBoxManage internalcommands createrawvmdk -filename $HOME/VirtualboxImages/Windows7.vmdk" -rawdisk /dev/sdb
Open up Virtualbox and create a new virtual machine selecting "Use an existing virtual harddisk file" when you are setting it up.Insert your Windows CD into the virtual machine (either as a physical CD or an ISO image).
Start the VM and go through the normal Windows installation process, then log into Windows.
Open the registry editor. Edit the following keys and set them all to 0:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\atapi\Start
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\intelide\Start
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\pciide\StartThis forces Windows to install and load three types of disk drivers at boot. (I don't know why you need to set these to zero). By default it just installs the driver that was needed at install time. This is requireed because when we try and boot Windows later it will not be able to read the disk because it doesn't have the proper driver for it.
Shutdown the VM
You will need to add your Windows disk to grub:
sudo update-grub
Now, hopefully if everything went according to plan you should be able to reboot and find Windows listed in your grub menu. Select that and boot into Windows.Once you are in Windows, you will have to do all the usual driver installs etc but you already knew that right?
Have fun!
Note: Tested with Ubuntu 16.04.1 host and Windows 7/10 guests
Friday, 4 June 2010
USB Devices in VirtualBox guests
Prerequisites:
Oracle version of Virtualbox (The OSE version found in the standard repository does not support USB)
Virtualbox extension pack
Virtualbox guest tools
Member of the vboxusers group
Note: It is usually not necessary to add the USB device from the command line as described here. As long as the above prerequisites are met you can usually use the gui to add device filters.
I want to connect an external HDD to a virtualbox guest. The unit is a WD "My Book" and the guest is named "Windows". Make sure your VM is powered off before you start!
First, check that your user is a member of the vboxusers group:
Note: If you aren't a member of the vboxusers group you must add yourself, logout and login again for the changes to take.
On the host running VirtualBox run the following command:
Find the section that relates to the device you want to use. In my case it looks like this:
Add a usb filter using the device details gleaned from the previous command:
The number after the "add" is the index number, if this is not the first device on the guest then adjust to the next "free" index. You can see the devices currently associated with a guest using this command:
Finally enable usb for the guest:
Now, after starting your VM, you should be able to see that the usb device is present in the virtual machine.
Note: If you have this working and it suddenly stops working, possibly after an update check that you still belong to the vboxusers group. If you don't belong to that group then no devices will show but there will be no "permisison denied" errors that might help to explain why.
UPDATED: November 2018
Oracle version of Virtualbox (The OSE version found in the standard repository does not support USB)
Virtualbox extension pack
Virtualbox guest tools
Member of the vboxusers group
Note: It is usually not necessary to add the USB device from the command line as described here. As long as the above prerequisites are met you can usually use the gui to add device filters.
I want to connect an external HDD to a virtualbox guest. The unit is a WD "My Book" and the guest is named "Windows". Make sure your VM is powered off before you start!
First, check that your user is a member of the vboxusers group:
groups | grep vboxusers
myuser adm disk cdrom sudo dip plugdev lpadmin sambashare vboxusers libvirt
Note: If you aren't a member of the vboxusers group you must add yourself, logout and login again for the changes to take.
On the host running VirtualBox run the following command:
sudo VBoxManage list usbhost
Find the section that relates to the device you want to use. In my case it looks like this:
UUID: f61de8f1-9c92-4781-92c5-d091705a0b79
VendorId: 0x1058 (1058)
ProductId: 0x1100 (1100)
Revision: 1.117 (01117)
Manufacturer: Western Digital
Product: My Book
SerialNumber: 57442D574341565930303934373837
Address: sysfs:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-4//device:/dev/bus/usb/001/003
Current State: Busy
Add a usb filter using the device details gleaned from the previous command:
VBoxManage usbfilter add 0 --target Windows --vendorid 1058 --productid 1100 --name "2TbExt" --active yes
The number after the "add" is the index number, if this is not the first device on the guest then adjust to the next "free" index. You can see the devices currently associated with a guest using this command:
VBoxManage showvminfo Windows
Finally enable usb for the guest:
VBoxManage modifyvm Windows --usb on
Now, after starting your VM, you should be able to see that the usb device is present in the virtual machine.
Note: If you have this working and it suddenly stops working, possibly after an update check that you still belong to the vboxusers group. If you don't belong to that group then no devices will show but there will be no "permisison denied" errors that might help to explain why.
UPDATED: November 2018
Labels:
bionic. 18.04,
headless,
linux,
passthru,
ubuntu,
usb,
Virtualbox
Tuesday, 11 May 2010
HOWTO: VirtualBox "headless" on Lucid Lynx
As of karmic koala, Vbox 3.x is provided via the standard Ubuntu repositories. Unfortunately, this is the OSE version and it does not appear to work headless.
So, we have to download the "free as in beer" version from the Oracle website, which is currently here
At the time of writing the current build for Lucid is virtualbox-3.2_3.2.4-62467~Ubuntu~lucid_i386.deb
Before we can install the deb, we will also need to install some dependencies.
Now we can install the virtualbox deb that we downloaded earlier.
Next, add your user account to the vboxusers group
Virtualbox machines that you create will by default go in your home directory
Ensure vboxusers have appropriate permissions to the kernel, create the file;
/etc/udev/rules.d/40-permissions.rules
That's it, Virtualbox should be installed and ready to go.
Now we can move on to creating a virtual machine
Create a machine named "io"
Configure it with a nic bridged to eth0, 256Mb RAM, enable acpi and set to boot from DVD
Create a virtual IDE controller
Create a virtual HDD
Attach the virtual HDD
Create and attach a virtual DVD drive to the controller and insert the DVD image
The default vrdp port for machines is 3389, however, if you intend to run more than one guest then each one will need to listen on a different port. I use the 3xxx range with the xxx being the last octet of the machines IP address. For example, 192.168.0.1 would be 3001.
And thats it, your machine has been created. Time to start it up and give it a test drive!
Using the virtual machine
Start the machine
On a GUI workstation, establish a remote desktop connection to the machine. In my case, the host server is called "jupiter" so I type;
After you have installed the OS, you need to tell the machine to boot from the hdd.
You can also deregister the dvd image if you don't intend to use it again.
Here are some other useful commands;
So, we have to download the "free as in beer" version from the Oracle website, which is currently here
At the time of writing the current build for Lucid is virtualbox-3.2_3.2.4-62467~Ubuntu~lucid_i386.deb
Before we can install the deb, we will also need to install some dependencies.
sudo apt-get install libcurl3 dkms libqt4-network libqtgui4 libxslt1.1 libasound2 \
libdirectfb-1.2-0 libgl1-mesa-dri libgl1-mesa-glx libqt4-opengl libsdl1.2debian \
libsdl1.2debian-alsa libsysfs2 libts-0.0-0 libxcursor1 linux-headers-`uname -r` \
libxdamage1 libxfixes3 libxmu6 libxxf86vm1 tsconf libqtcore4 libaudio2 libmng1
Now we can install the virtualbox deb that we downloaded earlier.
sudo dpkg -i virtualbox-3.2_3.2.4-62467~Ubuntu~lucid_i386.deb
Next, add your user account to the vboxusers group
sudo adduser brettg vboxusers
Virtualbox machines that you create will by default go in your home directory
/home/brettg/.VirtualBox/
Ensure vboxusers have appropriate permissions to the kernel, create the file;
sudo vi /etc/udev/rules.d/40-permissions.rules
/etc/udev/rules.d/40-permissions.rules
KERNEL=="vboxdrv", GROUP="vboxusers", MODE="0660"
That's it, Virtualbox should be installed and ready to go.
Now we can move on to creating a virtual machine
Create a machine named "io"
VBoxManage createvm -name io --ostype Ubuntu -register
Configure it with a nic bridged to eth0, 256Mb RAM, enable acpi and set to boot from DVD
VBoxManage modifyvm io --memory 256 --pae on --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0
Create a virtual IDE controller
VBoxManage storagectl io --name IDE0 --add ide
Create a virtual HDD
VBoxManage createvdi -filename ~/.VirtualBox/Machines/io/sda.vdi -size 48000 -register
Attach the virtual HDD
VBoxManage storageattach io --storagectl IDE0 --port 0 --device 0 --type hdd --medium ~/.VirtualBox/Machines/io/sda.vdi
Create and attach a virtual DVD drive to the controller and insert the DVD image
VBoxManage storageattach io --storagectl IDE0 --port 1 --device 0 --type dvddrive --medium /store/archive/ISO/ubuntu-10.04-server-i386.iso
The default vrdp port for machines is 3389, however, if you intend to run more than one guest then each one will need to listen on a different port. I use the 3xxx range with the xxx being the last octet of the machines IP address. For example, 192.168.0.1 would be 3001.
VBoxManage modifyvm io --vrdpport 3001
And thats it, your machine has been created. Time to start it up and give it a test drive!
Using the virtual machine
Start the machine
nohup VBoxHeadless -startvm io &
On a GUI workstation, establish a remote desktop connection to the machine. In my case, the host server is called "jupiter" so I type;
rdesktop -a 8 jupiter:3001
After you have installed the OS, you need to tell the machine to boot from the hdd.
VBoxManage modifyvm io --boot1 disk
You can also deregister the dvd image if you don't intend to use it again.
VBoxManage unregisterimage dvd /store/archive/ISO/ubuntu-10.04-server-i386.iso
Here are some other useful commands;
VBoxManage showvminfo io
VBoxManage list hdds
VBoxManage list runningvms
VBoxManage controlvm io poweroff
VBoxManage unregistervm io --delete
VBoxManage controlvm io savestate
VBoxManage closemedium disk UUID
VBoxManage modifyhd UUID --type immutable
Tuesday, 4 August 2009
Virtualbox3 Headless with Bridged Networking
Note: This howto is now outdated due to changes introduced in Virtualbox 3.1x
See this post for an updated version.
As of karmic koala, Vbox 3 is provided via the standard Ubuntu repos. Unfortunately, this is the OSE version and it does not appear to work headless.
So, we have to download the "free" version from the Sun (soon to be Oracle?) website, which is currently here
At the time of writing there was no Karmic build, so I used the Jaunty package (virtualbox-3.0_3.0.4-50677_Ubuntu_jaunty_i386.deb)
Before we can install the deb, we will also need to install some dependencies.
Now we can install the virtualbox deb that we downloaded earlier.
NOTE: When I installed this for the nth time I received the following error:
Next, add your user account to the vboxusers group
Virtualbox machines that you create will by default go in your home directory
Ensure vboxusers have appropriate permissions to the kernel
/etc/udev/rules.d/40-permissions.rules
Creating a virtual machine
Create a machine named "io"
Configure it with a nic bridged to eth0
Create a virtual DVD link called "dvd" to an ISO image on the server
Connect the DVD to the virtual machine
Assign "io" 128Mb RAM, enable acpi and set to boot from DVD
Create an 8Gb virtual HDD named "io-sda.vdi"
Assign that Virtual Drive Image to "io"
Because we are installing Ubuntu Server as a guest we need to enable PAE
Using the virtual machine
Start the machine
On a GUI workstation, establish a remote desktop connection to the machine
Congratulations, you are now up and running!
After you have installed the OS, you need to remove the DVD and instruct the machine to boot from the hdd.
You can also deregister the dvd image if you don't intend to use it again.
Note: When I installed Ubuntu Server the network autodetection didn't work. After installation was completed there was no eth0 present. I simply added the following to /etc/network/interfaces
and was then up and running
Other useful commands;
See this post for an updated version.
As of karmic koala, Vbox 3 is provided via the standard Ubuntu repos. Unfortunately, this is the OSE version and it does not appear to work headless.
So, we have to download the "free" version from the Sun (soon to be Oracle?) website, which is currently here
At the time of writing there was no Karmic build, so I used the Jaunty package (virtualbox-3.0_3.0.4-50677_Ubuntu_jaunty_i386.deb)
Before we can install the deb, we will also need to install some dependencies.
sudo apt-get install python2.5 libcurl3 dkms libqt4-network libqtgui4 libxslt1.1
Now we can install the virtualbox deb that we downloaded earlier.
sudo dpkg -i virtualbox-3.0_3.0.4-50677_Ubuntu_jaunty_i386.deb
NOTE: When I installed this for the nth time I received the following error:
virtualbox-3.0.postinst: 118: /etc/init.d/vboxdrv: not found
I'm not sure if this was due to my previous installations of different versions or not. I figured it was so ignored it and things seemed to be OK. Of course YMMV.Next, add your user account to the vboxusers group
sudo adduser brettg vboxusers
Virtualbox machines that you create will by default go in your home directory
/home/brettg/.VirtualBox/
Ensure vboxusers have appropriate permissions to the kernel
sudo vi /etc/udev/rules.d/40-permissions.rules
/etc/udev/rules.d/40-permissions.rules
KERNEL=="vboxdrv", GROUP="vboxusers", MODE="0660"
Creating a virtual machine
Create a machine named "io"
VBoxManage createvm -name io -register
Configure it with a nic bridged to eth0
VBoxManage modifyvm io --nic1 bridged --bridgeadapter1 eth0
Create a virtual DVD link called "dvd" to an ISO image on the server
VBoxManage registerimage dvd /store/archive/ISO/ubuntu-8.04-server-i386.iso
Connect the DVD to the virtual machine
VBoxManage modifyvm io -dvd /store/archive/ISO/ubuntu-8.04-server-i386.iso
Assign "io" 128Mb RAM, enable acpi and set to boot from DVD
VBoxManage modifyvm io -memory 128MB -acpi on -boot1 dvd
Create an 8Gb virtual HDD named "io-sda.vdi"
VBoxManage createvdi -filename io-sda.vdi -size 8000 -register
Assign that Virtual Drive Image to "io"
VBoxManage modifyvm io -hda io-sda.vdi
Because we are installing Ubuntu Server as a guest we need to enable PAE
VBoxManage modifyvm io -pae on
Using the virtual machine
Start the machine
VBoxHeadless -startvm "io" &
On a GUI workstation, establish a remote desktop connection to the machine
rdesktop -a 16 io:3389
Congratulations, you are now up and running!
After you have installed the OS, you need to remove the DVD and instruct the machine to boot from the hdd.
VBoxManage modifyvm "io" -dvd none
You can also deregister the dvd image if you don't intend to use it again.
VBoxManage unregisterimage dvd /store/archive/ISO/ubuntu-8.04-server-i386.iso
Note: When I installed Ubuntu Server the network autodetection didn't work. After installation was completed there was no eth0 present. I simply added the following to /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
and was then up and running
Other useful commands;
VBoxManage showvminfo io
VBoxManage list hdds
VBoxManage list runningvms
VBoxManage controlvm io poweroff
VBoxManage controlvm "io" savestate
Subscribe to:
Posts (Atom)