15

In Ubuntu, Linux Mint and Korora, all I had to do was to load the image into the CD drive and it recognized it and asked if I wanted to run it. Everything worked seamlessly.

In elementary OS, when I load the CD image there is no prompt. I try running the .sh files, nothing.

What am I doing wrong and how do I fix it?

5 Answers 5

12

The VirtualBox extensions CD comes with an installation script VBoxLinuxAdditions.run that requires a terminal. There is a wrapper script autorun.sh that tries to open a terminal emulator and run VBoxLinuxAdditions.run inside it. It tries konsole, gnome-terminal and xterm (as of VirtualBox 4.3.28), but none of them are installed by default, so it gives up. The other distributions you tried probably have at least xterm or gnome-terminal, whereas elementary OS only has Pantheon Terminal (pantheon-terminal) in the default installation.

If you open the CD in Files, highlight autorun.sh and select “Run” in the menu, the errors complaining about the inability to run a terminal are written to the log file .xsession-errors in your home directory (along with a lot of other crap).

To install the VirtualBox extensions, first select “Install Guest Additions CD image” in the “Devices” menu of VirtualBox. Then open Pantheton Terminal and type the command

sudo /media/gilles/VBOXADDITIONS_4.3.28_100309/VBoxLinuxAdditions.run

Adjust the username and the VirtualBox version as suitable. You can save typing by using the shell's completion feature: press Tab after typing the beginning of a file or directory name to automatically insert the rest, if what you typed isn't ambiguous. For example, if you're the only user on your computer, you can type

sudo /meTab/Tab/VTab/VTabLTabEnter

If you no other removable media is currently inserted, you can even save the first V. And conversely if you have another removable media whose label begins with V you'll have to type more characters until that part is disambiguated. Similarly, if other users have currently-mounted removable media, you'll need to type enough of your username after the second / to be unambiguous.

1
  • Thanks for the reply. I tried all your suggestions including installing xterm. I would get as far as it asking for my password and I would get command unknown. after getting frustrated I shut everything down to cool off(me not comp). after a while I fired up and tried again, I doubleclicked on autorun.sh and low and behold everything installed.Thank You
    – Jazz58
    Jul 31, 2015 at 4:45
5

To install Guest Additions:(elementary OS as guest)

1.Close(shutdown) the elementay OS (guest)

2.Identify the location of VBoxGuestAdditions.iso .

(In Ubuntu /usr/share/virtualbox/VBoxGuestAdditions.iso)

3.Go to VirtualBox --> Settings --> Storage --> select Adds Optical Drive (green + with disk image) --> Add the location of .iso file.

Imgur

4.Now start the elementary OS guest and open File System , the you will see similar to the following image,

Imgur

5.Now open terminal and run

cd /media/[user_name]/VBOXADDITIONS_5.0.0_101573
ls

Here there will be VBoxLinuxAdditions.run. Now in terminal,

sudo ./VBoxLinuxAdditions.run

After installation restart the elementary OS guest.

4

After installing elementry OS, Once you’re rebooted and logged back in, go to the “Devices” menu on your virtual machine’s window and select “Insert Guest Additions CD image.”

Before installing them, install the dkms package:

sudo apt-get install dkms

Now you’ll want to mount the Guest Additions image. The easiest way is to open up Files from Slingshot application launcher and select it under “Devices” at the side.

Then open a terminal and cd (change the directory) to where the image is mounted, for example:

cd /media/VBOXADDITIONS_4.3.12_93733$ sudo ./VBoxLinuxAdditions.run

Now reboot.

1

Create a file with the following contents called install-vbox.sh in your home directory and run it by typing* bash ~/install-vbox.sh. It will download the .iso file of the current VirtualBox release (5.0.0) to your Downloads directory, check that the download is valid, mount the image and run the VirtualBox installer. And automatically restart your system afterwards.

#!/bin/bash
cd ~/Downloads/
if [ ! -f ./vbox-guest.iso ]; then
  wget -O ./vbox-guest.iso "http://download.virtualbox.org/virtualbox/5.0.0/VBoxGuestAdditions_5.0.0.iso"
fi
echo "8d9f1d600ff65d1230b9b4e386f2ad48 vbox-guest.iso" > ./vbox-guest.iso.md5
if [ ! "$(md5sum -c ~/Downloads/vbox-guest.iso.md5)" ]; then 
  echo "Failed to verify iso file"
  exit 1
fi
sudo mkdir /media/vbox-guest
sudo mount -o loop ./vbox-guest.iso /media/vbox-guest
cd /media/vbox-guest
if [ "$(sudo sh ./VBoxLinuxAdditions.run)" ]; then
  sleep 5
  sudo umount /media/vbox-guest
  sudo rmdir /media/vbox-guest
fi
echo "You may need to restart your system for the changes to take effect, run 'shutdown -r now'"

If the download got corrupted and the script is stopping with "Failed to verify iso file" then delete ~/Downloads/vbox-guest.iso and run the script again.

If it worked you can delete ~/Downloads/vbox-guest.iso, ~/Downloads/vbox-guest.iso.md5 and the script itself afterwards.


*: Alternatively you can make the script executable first from inside Files or by running chmod +x ~/install-vbox.sh. Then simply run the script from Files or by typing ~/install-vbox.sh in Terminal. But there is really no need as you won't be running it more than once.

3
  • You do not need to restart your system, and putting a forced restart in a script is obnoxious, it can lead to major data loss. Jul 31, 2015 at 18:04
  • Why do you recommend downloading the guest tools for version 5.0.0 rather than for whatever version (older or newer) the system is running in? Jul 31, 2015 at 18:05
  • You do need a reboot. That's why I put a warning in the script and a 15s delay before reboot. If you are very ignorant there is the danger of losing unsafed documents. And I am recommending the most current version, which right now is 5.0.0
    – quassy
    Jul 31, 2015 at 19:33
0

If you like me couldn't mount the cd through the file manager, this is the way I solved it.

I simply made the VBoxGuestAdditions.iso available on the local lan at the host (Mac OS Big Sur) by running python -m SimpleHTTPServer in the folder where the iso-file is at: /Applications/VirtualBox.app/Contents/MacOS/.

$ cd /Applications/VirtualBox.app/Contents/MacOS/
$ python -m SimpleHTTPServer

I then used the web browser on the guest os to fetch the iso-file to the guest-os (elementary os hera) http://10.0.2.2:8000 on my machine. Find the file and click to download.

I used netstat -rn on the guest to find the gateway ip to the host:

$ netstat -rn

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         10.0.2.2        0.0.0.0         UG        0 0          0 enp0s3
10.0.2.0        0.0.0.0         255.255.255.0   U         0 0          0 enp0s3
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 enp0s3

Finally I mounted the iso-file in the guest os:

sudo mount VBoxGuestAdditions.iso /mnt/host_download_mountpoint -o loop

And ran the script:

/mnt/host_download_mountpoint/VBoxLinuxAdditions.run

Success!

Not the answer you're looking for? Browse other questions tagged or ask your own question.