1

I have a live persistent USB for Ubuntu 16.04 that I created using mkusb and it gives me exactly what I was wanting: a portable ubuntu that I can use across more than one laptop.

I am not able to get VirtualBox to work after multiple unsuccessful attempts. Upon installing I get a message saying

vboxdrv.sh: failed: modprobe vboxdrv failed. Please use 'dmesg' to find out why.

There were problems setting up VirtualBox. To re-start the set-up process, run /sbin/vboxconfig as root.

Running dmesg gives a long wall of text. I can pull out any parts of it if that would help.

I run

sudo /sbin/vboxconfig

and get

vboxdrv.sh: Stopping VirtualBox services. vboxdrv.sh: Building VirtualBox kernel modules. vboxdrv.sh: Starting VirtualBox services. vboxdrv.sh: Building VirtualBox kernel modules. vboxdrv.sh: failed: modprobe vboxdrv failed. Please use 'dmesg' to find out why.

There were problems setting up VirtualBox. To re-start the set-up process, run /sbin/vboxconfig as root.

When I run virtualbox I get this message:

WARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (4.13.0-36-generic) or it failed to load. Please recompile the kernel module and install it by

       sudo /sbin/vboxconfig

     You will not be able to start VMs until this problem is fixed.

I notice that my /boot folder has a broken link for vmlinuz

I found my way to this issue: VirtualBox + Secure Boot + Ubuntu = Fail. Its summary is:

The problem is the requirement that all kernel modules must be signed by a key trusted by the UEFI system, otherwise loading will fail.

Create a personal public/private RSA key pair which will be used to sign kernel modules.

Use the MOK (“Machine Owner Key”) utility to import the public key so that it can be trusted by the system.

Reboot the machine. When the bootloader starts, the MOK manager EFI utility should automatically start.

Edited to add: Boot issues, shim, and vmlinuz are all new to me (in case my use of these terms makes it sound like I know what I'm talking about!).

I followed the steps given there and ran into the same problem described in this issue: Mok Manager Utility Never Loads on Reboot. The solution there was to change the boot order so that the boot that relies on shim is first. It seems that solution is intended for installed ubuntu.

I have neither the /boot/efi/EFI folder, nor the efi files for which the solution asks. Also, I think my boot process for launching the Live Persistent USB (described below) would never see the shim.

To boot, I power down the laptop. I press a special button that powers on the laptop and launches a menu that gives these options:

1) Start normally (which would launch Windows 10), 2) Bios Setup, 3) Boot menu, 4) Recovery.

