How to install Guest Additions on Debian running VirtualBox

botond published 2019/01/06, v - 18:24 time

Content

 

Introductory

Ha VirtualBox, then it is highly recommended to install the integration services on the guest system, which ensures a higher degree of compatibility with virtual hardware. In this way, the guest system will be able to make better use of the available hardware resources.

In this description, I am running a 5.2 VirtualBox Debian 9 for minimal installation I’m going to put up guest integration services because it’s right at hand right now, but it can be installed on any machine with a desktop environment. Moreover, in their case, the thing has even more benefits e.g. due to video settings. However, the current guide only covers the VirtualBox Guest additions command line installation, so a console mode Debian 9 operating system will now be perfect.

The installation is a bit different from installing on a Windows guest system, but it's not complicated, let's see.

 

 

Installing Guest Additions

Log in to our Debian system running VirtualBox as root. I'm from an external terminal, SSHI recommend connecting through because integration services are not yet installed, so using the VirtualBox direct console is still inconvenient, eg. due to inappropriate mouse handling.

So, if we are root as root, the first round is always the usual one APT to start by updating the package manager database and packages:

apt-get update
apt-get upgrade

Then suppose you need the packages as well apt-get command:

apt-get install build-essential module-assistant

A build-essential package provides additional basic packages needed to build Debian packages, a module-assistant and the package will help you build the kernel modules.

Assemble the kernel modules:

m-a prepare

Then, in the VirtualBox window menu, click on the Tools main menu Installation of integration services option. At this point, nothing seems to be happening, but in the meantime VirtualBox has "inserted in the CD-ROM" the appropriate installation image, which (interestingly) is already visible with the lsblk command:

lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   60G  0 disk 
├─sda1   8:1    0   56G  0 part /
├─sda2   8:2    0    1K  0 part 
└─sda5   8:5    0    4G  0 part [SWAP]
sr0     11:0    1 55,3M  0 rom

So, the / dev / sr0 block device contains an 55 Mb medium. also attach the mount command:

mount /dev/sr0 /media/cdrom

 And it indicates that we can already use it as a read-only repository:

mount: /dev/sr0 is write-protected, mounting read-only

Enter the CDROM and list its contents:

cd /media/cdrom
ls -al

Here you will find many things:

r-xr-xr-x 6 root root     2226 nov    8 20:58 .
drwxr-xr-x 3 root root     4096 dec   19 15:09 ..
dr-xr-xr-x 2 root root      480 nov    8 20:58 32Bit
dr-xr-xr-x 2 root root      480 nov    8 20:58 64Bit
-r--r--r-- 1 root root      763 nov   28  2017 AUTORUN.INF
-r-xr-xr-x 1 root root     6384 nov    8 20:51 autorun.sh
dr-xr-xr-x 2 root root      792 nov    8 20:58 cert
dr-xr-xr-x 2 root root     2508 nov    8 20:58 OS2
-r-xr-xr-x 1 root root     4821 nov    8 20:51 runasroot.sh
-r--r--r-- 1 root root      449 nov    8 20:58 TRANS.TBL
-r-xr-xr-x 1 root root  7331277 nov    8 20:51 VBoxLinuxAdditions.run
-r--r--r-- 1 root root 16453120 nov    8 21:52 VBoxSolarisAdditions.pkg
-r-xr-xr-x 1 root root 16513936 nov    8 20:58 VBoxWindowsAdditions-amd64.exe
-r-xr-xr-x 1 root root   268496 nov    8 20:51 VBoxWindowsAdditions.exe
-r-xr-xr-x 1 root root 10317992 nov    8 20:52 VBoxWindowsAdditions-x86.exe

Of these, the VBoxLinuxAdditions.run we need a file, run the Bash via:

sh ./VBoxLinuxAdditions.run

This will run the program, build kernel modules, etc. And the correct output is:

Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.22 Guest Additions for Linux........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.  This may take a while.
update-initramfs: Generating /boot/initrd.img-4.9.0-8-amd64
VirtualBox Guest Additions: Starting.

After that, it is a good idea to perform a machine reboot after killing the kernel modules:

reboot

After the reboot, the difference is immediately striking, and with the higher resolution (800x600) the Debian console started in VirtualBox. And among the kernel modules are the VirtualBox guest modules:

Debian 9 (Stretch) - Checking for VirtualBox Integration Services (Guest additions)

If you are using a graphical desktop environment, if the guest system does not recognize your monitor's native screen resolution, must be added manually as described in this tutorial.

 

Conclusion

So we have taken a step towards more compatible hardware, so there is a chance that our server to be installed later will be more stable. And for machines with a graphical desktop environment, the thing is even more grateful, because newer screen resolutions come up, including (with a good chance) the native resolution of our monitor. If not, we will remedy this in another description.

 

 

Hozzászólások

For me this will be the output:

 

Uncompressing VirtualBox 6.0.6 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 6.0.6 of VirtualBox Guest Additions...
update-initramfs: Generating /boot/initrd.img-4.9.0-8-amd64
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 4.9.0-8-amd64.
update-initramfs: Generating /boot/initrd.img-4.9.0-8-amd64
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted

 




nothing will change after restarting

lsmod | grep vbox output:


vboxvideo              36864  0
vboxguest             327680  0
ttm                    98304  2 vboxvideo,vmwgfx
drm_kms_helper        155648  2 vboxvideo,vmwgfx
drm                   360448  6 vboxvideo,vmwgfx,ttm,drm_kms_helper

 

 

 

nobody wants to work somebody help me :(

mainly clipboard sharing, but full screen mode would not be a disadvantage either


(at the beginning the mount behal special device dev / sr0 does not exist with the error message but it still lists the content with ls and so as it seems VBoxLinuxAdditions.run runs)

However, the output does not appear to be defective.

I haven't tried this new 6 VirtualBox yet, but as soon as I have the time I will try and make another description.

I'm still updating 5.2, so I'll have to add 6 separately.

Probably a lot could have changed with the main version change.

For split clipboard, you might want to look at the settings (of course, if it looks similar in 6):

https://www.linuxportal.info/leirasok/alaprendszerek/hogyan-allitsuk-be-a-virtualbox-ot-az-alaprendszerek-szamara#altalanos

For full screen mode, try changing your video settings.

Unfortunately, I can't comment more on the 6 version, but I'll try it soon.