p4lang / tutorials

P4 language tutorials
Apache License 2.0
1.37k stars 894 forks source link

Error on tutorial exercises #653

Open MarlovMrN opened 3 days ago

MarlovMrN commented 3 days ago

Hi :)

I've set up my env with vagrant up dev inside the ubuntu-24.04 folder.

At first, I went to the load_balance exercise, called make and was able to run that part of the tutorial, which the packet is not load_balaced and sent only to h2.

Then replaced the original load_balance.p4 with the one inside the solution folder in order to test the load balancing, tried to issue a make again but got an error. ModuleNotFoundError: No module named 'p4'

I thought I did something wrong as it was running minutes before, than deleted the vm and issued the vagrant up dev again and waiting those long hours for it to complete.

This time I copied the solution before running, and everything went smoothly. My surprise was after exiting the mininet and trying to issue a make again. The same error showed up.

maybe a make clean would solve the problem, but then I get: sudo: mn: command not found

sudo ls works fine mn works too, except it complains about needing the root.

So I don't really know why the sudo mn isn't found, nor if a make clean would solve the p4 not found issue.

jafingerhut commented 3 days ago

I will create a new VM as I do every month starting soon, and see if that new VM has any of the problems that you describe.

I just tested the one I created on Nov 1, 2024, available at a link in the README of this repo, in this section: https://github.com/p4lang/tutorials?tab=readme-ov-file#download-a-virtual-machine-with-the-p4-development-tools-already-installed

and was not able to reproduce the results you saw. Maybe you can try it out and see if you get any errors using it?

MarlovMrN commented 2 days ago

I will create a new VM as I do every month starting soon, and see if that new VM has any of the problems that you describe.

I just tested the one I created on Nov 1, 2024, available at a link in the README of this repo, in this section: https://github.com/p4lang/tutorials?tab=readme-ov-file#download-a-virtual-machine-with-the-p4-development-tools-already-installed

and was not able to reproduce the results you saw. Maybe you can try it out and see if you get any errors using it?

Using the already installed images I could play around a bit more and figured it out.

The makefile in utils/Makefile gets updated during installation (I assume) and issuing a git reset --hard inside the tutorials folder, breaks it.

Freshly imported VM from the built image: image

Maybe that change should have been committed in the repo itself? Feel free to close this if that isn't applicable

jafingerhut commented 2 days ago

Glad you figured out the issue.

That change was "new" in May 2024 this year, when I started creating the scripts for this repo on Ubuntu 24.04. I did not test those changes on Ubuntu 20.04, which was the primary version of the install scripts in this repo since about 2020, and only recently would I consider the Ubuntu 20.04 versions of the install scripts as perhaps time to be deprecated.

You might be right that it would be a good time to commit those into the main branch of this repo, and not on patches.

In general, I would recommend not changing things like that in your copy, unless you are trying to make it likely they will no longer work.