I select Boot menu. That lets me choose between Windows, Installed Ubuntu (if it's a laptop that has Ubuntu installed on it), and the USB. I choose USB, and then choose Live Persistent USB from the menu I then get.

I notice that the OP there has currentboot at top of boot order. My currentboot is 3rd in the boot order and I bypass the boot order as described above. While I have shim in the Ubuntu that is installed on that laptop, my process would never see it.

I am going to continue to play with it. I thought I would also reach out here. Has anyone successfully installed VirtualBox on a live persistent USB? Or do you have any suggestions for what to check and try?

  • 1
    If you need VBox on a Persistent, (frugal), USB install, it works OK with Puppy Linux and sets up automatically. I do have VBox working on a Full Ubuntu install to USB. – C.S.Cameron Mar 18 '18 at 15:20
  • 1
    I made a Persistent USB using mkusb and installed VBox from the repositories. I rebooted both the virtual machine and the USB several times, it seems to work fine to me. – C.S.Cameron Mar 19 '18 at 02:42
  • @C.S.Cameron; Which version of Ubuntu did you use as host, and which operating system did you try as guest operating system? – sudodus Mar 19 '18 at 06:39
  • @sudodus: Ubuntu17.10 / Ubuntu16.04.3 then 16.04.3 / 16.04.3 all 64bit – C.S.Cameron Mar 19 '18 at 15:55
  • @C.S.Cameron, Today I tested an Artful dot one host, Lubuntu 17.10.1 (64-bit) and it can handle guest versions 16.04.1, 17.10 and also Bionic (to be released soon as 18.04 LTS). See details at this link to the Ubuntu Forums. – sudodus Mar 19 '18 at 16:41

2 Answers2

1

There may be problems to run VirtualBox in persistent live Ubuntu

The installation of VirtualBox involves compiling some parts of it into the linux kernel. This works well in installed systems.

A persistent live system is booted with the original kernel, and the overlay system, that takes care of the persistence is doing its job later. For this reason I suspect that it can be difficult to make VirtualBox work well in a persistent live system. Maybe it is possible with some other tool for virtualization, but I have no previous experience of it.

If there are problems with secure boot, I suggest that you turn it off.

Lubuntu host and Lubuntu guest

I tested with a Lubuntu 16.04.1 LTS 64-bit host and a Lubuntu 16.04.1 LTS 32-bit guest (because Lubuntu is lighter than standard Ubuntu).

sudo apt update
sudo apt install virtualbox

It worked directly after installation, but I had problems with the graphic rendering after reboot. Maybe it can be made stable with some setting and for example some guest additions or similar.

Click on the screenshot and view it in a big enough window to see it at full size.

enter image description here

After reboot I had problems when starting from a terminal window with the command

virtualbox

but after reboot, there is a menu entry, and when I started VirtualBox that way, the graphic rendering of the Lubuntu desktop worked. But trying once more failed, so the graphics rendering is flaky.

Anyway, the installation worked without issues, and the overall result was better than I expected.

Lubuntu host and Xubuntu guest

The graphics of the virtualized system seems to work better with a Xubuntu 64-bit guest (than with a Lubuntu 32-bit guest). So I think that the previous problem was not caused by running VirtualBox in a persistent live system.

enter image description here

The virtual machine might be slow

Be prepared that the virtual machine might be slow, if the USB drive is slow. See this link,

Notes about speed

You can run VirtualBox in Ubuntu installed in a fast USB3 drive

There is an alternative that I am using: An installed system in a fast USB3 drive with [Windows 10 in] VirtualBox. The light-weight alternative is a fast USB3 pendrive, and a more powerful alternative is a USB3 SSD (either a USB3 SSD box or a standard SATA SSD in a USB SATA to USB3 or eSATA box).

Such a system is portable between computers, but not as portable as a persistent live system. If your computers work without proprietary drivers (for graphics and wifi) or work with the same proprietary drivers, they will probably work with an installed Ubuntu system in a USB drive.

There are detailed instructions at the following link,

Boot Ubuntu from external drive

Edit 1 to answer your comment:

When testing VirtualBox in a persistent live Ubuntu based system

  • some version may work better. I tried 16.04.1 LTS created from the Lubuntu desktop iso file lubuntu-16.04.1-desktop-amd64.iso

  • I installed virtualbox from the repositories with

    sudo apt update
    sudo apt install virtualbox
    
  • I selected a suitable 'internal environment' in VirtualBox to match the guest operating system, that I wanted to run,

    • 'General -- Basic -- Version: Ubuntu (64-bit)

    • enough RAM (2 GB in a computer with 4 GB)

    • connected the virtual optical drive to an iso file

    • created a virtual disk

    • and installed Xubuntu from xubuntu-16.04.1-desktop-amd64.iso

This screenshot shows the installed Xubuntu system in VirtualBox. Click on the screenshot and and view it in a big enough window to see it at full size.

enter image description here

Edit 2, summary about hosts and guests:

I tested also an Artful dot one host, Lubuntu 17.10.1 (64-bit) and it can handle guest versions 16.04.1, 17.10 and also Bionic (to be released soon as 18.04 LTS).

Running VirtualBox in Lubuntu 16.04.1 LTS and 17.10.1, I found that the boot option nomodeset makes Virtualbox render the graphics correctly for Lubuntu 17.10.1 and Bionic guests, but the resolution will be limited to 1024x768 (and lower).

Standard Ubuntu and other Ubuntu flavours as guest operating systems work well.

See details at this link to the Ubuntu Forums.

sudodus
  • 46,324
  • 5
  • 88
  • 152
  • Thanks so much for trying that out! I have a fast USB. Persistent live approach works better for what I am doing so I will try a bit more with the persistent live. I am open to trying to install VirtualBox and having to start again from boot to boot. Do you recall which approach you used to install it? I was never able to get VirtualBox to work despite installing different ways. I would get the errors shown at the top of most when trying to install, or to run it. – user3600280 Mar 19 '18 at 01:57
  • @user3600280, See my 'Edit 1 to answer your comment' at the end of my answer. -- If for some reason you want to use another version (than 16.04.1 LTS) for the host operating system, please tell me which version you want, and I can test using that version. – sudodus Mar 19 '18 at 06:52
1

I made a Persistent USB using mkusb and installed VBox from the repositories, sudo apt install virtualbox-qt.

I rebooted both the virtual machine and the USB several times each with different combinations of OS.

Everything seems to work fine to me, screen shots attached.

I am wondering if the problem could be due to corrupt ISO(s), (check MD5SUM), or the version of VBox.

The version of VBox from the repositories seems smoother than the version from the VirtualBox.org website.

I don't think problems with BIOS/UEFI come into play with virtual machines.

I have also had problems with outdated versions of VBox stop working and requiring updating.

It almost seems a waist running VBox on Ubuntu to make a Virtual thumbdrive, Puppy Linux installs VBox automatically and only takes up about 200MB vs Ubuntu's 1.6GB.

QEMU with Virtual Manager also works well on Persistent flash drive. I think it is faster than VBox, It runs kernel level, whatever that means.

sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
sudo apt-get install virt-manager

enter image description here

enter image description here

C.S.Cameron
  • 19,519
  • I tested (as before in a Lubuntu 17.10.1 host), and I noticed no difference between the VirtualBox engines installed by the packages virtualbox-qt and virtualbox. – sudodus Mar 20 '18 at 12:40