Tuesday 1 September 2020

Vagrant Read-only file system fix

When I booted up my main VM today, it would boot part way and then I'd get:

==> default: Configuring and enabling network interfaces...
C:/HashiCorp/Vagrant/embedded/gems/2.2.9/gems/net-scp-1.2.1/lib/net/scp.rb:398:in `await_response_state': scp: /tmp/vagrant-network-entry-1598986668: Read-only file system (RuntimeError)

Followed by a load of errors. When accessing the machine via Virtualbox, I would also get quite a few read only file system errors after logging in.

Eventually I found the solution was to run a file system check (accessing the machine via Virtualbox):

sudo fsck -C /dev/sda1

(Where /dev/sda1 is the filsystem partition). This found numerous errors, which I just had to put 'y' in to let it fix them. It ran pretty quickly, probably done in a minute. After that I rebooted the VM, logged in and didn't get any errors. Shut it down, then booted it normally via vagrant up, and all working so far.

A good explanation of why the filesystem may become read-only is here: Ubuntu VM “read only file system” fix?.