hashicorp / hashicorp/vagrant

Root filesystem becomes read-only when synced folder contains spaces

Open
#12,697 2 comments 1 reaction 0 assignees View on GitHub
guest/ubuntu host/ubuntu synced-folders/general
Dominant language
Ruby
Stars
27.2k
Forks
4.4k
Avg merge
1m
Merged PRs (30d)
1

Description

### 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](https://gist.github.com/BadIdeaException/cd20d578599af8b52b3c1e5278600e23).

### 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](https://github.com/hashicorp/vagrant/issues/7540)

Contributor guide

Open the contributing guide

Research direction

Start with the minimal Vagrantfile and reproduce the second `vagrant up` using the documented Ubuntu and VirtualBox setup. Trace the generated SSH command that runs `sed` against `/etc/fstab`, using the linked debug output as needed. Done means repeated boots with `/opt/I have spaces` leave the guest root filesystem writable and mount the synced folder.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, ruby
Domain
devops, infrastructure, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.