Install Virtual machine problem

Hello, I wanted to install virtual machine. So I installed “KVM software” from YaST. Then I continue installing Virtual machine from

https://en.opensuse.org/SDB:VirtualBox_Installation

I did steps required, but, when I did:

/etc/init.d/vboxdrv setup

I got message:

bash: /etc/init.d/vboxdrv: No such file or directory

What wrong I made?

Thank you for answering my questions.

Frst, please copy/paste the command and all output in one pice of CODE. Not in a piece of CODE and a piece of QUOTE!

I did not read that documentation, but I assume it may be old.
In any case /etc/initrd is not used anymore, openSUSE switched from SysVinit to systemd already a long time ago.

Hello, I wanted to install virtual machine. So I installed “KVM software” from YaST. Then I continue installing Virtual machine from

KVM is not virtualbox.
Install:

zypper in virtualbox virtualbox-kmp-default virtualbox-qt

Also add your user to the vboxusers group:

Open YaST, authenticate as root, and then go to Security and Users –> User and group management. Select your username from the list, then click Edit to make a username modification. Go to the tab named Details, then tick the group ‘vboxusers’ in order to add your username to that group. Make sure to reboot at this moment in order for changes to take effect.

After that, reboot your Computer.

Expanding on this a bit for the benefit of a virtualization newbie…

There are many different virtualization technologies… KVM, Xen, Virtualbox, VMware, Hyper-V and there are also “isolation” technologies which are not quite the same but share many characteristics which include Docker, LXC, kubernetes(kubic is the SUSE/openSUSE flavor), systemd-nspawn. People can post in the Forum about any of these technologies and probably some others that don’t come to mind immediately.

openSUSE supports all of the above listed except Hyper-V installed as a HostOS (the base machine upon which you install Guest virtual machines).
openSUSE can be installed as a virtual machine is all the listed above without exception.

You’ve already experienced installing virtualization using the YaST module, but that only installs the “Enterprise” virtualization technologies KVM, Xen and LXC.
For this installation you can learn more about what you’ve installed in the following openSUsE documentation. In general, whatever is most current LEAP documentation also works for Tumbleweed

https://doc.opensuse.org/documentation/leap/virtualization/single-html/book.virt/

For most home Users and especially for your first introduction to virtualization, the Enterprise virtualization technologies might be a bit difficult to learn. The documentation and tools generally assume familiarity with virtualization in general.
Instead Virtualbox is a common and recommended virtualization for Users new to virtualization, the tools and setup are more user-friendly.
On openSUSE, a pre-compiled version of Virtualbox can be installed which simplifies the installation experience. All you need to do is install the packages using the command @Saurland provided. When install from the openSUSE repositories you should update your Virtualbox as just another application from the openSUSE repositories by periodically doing a system update.
The other way to install Virtualbox is how it’s usually done on other distros, which is to download the installation from the Oracle Virtualbox website, install your dependency requirements, and then run the installation. For a User new to installing 3rd party apps on Linux, there are ways to go wrong.
Although it’s important to understand how each installation works so you can keep your system clean by updating according to the install,
Once installed you use Virtualbox the same way.
Following is the Virtualbox online documentation

https://www.virtualbox.org/manual/

If you have any other questions, just post.
And, welcome to openSUSE.

TSU

If you are using VirtualBox and want to use USB ports with the virtual machine, you will need to install the VirtualBox Extension Package.

It is not installed via zypper - you have to download it and it installs best if VirtualBox host is not running when you do this.

Here is a script that will install the Extension Pack for you after you have VirtualBox installed. It has to run as root (sudo) don’t forget to chmod it to 755 or you can just
“sudo sh addvbext” to run it.

# cat addvbext
vbv=`/usr/bin/VBoxManage --version | tr "r" "_"`
echo update VirtualBox
VBOX_VERSION=`/usr/bin/VBoxManage --version | awk -F_ {'print $1'}`
VBOX_EXT_VERSION=`/usr/bin/VBoxManage --version | awk -F_ {'print $1'}`
VBOX_EXT=`echo Oracle_VM_VirtualBox_Extension_Pack-${VBOX_EXT_VERSION}.vbox-extpack`
cd /tmp
/usr/bin/wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/$VBOX_EXT
echo y | /usr/bin/VBoxManage extpack install --replace $VBOX_EXT
rm -f $VBOX_EXT

USB in Virtualbox have to enabled in the OSS-virtualbox:
https://en.opensuse.org/VirtualBox
You have to change an xxx-vboxdrv.rules file.
Copy the rule from /usr/lib/udvev/rules.d to /etc/udev/rules.d:
as root:

cp /usr/lib/udev/rules.d/??-vboxdrv.rules /etc/udev/rules.d/

Change the rule as described in the wiki.

I have never had to do any of the suggestions on the https://en.opensuse.org/VirtualBox site - the suggestions for the guest additions is also wrong.

