Debian 10 box in Vagrant fails with grub error

If you are trying to get Debian 10 Buster to run in Vagrant and are receiving the following error

default: /dev/vda does not exist, so cannot grub-install to it!
default: You must correct your GRUB install devices before proceeding:
default: 
default:   dpkg-reconfigure grub-pc
default: dpkg: error processing package grub-pc (--configure):
default:  installed grub-pc package post-installation script subprocess returned error exit status 1
default: Errors were encountered while processing:
default:  grub-pc
default: E: Sub-process /usr/bin/dpkg returned an error code (1)

Add the following shell command before you do your first “apt-get update”.

Vagrant.configure(2) do |config|
  config.vm.box = "debian/contrib-buster64"
  ...
  config.vm.provision "shell", inline: %q{
    ...
    echo "grub-pc hold" | sudo dpkg --set-selections
    ...
  }
}

Vagrant used to be a great system. But it must be a lot of work to maintain all those “boxes” (VM images) and keep them up-to-date. I fear that now that Vagrant is less popular, and there is less power behind Vagrant than before, that Vagrant as a technology is slowly “rotting”.

P.S. I recently created a nerdy privacy-respecting tool called When Will I Run Out Of Money? It's available for free if you want to check it out.

This article is © Adrian Smith.
It was originally published on 9 Feb 2021
More on: FAIL | Coding