hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.32k stars 4.43k forks source link

Root filesystem becomes read-only when synced folder contains spaces #12697

Open BadIdeaException opened 2 years ago

BadIdeaException commented 2 years ago

Vagrant version

Vagrant 2.2.19

Host operating system

Ubuntu 21.10 uname -a on the host: Linux Laptop 5.13.0-30-generic #33-Ubuntu SMP Fri Feb 4 17:03:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Guest operating system

Ubuntu 21.10, box: ubuntu/impish64 uname -a on the guest: Linux ubuntu-impish 5.13.0-28-generic #31-Ubuntu SMP Thu Jan 13 17:41:06 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Vagrantfile

Minimal working example:

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/impish64"
  config.vm.synced_folder ".", "/opt/I have spaces"
end

I am using the VirtualBox provider.

Debug output

Error message upon vagrant up:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

sed -i '/#VAGRANT-BEGIN/,/#VAGRANT-END/d' /etc/fstab

Stdout from the command:

Stderr from the command:

sed: couldn't open temporary file /etc/sedXMNOp2: Read-only file system

Output from running VAGRANT_LOG=debug vagrant up can be found here.

Expected behavior

The machine should boot and mount the current folder under /opt/I have spaces

Actual behavior

The very first boot of the VM works fine and the folder gets mounted. Any subsequent boots however put the root filesystem in read-only mode. Any write attempts on the machine's file system fail.

Sure enough, running mount on the guest machine then shows:

/dev/sda1 on / type ext4 (ro,relatime)

Steps to reproduce

  1. Put above Vagrantfile in a folder and run vagrant up
  2. vagrant halt
  3. vagrant up

References

Seems spaces in folder names have been a problem before: GH 7540

grosenberry commented 2 years ago

100% confirmed that I'm seeing this exact behavior. Can't believe I found the ticket.

maxfortun commented 7 months ago

As a workaround, escape spaces on vm creation:

sed -i 's/\\ /\\040/g' /etc/fstab