I use the standard repos for installing VirtualBOX on the host and remove virtualbox-kmp-default on the OpenSUSE guests everytime it updates as it seems to cause black screen of death in OpenSUSE guests. No issues with the version that Ubuntu and Mint Linux have as they seem to not have the black screen problem.

You have to install a USB drivers in the VB configuration to have it work in the guest as well as the Extension Pack - you have 3 choices - USB 1.1, USB 2, or USB 3. If you have an old OS like Windows 98, then USB 2 is the fastest it can support.

I have used VirtualBOX since 1999, I have over 30 guests running on 7 OpenSUSE laptops - I started with CentOS and switched to OpenSUSE when Walmart switched from Redhat to SLES 11.

For OpenSUSE Guest - no guest additions are needed if using the Extension Pack as installed by my script. Both 15.2 and Tumbleweed run fine and seamless without and guest additions. You do have to set up your own video resolutions scripts if you do not like what VMSVGA driver for Linux supports.

For Windows Guests - The Menu > Device > Install Guest Additions works fine in VB 6.1.xx.

USB-passthru is disabled by default:

#!/bin/bash
# script to disable USB passthru in /etc/udev/rules.d/60-vboxdrv.rules
# if already disabled, clear the comment character
sed -i 's/#SUBSYSTEM==\"usb/SUBSYSTEM==\"usb/' /etc/udev/rules.d/60-vboxdrv.rules
# now comment the usb lines
sed -i 's/SUBSYSTEM==\"usb/#SUBSYSTEM==\"usb/' /etc/udev/rules.d/60-vboxdrv.rules


install -m 0755 %{SOURCE18} %{buildroot}/sbin/vbox-fix-usb-rules.sh

I stand corrected - I never tried using the USB in OpenSUSE guest - It does need the fix.

It works fine in the Mint Guest. The only Linux guest I have ever tried it in.

It is sad that you have to build the OSE version to get the /etc/udev/rules.d/60-vboxdrv.rules file.

Just tried it in Ubuntu 10.04 guest - the usb camera was seen by cheese.

only adding vboxuser user to kernel in /etc/udev/rules.d on Ubuntu

This is what Ubuntu uses - I added it to OpenSUSE and the USB seems to work - lsusb shows the devices I attached to the guest.

> cat 60-vboxadd.rules
KERNEL=="vboxguest", NAME="vboxguest", OWNER="vboxadd", MODE="0660"
KERNEL=="vboxuser", NAME="vboxuser", OWNER="vboxadd", MODE="0660"
>

My fault, editing the rule is not necessary anymore, the User is asked by virtualbox:

rpm -ql --changelog virtualbox-qt | grep -i rule
  Linux guests: udev rules for guest kernel modules did not always take effect in time
  60-vboxdrv.rules in /usr/lib/udev/rules.d, not /etc/udev/rules.d
  Previously, a user needed to edit a udev rule to disable passthru. The bad part was that an update of VB changed the
  rule back to allow passthru without any notification. These changes modify the popup to allow the user to accept or decline
  passthru. If the user declines, then the root password is requested and the udev rule is modified. As these modifications will be
  lost with the next VB update, the inode of the udev rule is kept. If the user has previously declined and the inode has changed,
  the popup will show the next time VB is started. File "fix_usb_rules.sh" is added.
    Linux Additions: properly install the Linux kernel module override rule on distributions without /etc/depmod.d
  insecure usage. In any case, that screen will only be printed once. File "virtualbox-60-vboxdrv.rules" has been added
    Linux Additions: fixed Linux kernel module override rule (thanks Mark Furneaux)

But the openSUSE file has another content:

cat /usr/lib/udev/rules.d/60-vboxdrv.rules 
KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"
KERNEL=="vboxdrvu", NAME="vboxdrvu", OWNER="root", GROUP="root", MODE="0666"
KERNEL=="vboxnetctl", NAME="vboxnetctl", OWNER="root", GROUP="root", MODE="0600"
SUBSYSTEM=="usb_device", ACTION=="add", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
SUBSYSTEM=="usb_device", ACTION=="remove", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor"
SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor"

A FYI I don’t seem to see posted by anyone on the Internet…
If you want to avoid the USB pass-through setup and issue where only one VM or the Host can “own” the USB device at a time…

I’ve been using Shared Folders to access the HostOS filesystem.
When you do this, the Guest has full read/write access to the Shared Folder location without altering access by the HostOS.

And,
You should be able to set up your Shared Folder without granting the Guest direct access to the USB device.
Of course, the Shared Folder points to an anchor point in the HostOS filesystem which can be almost anywhere including on USB attached storage.

This “USB passthrough” issue is common to all virtualization technologies although can be handled differently… eg VMware allows the ownership of the USB device to be captured automatically just by clicking on a given VM(ie ownership is tied to focus), and this “Shared Folder” method should work in all technologies, not just Virtualbox.

TSU