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: VirtualBox display fails when `VMSVGA` Graphics Controller · Issue #58070 · NixOS/nixpkgs · GitHub

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: Download Nix / NixOS | Nix & NixOS
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 NixOS 23.11 manual | Nix & NixOS be removed?

1 Like

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.

1 Like

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)

1 Like

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

@vanschelven Did you get the resizing working on macOS and VirtualBox 6.1.6? I know 6.1.6 has that upstream bug.

I downloaded VirtualBox 6.1.6 and guest additions stuff and got the nixos VirtualBox image all setup, and it uses VMSVGA for the graphics controller, but that tiny screen resolution is rough. It’s usable if I set the zoom to like 300%, but yeah…

Thanks for any thoughts!

I got resizing to work on NixOS 20.03 (and currently unknown virtualbox version) as per the notes on this thread: https://discourse.nixos.org/t/does-anybody-have-working-automatic-resizing-in-virtualbox/7391
Not copy/pasting though, so I aborted my upgrade.

1 Like

I don’t agree. Ubuntu and CentOS work in VBox 6

That post was from 7 months ago. I am sure things have changed in various ways since then.

Also, what I was referring to was a general pattern of instability in VB since version 6. Even a casual review of the bugs/fixes since the release of version 6 will show you how many serious issues have existed and the extended period of time over which they did so.

I am not currently using virtualbox so I cannot speak to the current state of the product right now.