Trying to fix very poor VirtualBox install experience

TLDR; how do I build the kernel that NixOS uses? I’m assuming it’s built using a nixpkg…if so, what’s the attribute path?

I recently installed NixOS on a virtualbox with the minimal CD and was met with a pretty frustrating experience. The Graphics would completely stop working a few seconds into the boot process. I switched to the (nomodeset) option in GRUB which allowed me to boot from the CD and perform the install. The install itself was easy and straightforward. Then after the install I could not boot using the OS installed on the disk…the graphics would just stop, just like when I was booting without the (nomodeset) option from the CD.

After a few hours of triage, I finally tried switching the graphics controller from VMSVGA to VBoxSVGA, and viola, everything started working. I could even boot from the CD without selecting (nomodeset).

I’m pretty surprised that this issue exists today. It prevents you from being able to install NixOS on a default VirtualBox machine, and the fact that graphics stops working makes it very difficult for the typical user to triage.

I’ve opened an issue here: https://github.com/NixOS/nixpkgs/issues/58070

I’ve had to mess with kernel graphics config in the past and am willing to see if I can fix this issue, but I don’t know how the install image is built and what kernel it uses. I assume that it’s using a kernel from nixpkgs? So if someone can just provide me with the name of the kernel, I can build it and just crack open the iso, install it and test potential fixes. Thanks for any guidance here.

3 Likes

The ISO isn’t really meant for VBox, that’s why the download page has the OVA: https://nixos.org/nixos/download.html
If you want to make your own VirtualBox images, take a look at: https://github.com/Luis-Hebendanz/nixos-generators

The ISO isn’t really meant for VBox

Should https://nixos.org/nixos/manual/index.html#sec-instaling-virtualbox-guest be removed?

I think it could be improved with your suggestions, would be nice if the instructions would actually work again :slight_smile:. I just think that not many people tried to run the ISO straight in a VBox recently.

I’m going to jump on this ancient thread to share my own (mostly negative) experiences (although these were with an upgrade to 20.03, rather than a fresh install).

The short of it is: 2 major things are broken (screen dimensions, copy-pasting) which makes this a huge pain. And I haven’t even done a cursory check of other things that might be broken yet. Links below.

It would seem to me that NixOS not working (properly) inside a VirtualBox VM is a huge blocker for further adoption. As per the manual, which states “Installing NixOS into a VirtualBox guest is convenient for users who want to try NixOS without installing it on bare metal.” I find this a pity because I sincerely hope that NixOS will become more successful than it already is. The fact that I’m encountering issues this large 3 months into the release (it’s june now, I’m talking about 20.03) also makes me wonder whether I’m somewhat unique in running NixOS inside VirtualBox (I’d prefer not to be).

Now on the subject of doing a fresh install, I actually kept a log when doing this 3 years ago, and at least at that point in time (17.03) things still worked with the standard ISO. (My notes specifically mention taking the standard ISO rather than the pre-made VirtualBox image)

My experience is that ever since the upgrade to virtualbox 6 it hasn’t been reliable on most Linux distros.

Part of the reason for this is that the default was changed to use emulated vmware graphics. Not only do many distros not detect this correctly but it has been plagued with bugs since it’s release.

At this point, I have mostly stopped using virtualbox. It just hasn’t been something I can depend on over the last year or two.

1 Like

That’s sad… do you recommend any particular alternative for those wishing to run NixOS as a VM rather than straight on the metal?

It depends what your host system is. I typically use vmware on Windows and Linux hosts.

I also use qemu on Linux hosts but I don’t think I have tested nixos on qemu.

To add a somewhat old data point if it helps- I ran NixOS 18.09 in April 2019 on then-latest combination of arch+vbox and it ran without problems.

MacOS… I’ve previously used Parallels for Ubuntu guests but I migrated away from that for various reasons before I made the switch to NixOS for my guest