简体   繁体   中英

Vagrant shared folder not working/synchronizing

So I have a vagrant machine

m@m-ThinkPad-L15-Gen-2:~/Desktop/estudos/shellclass/localuser$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'jasonc/centos7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'jasonc/centos7' version '1.4.4' is up to date...
==> default: Setting the name of the VM: localuser_default_1635771672344_69157
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 5.2.6
    default: VirtualBox Version: 6.1
==> default: Mounting shared folders...
    default: /vagrant => /home/m/Desktop/estudos/shellclass/localuser

When I try to create a test file on the folder:

m@m-ThinkPad-L15-Gen-2:~/Desktop/estudos/shellclass/localuser$ vagrant ssh
[vagrant@localhost ~]$ ls
[vagrant@localhost ~]$ cd vagrant
-bash: cd: vagrant: No such file or directory
[vagrant@localhost ~]$ cd ..
[vagrant@localhost home]$ ls
vagrant
[vagrant@localhost home]$ cd vagrant
[vagrant@localhost ~]$ touch teste
[vagrant@localhost ~]$ ls -l
total 0
-rw-rw-r-- 1 vagrant vagrant 0 Nov  1 09:02 teste
[vagrant@localhost ~]$ ls -l
total 0
-rw-rw-r-- 1 vagrant vagrant 0 Nov  1 09:02 teste
[vagrant@localhost ~]$ vagrant rsync-auto
-bash: vagrant: command not found
[vagrant@localhost ~]$ rsync-auto
-bash: rsync-auto: command not found
[vagrant@localhost ~]$ 

And when I try to access it from a normal linux terminal, I can't find the files:

m@m-ThinkPad-L15-Gen-2:~/Desktop/estudos/shellclass/localuser$ ls -l
ls: /lib/x86_64-linux-gnu/libselinux.so.1: no version information available (required by ls)
total 4
-rw-rw-r-- 1 m m 3020 nov  1 10:00 Vagrantfile

What is going on? I had created this machine before and it was working properly until last friday. But now, for some reason, I just can't find the files anymore. When I open it on a graphical interface, I also see no file that I have created.

Without seeing your Vagrantfile it is difficult to answer your question. However after vagrant ssh you probably should do cd /vagrant in stead of cd vagrant (with forward slash).

Further more your guest additions are for a different version of virtualbox. You could install the vbguest plugin to update: vagrant plugin install vagrant-vbguest

Finally virtualbox has been updated from version 6.1.26 to 6.1.28. This has also broken u number of configurations. See also Vagrant up failing for VirtualBox provider on Ubuntu

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM