Problems copying files to a virtual machine

Good afternoon. When watching a video, at the moment where you need to copy data from the local machine to the virtual machine using the - command cp -r . Then an error pops up that the given file or directory does not exist.

Hi @Sverxsro4nik,

I believe you are referring to this command :

cp -r m103-vagrant-env/ ~/university/m103

As the error message says, please make sure that you are running this command in the correct directory and the directories exist. It also depends on what operating system you are using.

I would recommend you to do it using the GUI of your host operating system. That being said, this step is not that important. You can skip it.

Hope it helps!

Shubham Ranjan
Curriculum Services Engineer

Operating system Windows. I did everything as indicated in the video file of the lesson. Maybe you should completely remove the installed programs and try to repeat the instructions again?

Hi @Sverxsro4nik,

If you meant to ask if you should start from scratch then I would say you don’t need to do that.

Just cd into your m103-vagrant-env folder and run these two commands and you should be good to go from here.

Vagrant up

Vagrant ssh

Shubham Ranjan
Curriculum Services Engineer

Whatever I do, I cannot find the necessary folder. He writes that it does not exist. Launched vagrant from the necessary folder, launched via VB. The answer is the same. No existing directory or file. I can’t continue learning further, what could be the mistake? Already even reinstalled software that is indicated as necessary

Show us a screenshot of what exactly you’re trying to do. You don’t use cp to copy from the host to VM or vice versa. The shared folder is synced between machines.

I registered the commands in different ways, you can see in the log. The answer is still the same

I’ll explain differently. Run these commands:

  1. echo "This is from my VM" > /shared/vmfile.txt
  2. ls -l /shared
  3. You will find the vmfile.txt inside the /shared folder on your VM/guest machine
  4. You will find the vmfile.txt inside the …/m103-vagrant-env/shared folder on your local/host machine

… the shared folder is synced between the host and the guest, so all you need to do is drop a file in there.

Is recursive copying necessary or not? An error occurs at this stage. I made the above commands, I understood the general principle of the program

Just keep the files in the shared folder and access it from the VM. No copying necessary.

Feel free to show a screenshot of this just in case I misunderstood your question.

Thank you very much for your help. Sorry for distracting you. The fault was entirely mine. It was necessary to watch the video a little further to understand that the folder is recursively copied from the lecturer on the local machine and not to the virtual one. thanks again

No problem!

That’s right… and because you were already setup I didn’t think you were referring to this lecture (Setting Up the Vagrant Environment).

1 Like