tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Mount the host's filesystem inside the guest VM

Open sc68cal opened this issue 3 years ago • 8 comments

I prefer to use the editor and development environment on the machine that is running vagrant and then just ssh into the vagrant machine and execute the commands.

You can still use the graphical UI of the guest VM and make changes, so this doesn't break existing tutorials that had users using the VirtualBox GUI to make changes and do the exercises.

sc68cal avatar Aug 30 '22 04:08 sc68cal

Thanks for the suggested change. If I understand it correctly, this will achieve the desired effect if someone checks out the tutorials repo and runs "vagrant up" or "vagrant up dev" commands themselves to create a VM.

I also create VM images and distribute them in binary form, linked from a table here: https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md

As far as I can guess, your proposed changes would have the effect of (a) no longer including a copy of the tutorials repo inside the VM's files, which would be inconvenient for users of such images, and (b) make some folder on the host OS that likely does not exist into a shared folder. Maybe that is harmless, but whether it is harmless, it also seems useless.

jfingerh avatar Sep 01 '22 14:09 jfingerh

a) no longer including a copy of the tutorials repo inside the VM's files, which would be inconvenient for users of such images,

Is it the case that people learning P4 are going to boot into a full VM and write their programs using the editor that is inside the VM? It is more likely they are going to want to use the development environment that they are comfortable with.

Like, when I wanted to learn P4 my first instinct was to clone this git repo onto my development machine and start doing the p4 exercises within the environment that I have set up. The point of the Vagrant VM is to have that shared folder capability where the git repo is automatically mounted inside the guest VM where all the p4 tools are installed, so that the compilation step and testing step happens inside the VM.

and (b) make some folder on the host OS that likely does not exist into a shared folder. Maybe that is harmless, but whether it is harmless, it also seems useless.

That's not true, I am using relative paths so that when you run Vagrant up from within the vm-ubuntu-20.04 directory, the entire tutorials directory is shared inside the VM.

sc68cal avatar Sep 01 '22 19:09 sc68cal

I have tried creating a VM with this modification to the Vagrantfile, and I am not sure why, but with the resulting VM, I could not log in to the account 'p4' in the GUI. I do not know why that is, but this does not happen with a VM created without these changes.

If people want to take a VM created with this Vagrantfile, and after that VM is created, create a folder that is shared between the host and guest OS, they are free to do so.

If people want to edit the Vagrantfile so that such a shared folder is created as the VM is created, they are free to do so.

I am very reluctant to commit a change to the Vagrantfile such that when I create a VM from it, users cannot log in to the 'p4' account from the GUI.

jafingerhut avatar Sep 01 '22 20:09 jafingerhut

I was able to log in as the p4 user. I do not believe my change is the culprit

sc68cal avatar Sep 02 '22 05:09 sc68cal

"I was able to log in as the p4 user. I do not believe my change is the culprit" I believe these changes work for you on your system. I do. Please use them. I have tried exactly these changes twice on my system, and they result in a VM where I cannot log into the user account 'p4' from the GUI. Why? I do not know. If you want to get on a Zoom call for an hour and watch it happen over my shoulder, you are welcome to do that. It won't be exciting.

jfingerh avatar Sep 02 '22 13:09 jfingerh

Screenshot 2022-09-02 140306

Attached is a screenshot of my Vagrant VM logged in as the P4 user. Both patches I have submitted as PRs are applied. I have not touched the system in any way besides what those two patches changed. I will destroy and rebuild the VM to see if I can replicate your problem, but I don't think anything I have changed is why you cannot log in.

sc68cal avatar Sep 02 '22 18:09 sc68cal

I trust that these changes produce good results for you on your system. I really do. I have zero doubt about that.

If you do not believe me that these changes produce non-working results on my system, you are free to believe that.

jfingerh avatar Sep 04 '22 21:09 jfingerh

If you want, you can create a PR where your modified Vagrantfile is in a different, new, directory, instead of the vm-ubuntu-20.04 directory. Or is stored under a different name in the vm-ubuntu-20.04 directory, with instructions in the README on how to use it, instead of the current one.

jfingerh avatar Sep 05 '22 01:09 jfingerh