To install the virtualbox guest additions in the Debian, as Guest OS, inside Virtualbox, after inserting the guest additions CD.
Reason to create a script:
Creating the script:It makes using linux faster.
Code: Select all
# nano /root/myvboxguestadditions.sh
Code: Select all
It creates and uses the path "/mnt/cdrom", please edit the script if you have something else mounted on directly on /mnt
Theres no responsibility for any damage caused, in any way by this script.
Code: Select all
# chmod a+x myvboxguestadditions.sh
Code: Select all
# ./myvboxguestadditions.sh
Running OK on other Linux (right now):Please refer to the Official Documentation of Virtualbox.
Code: Select all
1. Devuan
2. Linux Mint
3. Open suse Tumbleweed
4. Ubuntu
# cat myvboxguestadditions.sh
Code: Select all
#!/bin/bash
#
# Author: Khurram M. <makhmct@hotmail.com>
# Script Version: 1.0
# Script type: Opensource
# Licensed: GPL v3
# Created on: 24 November 2017
# Last edited: 27 November 2017
#
# Tested to work on: VirtualBox 5.2, 64-bit
# Host: Arch Linux, kernel ver 4.13.12-1
# Guests: Debian 9.2, Devuan Ascii, Linux Mint 18.2, OpenSuse Tumbleweed 4.14,
# Not Tested on Guest OS: MacOS, Android, BSD, others
#
echo 'Checking if run as Root...'
if [[ $EUID -ne 0 ]]
then
echo "[ERROR] This script must be run as root."
echo "Exiting ..."
exit 1
else
echo "[OK] This script is run by the root."
fi
echo
echo 'Checking mount point...'
file1="/mnt/cdrom"
if [ ! -f "$file1" ]
then
echo "File $file1 does not exist."
echo 'Creating the Mount point...'
mkdir -pv /mnt/cdrom && echo '[OK] Mount point created ...'
else
echo "[OK] Mount point $file1 exists..."
fi
echo
echo 'Mounting the disk...'
mount -v /dev/sr0 /mnt/cdrom && echo '[OK] Disk Mounted ...'
echo
echo 'Installing the guest addition modules...'
echo
sh /mnt/cdrom/VBoxLinuxAdditions.run && echo '[OK] Guest additions installed ...'
echo
echo 'Umounting disk...'
umount -v /dev/sr0 && echo '[OK] Umount of disk is successful'
echo '[OK] Exiting the script ... Have a nice day! :) ... '
exit 1
Hope you enjoyed this script.
Thankyou
Edit:
1. Works fine currently, on Debian 10/Buster. Hope there are no issues at your end, too.
2. See my 4th post, below for Debian only, where it is added to cross check and add dependencies.
3. Tested Ok for Ubuntu also.
4. This does not applies to Desktop Linux: For CLI/TUI Linux (ie you are using no X windows on this machine), edit the code to:
Code: Select all
sh /mnt/cdrom/VBoxLinuxAdditions.run --noX11