Problem running Vagrant on Ubuntu 18.04

I’m somewhat frustrated trying to run Vagrant on Ubuntu 18.04 because I can’t seem to make VirtualBox able to run on my system. I’m having this problem for a while now, but I was able to complete the M040 course using only my local machine.
Knowing that I have this issue with VirtualBox/Vagrant, I looked for a course that did NOT mention it as a requirement and gladly found that M103 does NOT mention Vagrant in it’s about page (https://university.mongodb.com/courses/M103/about). Sad for me, in the first lesson I learn that Vagrant is indeed needed for this course.
I tried installing the 5.1 version mentioned in the Lesson 0, but that does not complete. The install fails with an error. Teying to install and run using either command line and Softare Updater from Ubuntu yields different errors too.
In short, either I’ll have to make VirtualBox/Vagrant run (which I already invested a few hours without any luck), or I’d like to have a way to complete the course using my local machine only (I’m Okay with that, I finished M040 just like this). If neither option is viable, I’d kinldy ask you guys to update the requirements page for M103 to mention the need for VirtualBox/Vagrant so that people like me won’t get fooled again.

1 Like

Silly question, but just to make sure: are you running Ubuntu on bare metal?

I’m not sure I understand your question, but I’m running Ubuntu as my main OS (on a dual-boot machine with Windows, which I rarely, if ever, access) on a laptop.
After some more digging, it looks like the problem I’m having is related to Ubuntu 18.04 and Secure Boot (https://askubuntu.com/questions/900118/vboxdrv-sh-failed-modprobe-vboxdrv-failed-please-use-dmesg-to-find-out-why), but still struggling to make it work.
Coul this course be completed using a local Mongo installation, just like it’s possible for the course M040?
Thanks in advance!

That’s exactly what I was asking :slight_smile: I wanted to make sure that you were not trying to run virtualization-inside-virtualization, i.e. run Virtualbox inside a virtualized Ubuntu env. That usually doesn’t work without lots of trickery.

Coul this course be completed using a local Mongo installation

Unfortunately, no. This course includes a whole bunch of validation scripts and it will run at least six MongoD instances (plus one MongoS). The validators expect to find a very, very specific setup so they’ll most likely fail if you run them on your env.

Any-which-way, I do agree with you that the requirements of M103 should include a mention of Vagrant+VirtualBox.

Thanks for the help Tess.
I’ll keep trying to make Virtualbox work in the environment that I have because I really enjoy taking Mongo University courses (this would be my 3rd one!). But I’m worried I won’t be able to complete this M103 in due time because of this issue.
Is there a way to withdraw my enrollment for this course? I would not like to have it under my courses section with a did not pass grade.
Just a final question, would this course work using Vagrant on top of any other virtualization schemes, like Hyper-V and Docker, Libvirt (KVM), VMware and AWS (as per https://linuxize.com/post/how-to-install-vagrant-on-ubuntu-18-04/ )? I might give it a try, if it’s worth!

I am running VirtualBox and Vagrant inside an Ubuntu 18.04 LTS virtual machine running in VMWare ESXi.

I am using the latest versions of VirtualBox and Vagrant, since they exist solely to provide the standardized virtual environment and I wanted the latest patches/bug fixes. The only hiccup was that by default, virtual machines do not support VT-x, so VirtualBox couldn’t run. Once that was fixed, everything else ran smoothly.

When you say that VirutalBox doesn’t run on your system, are you getting an error when installing it? Does it install but Vagrant can’t spin up a virtual machine? Something else?

2 Likes

Hello @ciscofu, thanks for the interest in helping me!
I’m able to install both Virtualbox and Vagrant on my local Ubuntu 18.04, but when I run vagrant up, it complains about problems running virtualbox. I went on a cycle of looking up the error mentioned, trying to fix it and looking for the next error message.
Right now I think it’s related to Ubuntu’s secure boot, since I see a few “PKCS#7 signature not signed with a trusted key” on dmesg.
I think my real problem is that I’m not a full-fledged Ubuntu admin. I use it for a few years now, develop a lot of stuff using it, but not really tweaking and configuring it. Ubuntu is just the OS where I run my IDE, browser and other tools, and I use this same machine to work, so I don’t feel comfortable just running random commands from the internet that should fix the problems I’m having.
Good thing is that I’m aware of that and trying to improve my Ubuntu skills. Knowing that I cannot run Virtualbox right now and have not found yet how to fix it, I searched for a Mongo course that did not have Virtualbox and Vagrant as requirements, but it in fact, did.
Sorry for listening to my rant ;-), but I’ll keep trying to run Vagrant under another VMM. Perhaps I should try VMWare, since you confirmed that it worked for you, right?

1 Like

Yes, it sounds like it is related to secure boot. Anything that plugs into the kernel needs to have a digitally signed module or that error will occur. Without disabling secure boot, the workaround is to manually digitally sign the modules. dmesg should provide information on which specific kernel module(s) lack the signature. Here are instructions for digitally signing kernel modules – it’s for VMWare, but the same basic procedure applies to any unsigned kernel module.

I am using VMWare ESXi, which is a type 1 hypervisor. It is essentially the main OS on a computer dedicated to virtual machines. VirtualBox and VMWare Workstation are type 2 hypervisors, which provide virtualization on top of a “regular” operating system, such as Ubuntu or Windows. I mention this only because type 2 hypervisors are generally going to need to install a kernel module in the OS to enable virtualization, so there may not be an advantage to VMWare over VirtualBox on Ubuntu w/ secure boot – you’re still going to need to address the driver signing problem.

Another option is to use the Xen hypervisor, which can be installed via apt and avoids the need to load external, unsigned kernel modules since virtualization gets baked into the Linux kernel. You could create a virtual machine with Ubuntu (or whatever) and enable the VT-x extensions in the virtual machine (add hap=1 and nestedhvm=1 to the config). That VM will then be able to run VirtualBox and Vagrant. This is similar to what you are trying to do now, but you are essentially just creating a VM without secure boot to do it. You will end up running a virtual machine (VirtualBox) inside of a virtual machine (Xen), but it does work. It is what I am doing now, but I am using ESXi instead of Xen.

If you haven’t considered it yet, you could also sign up for a trial AWS, Azure, or Google Cloud account. All give a pretty liberal trial period that would allow you to spin up a virtual machine and use it instead of your own local computer. Even without a trial account, as long as you power off the virtual machine when you’re done (I only spend an hour or two each week on these courses), the total cost for the course would probably only be a couple of dollars.

The most obvious option, although I hate to recommend lessening security, is to disable secure boot until the course is over.

Hopefully one of these suggestions help!

1 Like

Really thank you for all the inputs @ciscofu.
I’ll try each one of your suggestions until I manage to run Vagrant on Ubuntu
It’s a challenge worth taking, even though I probably won’t make it on time for this course, but I’ll surely take this same course later with Vagrant working!
Thank you, again.

1 Like

Dude, you’re awesome :slight_smile:

Yeah, tried that too and doesn’t work. It checks for the Ubuntu version during the process. Had downgraded to Ubuntu 16/14 to get it to work. BTW, didn’t have to install Vagrant / Virtual Box when I did it. I think the provision script did that in the process