From c43f6ed97544191ca804a8885caa3af8906e7f65 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Wed, 16 Oct 2024 18:55:00 -0400 Subject: [PATCH 01/11] Move optional steps for testing VMs out of README.md file This may help avoid new users being confused that they must follow those instructions. Signed-off-by: Andy Fingerhut --- vm-ubuntu-20.04/README.md | 217 +--------------- vm-ubuntu-20.04/create-vm-image-for-others.md | 210 ++++++++++++++++ vm-ubuntu-24.04/README.md | 235 +----------------- vm-ubuntu-24.04/create-vm-image-for-others.md | 214 ++++++++++++++++ 4 files changed, 435 insertions(+), 441 deletions(-) create mode 100644 vm-ubuntu-20.04/create-vm-image-for-others.md create mode 100644 vm-ubuntu-24.04/create-vm-image-for-others.md diff --git a/vm-ubuntu-20.04/README.md b/vm-ubuntu-20.04/README.md index ade3084c..6a1eb7ff 100644 --- a/vm-ubuntu-20.04/README.md +++ b/vm-ubuntu-20.04/README.md @@ -1,10 +1,12 @@ # Creating the VM + + Below are the steps to create a brand new VM using Vagrant: + Install [Vagrant](https://developer.hashicorp.com/vagrant/docs/installation) on your system if it's not already installed. - + Navigate to the directory where you want to create the new VM. + + In a shell/terminal window, change to this `vm-ubuntu-20.04` + directory inside the `tutorials` directory. + Run the below command in the terminal. - ``` + ```bash vagrant up ``` @@ -13,214 +15,9 @@ - You can update these packages using `apt upgrade` within the VM. + Alternatively, a development VM can be created by running - ``` + ```bash vagrant up dev ``` -*Note* : that creating a development VM can take one to several -hours, depending upon the speed of your computer and Internet -connection. - -Below are steps that were performed _after_ one of the commands above -was run on the host OS, before creating the VM images. Some of these -steps could probably be automated with programs, and changes to the -`vagrant` scripts that can do so are welcome. I performed these steps -manually to create a VM image, simply to avoid the experimentation and -time required to automate them. I typically only create new VM images -once per month. - -+ Log in as user p4 (password p4) -+ Click "Upgrade" in the pop-up window asking if you want to upgrade - the system, if asked. This will download the latest Linux kernel - version released for Ubuntu 20.04, and other updated packages. -+ Reboot the system. -+ This is optional, but if you want to save a little disk space, use - - ``` - sudo apt purge - ``` - - to remove older version of Linux - kernel, if the upgrade installed a newer one. -+ Clean the local repository of retrieved package files to free up disk space - - ``` - sudo apt clean - ``` - -+ Log in as user p4 (password p4) -+ Start menu -> Preferences -> LXQt settings -> Monitor settings - + Change resolution from initial 800x600 to 1024x768. Apply the changes. - + Close monitor settings window - + *Note*: For some reason I do not know, these settings seem to be - undone, even if I use the "Save" button. They are temporarily in - effect if I shut down the system and log back in, but then in a few - seconds it switches back to 800x600. Strange. -+ Start menu -> Preferences -> LXQt settings -> Desktop - + In "Wallpaper mode" popup menu, choose "Center on the screen". - + Click Apply button - + Close "Desktop preferences" window -+ Several of the icons on the desktop have an exclamation mark on - them. If you try double-clicking those icons, it pops up a window - saying "This file 'Wireshark' seems to be a desktop entry. What do - you want to do with it?" with buttons for "Open", "Execute", and - "Cancel". Clicking "Execute" executes the associated command. - If you do a mouse middle click on one of these desktop icons, a - popup menu appears where the second-to-bottom choice is "Trust this - executable". Selecting that causes the exclamation mark to go away, - and future double-clicks of the icon execute the program without - first popping up a window to choose between Open/Execute/Cancel. I - did that for each of these desktop icons: - + Terminal - + Wireshark -+ Log off - -+ Log in as user vagrant (password vagrant) -+ Change monitor settings and wallpaper mode as described above for - user p4. -+ Open a terminal. - + Run the command - - ``` - ./clean.sh - ``` - which removes about 6 to 7 GBytes of - files created while building the projects. -+ Log off - - -# Notes on test results for the VM - -I have run the tests below on every VM image I release, before -releasing it. You need not run them again, unless you are curious how -to do so. - - -## p4c testing results - -Steps to run the p4c tests: - -+ Log in as user vagrant (password vagrant) -+ In a new terminal, execute these commands: - -If you are testing on a Release VM image, first get a copy of the p4c -source code using the following command. This is unnecessary with a -Development VM image, as there is already a `p4c` directory with the -version of source code used to create that image already included in -the home directory of the `vagrant` user account: - -```bash -# for Release VM image only -git clone --recursive https://github.com/p4lang/p4c -``` - -The following steps are common for both Release and Development VM -images: - -```bash -# Compile p4c again from source, since the clean.sh step reduced disk -# space by deleting the p4c/build directory. -git clone https://github.com/jafingerhut/p4-guide -cd p4c -~/p4-guide/bin/build-p4c.sh - -# Run the p4c tests -cd build -make -j2 check |& tee make-check-out.txt -``` - -As of 2024-08-01, the p4c compiler passes all of its included tests, -except for some of the p4testgen tests (if those are enabled). - - -## Send ping packets in the solution to `basic` exercise of `p4lang/tutorials` repository - -With the version of the [tutorials](https://github.com/p4lang/tutorials) repository -that comes pre-installed in the `p4` user account of this VM, the -following tests pass. - -First log in as the user `p4` (password `p4`) and open a terminal -window. -```bash -$ cd tutorials/exercises/basic -$ cp solution/basic.p4 basic.p4 -$ make run -``` - -If at the end of many lines of logging output you see a prompt -`mininet>`, you can try entering the command `h1 ping h2` to ping from -virtual host `h1` in the exercise to `h2`, and it should report a -successful ping every second. It will not stop on its own. You can -type Control-C to stop it and return to the `mininet>` prompt, and you -can type Control-D to exit from mininet and get back to the original -shell prompt. To ensure that any processes started by the above steps -are terminated, you can run this command: -```bash -$ make stop -``` - - -# Creating a single file image of the VM - -These notes are primarily here as a reminder for people creating VM -images for distribution. If you downloaded a VM image, these steps -were already performed, and there is no reason you need to perform -them again. - -For the particular case of creating the VM named: - -+ 'P4 Tutorial Development 2024-08-01' -+ created on August 1, 2024 - -here were the host OS details, in case it turns out that matters to -the finished VM image for some reason: - -+ Windows 10 Enterprise -+ VirtualBox 6.1.30 r148432 -+ Vagrant 2.2.18 - -In the VirtualBox GUI interface: - -+ Choose menu item File -> Export Appliance ... -+ Select the VM named 'P4 Tutorial Development 2024-08-01' and click - Continue button - -+ Format - + I used: Open Virtualization Format 1.0 - + Other available options were: - + Open Virtualization Format 0.9 - + Open Virtualization Format 2.0 -+ Target file - + I used: /Users/andy/Documents/P4 Tutorials Development 2024-08-01.ova -+ Mac Address Policy - + I used: Include only NAT network adapter MAC addresses - + Other available options were: - + Include all network adapter MAC addresses - + Strip all network adapter MAC addresses -+ Additionally - + Write Manifest file: checked - + Include ISO image files: unchecked - -Clicked "Continue" button. - -Virtual system settings: - -+ Name: P4 Tutorial 2024-08-01 -+ Product: I left this blank -+ Product-URL: I left this blank -+ Vendor: P4.org - P4 Language Consortium -+ Vendor-URL: https://p4.org -+ Version: 2024-08-01 -+ Description: - -``` -Open source P4 development tools built from latest source code as of 2024-Aug-01 and packaged into an Ubuntu 20.04 Desktop Linux VM for the AMD64 architecture. -``` - -+ License - -``` -Open source code available hosted at https://github.com/p4lang is released under the Apache 2.0 license. Libraries it depends upon, such as Protobuf, Thrift, gRPC, Ubuntu Linux, etc. are released under their own licenses. -``` - -Clicked "Export" button. +*Note* that creating a development VM can take several hours, +depending upon the speed of your computer and Internet connection. diff --git a/vm-ubuntu-20.04/create-vm-image-for-others.md b/vm-ubuntu-20.04/create-vm-image-for-others.md new file mode 100644 index 00000000..6f050d1f --- /dev/null +++ b/vm-ubuntu-20.04/create-vm-image-for-others.md @@ -0,0 +1,210 @@ +# Creating a VM image for distribution to others + +If you want to run `p4c` tests, see the next section on how to do so, +_before_ running the commands in this section, since the commands in +this section will delete files that take one to several hours to +create while compiling p4c, needed for running p4c tests. + +Below are steps that were performed _after_ the commands in the +README.md file were run on the host OS, before creating the VM images. +Some of these steps could probably be automated with programs, and +changes to the `vagrant` scripts that can do so are welcome. I +performed these steps manually to create a VM image, simply to avoid +the experimentation and time required to automate them. I typically +only create new VM images once per month. + ++ Log in as user p4 (password p4) ++ Click "Upgrade" in the pop-up window asking if you want to upgrade + the system, if asked. This will download the latest Linux kernel + version released for Ubuntu 20.04, and other updated packages. ++ Reboot the system. ++ This is optional, but if you want to save a little disk space, use + + ``` + sudo apt purge + ``` + + to remove older version of Linux + kernel, if the upgrade installed a newer one. ++ Clean the local repository of retrieved package files to free up disk space + + ``` + sudo apt clean + ``` + ++ Log in as user p4 (password p4) ++ Start menu -> Preferences -> LXQt settings -> Monitor settings + + Change resolution from initial 800x600 to 1024x768. Apply the changes. + + Close monitor settings window + + *Note*: For some reason I do not know, these settings seem to be + undone, even if I use the "Save" button. They are temporarily in + effect if I shut down the system and log back in, but then in a few + seconds it switches back to 800x600. Strange. ++ Start menu -> Preferences -> LXQt settings -> Desktop + + In "Wallpaper mode" popup menu, choose "Center on the screen". + + Click Apply button + + Close "Desktop preferences" window ++ Several of the icons on the desktop have an exclamation mark on + them. If you try double-clicking those icons, it pops up a window + saying "This file 'Wireshark' seems to be a desktop entry. What do + you want to do with it?" with buttons for "Open", "Execute", and + "Cancel". Clicking "Execute" executes the associated command. + If you do a mouse middle click on one of these desktop icons, a + popup menu appears where the second-to-bottom choice is "Trust this + executable". Selecting that causes the exclamation mark to go away, + and future double-clicks of the icon execute the program without + first popping up a window to choose between Open/Execute/Cancel. I + did that for each of these desktop icons: + + Terminal + + Wireshark ++ Log off + ++ Log in as user vagrant (password vagrant) ++ Change monitor settings and wallpaper mode as described above for + user p4. ++ Open a terminal. + + Run the command + + ``` + ./clean.sh + ``` + which removes about 6 to 7 GBytes of + files created while building the projects. ++ Log off + + +# Notes on test results for the VM + +I have run the tests below on every VM image I release, before +releasing it. You need not run them again, unless you are curious how +to do so. + + +## p4c testing results + +Steps to run the p4c tests: + ++ Log in as user vagrant (password vagrant) ++ In a new terminal, execute these commands: + +If you are testing on a Release VM image, first get a copy of the p4c +source code using the following command. This is unnecessary with a +Development VM image, as there is already a `p4c` directory with the +version of source code used to create that image already included in +the home directory of the `vagrant` user account: + +```bash +# for Release VM image only +git clone --recursive https://github.com/p4lang/p4c +``` + +The following steps are common for both Release and Development VM +images: + +```bash +# Compile p4c again from source, since the clean.sh step reduced disk +# space by deleting the p4c/build directory. +git clone https://github.com/jafingerhut/p4-guide +cd p4c +~/p4-guide/bin/build-p4c.sh + +# Run the p4c tests +cd build +make -j2 check |& tee make-check-out.txt +``` + +As of 2024-08-01, the p4c compiler passes all of its included tests, +except for some of the p4testgen tests (if those are enabled). + + +## Send ping packets in the solution to `basic` exercise of `p4lang/tutorials` repository + +With the version of the [tutorials](https://github.com/p4lang/tutorials) repository +that comes pre-installed in the `p4` user account of this VM, the +following tests pass. + +First log in as the user `p4` (password `p4`) and open a terminal +window. +```bash +$ cd tutorials/exercises/basic +$ cp solution/basic.p4 basic.p4 +$ make run +``` + +If at the end of many lines of logging output you see a prompt +`mininet>`, you can try entering the command `h1 ping h2` to ping from +virtual host `h1` in the exercise to `h2`, and it should report a +successful ping every second. It will not stop on its own. You can +type Control-C to stop it and return to the `mininet>` prompt, and you +can type Control-D to exit from mininet and get back to the original +shell prompt. To ensure that any processes started by the above steps +are terminated, you can run this command: +```bash +$ make stop +``` + + +# Creating a single file image of the VM + +These notes are primarily here as a reminder for people creating VM +images for distribution. If you downloaded a VM image, these steps +were already performed, and there is no reason you need to perform +them again. + +For the particular case of creating the VM named: + ++ 'P4 Tutorial Development 2024-08-01' ++ created on August 1, 2024 + +here were the host OS details, in case it turns out that matters to +the finished VM image for some reason: + ++ Windows 10 Enterprise ++ VirtualBox 6.1.30 r148432 ++ Vagrant 2.2.18 + +In the VirtualBox GUI interface: + ++ Choose menu item File -> Export Appliance ... ++ Select the VM named 'P4 Tutorial Development 2024-08-01' and click + Continue button + ++ Format + + I used: Open Virtualization Format 1.0 + + Other available options were: + + Open Virtualization Format 0.9 + + Open Virtualization Format 2.0 ++ Target file + + I used: /Users/andy/Documents/P4 Tutorials Development 2024-08-01.ova ++ Mac Address Policy + + I used: Include only NAT network adapter MAC addresses + + Other available options were: + + Include all network adapter MAC addresses + + Strip all network adapter MAC addresses ++ Additionally + + Write Manifest file: checked + + Include ISO image files: unchecked + +Clicked "Continue" button. + +Virtual system settings: + ++ Name: P4 Tutorial 2024-08-01 ++ Product: I left this blank ++ Product-URL: I left this blank ++ Vendor: P4.org - P4 Language Consortium ++ Vendor-URL: https://p4.org ++ Version: 2024-08-01 ++ Description: + +``` +Open source P4 development tools built from latest source code as of 2024-Aug-01 and packaged into an Ubuntu 20.04 Desktop Linux VM for the AMD64 architecture. +``` + ++ License + +``` +Open source code available hosted at https://github.com/p4lang is released under the Apache 2.0 license. Libraries it depends upon, such as Protobuf, Thrift, gRPC, Ubuntu Linux, etc. are released under their own licenses. +``` + +Clicked "Export" button. diff --git a/vm-ubuntu-24.04/README.md b/vm-ubuntu-24.04/README.md index 31466a58..9a2fb11c 100644 --- a/vm-ubuntu-24.04/README.md +++ b/vm-ubuntu-24.04/README.md @@ -1,10 +1,7 @@ # Introduction -This directory is still new and a bit experimental at this point. -Feel free to try it out and report problems if you find any. - -Known issues that anyone who knows how to fix is welcome to suggest -improvements: +Known minor issues that anyone who knows how to fix is welcome to +suggest improvements: + The desktop icon for the Wireshark application does not seem to exist, at least not under the name that worked for Ubuntu 20.04, so @@ -15,7 +12,8 @@ improvements: + Below are the steps to create a brand new VM using Vagrant: + Install [Vagrant](https://developer.hashicorp.com/vagrant/docs/installation) on your system if it's not already installed. - + Navigate to the directory where you want to create the new VM. + + In a shell/terminal window, change to this `vm-ubuntu-24.04` + directory inside the `tutorials` directory. + Run the below command in the terminal. ```bash @@ -30,228 +28,3 @@ improvements: *Note* that creating a development VM can take several hours, depending upon the speed of your computer and Internet connection. - - -# Creating a VM image for distribution to others - -If you are creating the VM for your own use, there is no need to read -further below. All later instructions are for those who wish to -create a VM image for others to download and use. - -Some of these steps could probably be automated with programs, and -changes to the `vagrant` scripts that can do so are welcome. I -perform these steps manually to create a VM image, simply to avoid the -experimentation and time required to automate them. I typically only -create new VM images once per month. - -+ Log in as user p4 (password p4) -+ Upgrade Ubuntu packages if newer ones are available: - - ```bash - sudo apt update - sudo apt upgrade - ``` - -+ Reboot the system. -+ This is optional, but if you want to save a little disk space, use - - ```bash - sudo apt purge - ``` - - to remove older version of Linux - kernel, if the upgrade installed a newer one. -+ Clean the local repository of retrieved package files to free up disk space - - ```bash - sudo apt clean - ``` - -+ Log in as user p4 (password p4) -+ Start menu -> Preferences -> LXQt settings -> Monitor settings - + Change resolution from initial 800x600 to 1024x768. Apply the changes. - + Close monitor settings window - + *Note*: For some reason I do not know, these settings seem to be - undone, even if I use the "Save" button. They are temporarily in - effect if I shut down the system and log back in, but then in a few - seconds it switches back to 800x600. Strange. -+ Start menu -> Preferences -> LXQt settings -> Desktop - + Click "Background" tab - + To the right of "Wallpaper image file" name, click "Browse" - button. Find and choose "lxqt-default-wallpaper.png" from the - list and click "Open". - + In "Wallpaper mode" popup menu, choose "Center on the screen". - + Click Apply button - + Close "Desktop preferences" window -+ Start menu -> Preferences -> LXQt settings -> Appearance - + Click "Icons Theme" in left column - + Click "Ubuntu-Mono-Light ..." in right column. - + Click "Apply" button, then "Close" button. -+ Several of the icons on the desktop have an exclamation mark on - them. If you try double-clicking those icons, it pops up a window - saying "This file 'Wireshark' seems to be a desktop entry. What do - you want to do with it?" with buttons for "Open", "Execute", and - "Cancel". Clicking "Execute" executes the associated command. - If you do a mouse middle click on one of these desktop icons, a - popup menu appears where the second-to-bottom choice is "Trust this - executable". Selecting that causes the exclamation mark to go away, - and future double-clicks of the icon execute the program without - first popping up a window to choose between Open/Execute/Cancel. I - did that for each of these desktop icons: - + Terminal - + Wireshark -+ Log off - -+ Log in as user vagrant (password vagrant) -+ Change monitor settings and wallpaper mode as described above for - user p4. -+ Open a terminal. - + Run the command - - ```bash - ./clean.sh - ``` - which removes about 6 to 7 GBytes of - files created while building the projects. -+ Log off - - -# Notes on test results for the VM - -I have run the tests below on every VM image I release, before -releasing it. You need not run them again, unless you are curious how -to do so. - - -## p4c testing results - -Steps to run the p4c tests: - -+ Log in as user vagrant (password vagrant) -+ In a new terminal, execute these commands: - -If you are testing on a Release VM image, first get a copy of the p4c -source code using the following command. This is unnecessary with a -Development VM image, as there is already a `p4c` directory with the -version of source code used to create that image already included in -the home directory of the `vagrant` user account: - -```bash -# for Release VM image only -git clone --recursive https://github.com/p4lang/p4c -``` - -The following steps are common for both Release and Development VM -images: - -```bash -# Compile p4c again from source, since the clean.sh step reduced disk -# space by deleting the p4c/build directory. -git clone https://github.com/jafingerhut/p4-guide -cd p4c -~/p4-guide/bin/build-p4c.sh - -# Run the p4c tests -cd build -make -j2 check |& tee out1.txt - -# The above fails about 500 tests that require root. Re-run those tests -# as root using the next command. -sudo PATH=${PATH} VIRTUAL_ENV=${VIRTUAL_ENV} ${P4GUIDE_SUDO_OPTS} make -j2 recheck |& tee out2.txt -``` - -As of 2024-08-01, the p4c compiler passes all but about 15 of its -included tests when built using the steps above. - - -## Send ping packets in the solution to `basic` exercise of `p4lang/tutorials` repository - -With the version of the [tutorials](https://github.com/p4lang/tutorials) repository -that comes pre-installed in the `p4` user account of this VM, the -following tests pass. - -First log in as the user `p4` (password `p4`) and open a terminal -window. -```bash -$ cd tutorials/exercises/basic -$ cp solution/basic.p4 basic.p4 -$ make run -``` - -If at the end of many lines of logging output you see a prompt -`mininet>`, you can try entering the command `h1 ping h2` to ping from -virtual host `h1` in the exercise to `h2`, and it should report a -successful ping every second. It will not stop on its own. You can -type Control-C to stop it and return to the `mininet>` prompt, and you -can type Control-D to exit from mininet and get back to the original -shell prompt. To ensure that any processes started by the above steps -are terminated, you can run this command: -```bash -$ make stop -``` - - -# Creating a single file image of the VM - -These notes are primarily here as a reminder for people creating VM -images for distribution. If you downloaded a VM image, these steps -were already performed, and there is no reason you need to perform -them again. - -For the particular case of creating the VM named: - -+ 'P4 Tutorial Development 2024-08-01' -+ created on August 1, 2024 - -here were the host OS details, in case it turns out that matters to -the finished VM image for some reason: - -+ Windows 10 Enterprise -+ VirtualBox 6.1.30 r148432 -+ Vagrant 2.2.18 - -In the VirtualBox GUI interface: - -+ Choose menu item File -> Export Appliance ... -+ Select the VM named 'P4 Tutorial Development 2024-08-01' and click - Continue button - -+ Format - + I used: Open Virtualization Format 1.0 - + Other available options were: - + Open Virtualization Format 0.9 - + Open Virtualization Format 2.0 -+ Target file - + I used: /Users/andy/Documents/P4 Tutorials Development 2024-08-01.ova -+ Mac Address Policy - + I used: Include only NAT network adapter MAC addresses - + Other available options were: - + Include all network adapter MAC addresses - + Strip all network adapter MAC addresses -+ Additionally - + Write Manifest file: checked - + Include ISO image files: unchecked - -Clicked "Continue" button. - -Virtual system settings: - -+ Name: P4 Tutorial 2024-08-01 -+ Product: I left this blank -+ Product-URL: I left this blank -+ Vendor: P4.org - P4 Language Consortium -+ Vendor-URL: https://p4.org -+ Version: 2024-08-01 -+ Description: - -``` -Open source P4 development tools built from latest source code as of 2024-Aug-01 and packaged into an Ubuntu 24.04 Desktop Linux VM for the AMD64 architecture. -``` - -+ License - -``` -Open source code available hosted at https://github.com/p4lang is released under the Apache 2.0 license. Libraries it depends upon, such as Protobuf, Thrift, gRPC, Ubuntu Linux, etc. are released under their own licenses. -``` - -Clicked "Export" button. diff --git a/vm-ubuntu-24.04/create-vm-image-for-others.md b/vm-ubuntu-24.04/create-vm-image-for-others.md new file mode 100644 index 00000000..2e38ca84 --- /dev/null +++ b/vm-ubuntu-24.04/create-vm-image-for-others.md @@ -0,0 +1,214 @@ +# Creating a VM image for distribution to others + +If you want to run `p4c` tests, see the next section on how to do so, +_before_ running the commands in this section, since the commands in +this section will delete files that take one to several hours to +create while compiling p4c, needed for running p4c tests. + +If you are creating the VM for your own use, there is no need to read +further below. All later instructions are for those who wish to +create a VM image for others to download and use. + +Some of these steps could probably be automated with programs, and +changes to the `vagrant` scripts that can do so are welcome. I +perform these steps manually to create a VM image, simply to avoid the +experimentation and time required to automate them. I typically only +create new VM images once per month. + ++ Log in as user p4 (password p4) ++ Upgrade Ubuntu packages if newer ones are available: + + ```bash + sudo apt update + sudo apt upgrade + ``` + ++ Reboot the system. ++ This is optional, but if you want to save a little disk space, use + + ```bash + sudo apt purge + ``` + + to remove older version of Linux + kernel, if the upgrade installed a newer one. ++ Clean the local repository of retrieved package files to free up disk space + + ```bash + sudo apt clean + ``` + ++ Log in as user p4 (password p4) ++ Start menu -> Preferences -> LXQt settings -> Monitor settings + + Change resolution from initial 800x600 to 1024x768. Apply the changes. + + Close monitor settings window + + *Note*: For some reason I do not know, these settings seem to be + undone, even if I use the "Save" button. They are temporarily in + effect if I shut down the system and log back in, but then in a few + seconds it switches back to 800x600. Strange. ++ Start menu -> Preferences -> LXQt settings -> Desktop + + Click "Background" tab + + To the right of "Wallpaper image file" name, click "Browse" + button. Find and choose "lxqt-default-wallpaper.png" from the + list and click "Open". + + In "Wallpaper mode" popup menu, choose "Center on the screen". + + Click Apply button + + Close "Desktop preferences" window ++ Start menu -> Preferences -> LXQt settings -> Appearance + + Click "Icons Theme" in left column + + Click "Ubuntu-Mono-Light ..." in right column. + + Click "Apply" button, then "Close" button. ++ Several of the icons on the desktop have an exclamation mark on + them. If you try double-clicking those icons, it pops up a window + saying "This file 'Wireshark' seems to be a desktop entry. What do + you want to do with it?" with buttons for "Open", "Execute", and + "Cancel". Clicking "Execute" executes the associated command. + If you do a mouse middle click on one of these desktop icons, a + popup menu appears where the second-to-bottom choice is "Trust this + executable". Selecting that causes the exclamation mark to go away, + and future double-clicks of the icon execute the program without + first popping up a window to choose between Open/Execute/Cancel. I + did that for each of these desktop icons: + + Terminal + + Wireshark ++ Log off + ++ Log in as user vagrant (password vagrant) ++ Change monitor settings and wallpaper mode as described above for + user p4. ++ Open a terminal. + + Run the command + + ```bash + ./clean.sh + ``` + which removes about 6 to 7 GBytes of + files created while building the projects. ++ Log off + + +# Notes on test results for the VM + +I have run the tests below on every VM image I release, before +releasing it. You need not run them again, unless you are curious how +to do so. + + +## p4c testing results + +Steps to run the p4c tests: + ++ Log in as user vagrant (password vagrant) ++ In a new terminal, execute these commands: + +```bash +# Compile p4c again from source, since the clean.sh step reduced disk +# space by deleting the p4c/build directory. +git clone https://github.com/jafingerhut/p4-guide +cd p4c +~/p4-guide/bin/build-p4c.sh + +# Run the p4c tests +cd build +make -j2 check |& tee out1.txt + +# The above fails about 500 tests that require root. Re-run those tests +# as root using the next command. +sudo PATH=${PATH} VIRTUAL_ENV=${VIRTUAL_ENV} ${P4GUIDE_SUDO_OPTS} make -j2 recheck |& tee out2.txt +``` + +As of 2024-08-01, the p4c compiler passes all but about 15 of its +included tests when built using the steps above. + + +## Send ping packets in the solution to `basic` exercise of `p4lang/tutorials` repository + +With the version of the [tutorials](https://github.com/p4lang/tutorials) repository +that comes pre-installed in the `p4` user account of this VM, the +following tests pass. + +First log in as the user `p4` (password `p4`) and open a terminal +window. +```bash +$ cd tutorials/exercises/basic +$ cp solution/basic.p4 basic.p4 +$ make run +``` + +If at the end of many lines of logging output you see a prompt +`mininet>`, you can try entering the command `h1 ping h2` to ping from +virtual host `h1` in the exercise to `h2`, and it should report a +successful ping every second. It will not stop on its own. You can +type Control-C to stop it and return to the `mininet>` prompt, and you +can type Control-D to exit from mininet and get back to the original +shell prompt. To ensure that any processes started by the above steps +are terminated, you can run this command: +```bash +$ make stop +``` + + +# Creating a single file image of the VM + +These notes are primarily here as a reminder for people creating VM +images for distribution. If you downloaded a VM image, these steps +were already performed, and there is no reason you need to perform +them again. + +For the particular case of creating the VM named: + ++ 'P4 Tutorial Development 2024-08-01' ++ created on August 1, 2024 + +here were the host OS details, in case it turns out that matters to +the finished VM image for some reason: + ++ Windows 10 Enterprise ++ VirtualBox 6.1.30 r148432 ++ Vagrant 2.2.18 + +In the VirtualBox GUI interface: + ++ Choose menu item File -> Export Appliance ... ++ Select the VM named 'P4 Tutorial Development 2024-08-01' and click + Continue button + ++ Format + + I used: Open Virtualization Format 1.0 + + Other available options were: + + Open Virtualization Format 0.9 + + Open Virtualization Format 2.0 ++ Target file + + I used: /Users/andy/Documents/P4 Tutorials Development 2024-08-01.ova ++ Mac Address Policy + + I used: Include only NAT network adapter MAC addresses + + Other available options were: + + Include all network adapter MAC addresses + + Strip all network adapter MAC addresses ++ Additionally + + Write Manifest file: checked + + Include ISO image files: unchecked + +Clicked "Continue" button. + +Virtual system settings: + ++ Name: P4 Tutorial 2024-08-01 ++ Product: I left this blank ++ Product-URL: I left this blank ++ Vendor: P4.org - P4 Language Consortium ++ Vendor-URL: https://p4.org ++ Version: 2024-08-01 ++ Description: + +``` +Open source P4 development tools built from latest source code as of 2024-Aug-01 and packaged into an Ubuntu 24.04 Desktop Linux VM for the AMD64 architecture. +``` + ++ License + +``` +Open source code available hosted at https://github.com/p4lang is released under the Apache 2.0 license. Libraries it depends upon, such as Protobuf, Thrift, gRPC, Ubuntu Linux, etc. are released under their own licenses. +``` + +Clicked "Export" button. From 322494984d045d085562715f3e7fb3fece7ff1d5 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Thu, 30 Jan 2025 21:17:19 +0000 Subject: [PATCH 02/11] Add 2025-Jan-30 versions of source code for install.sh Signed-off-by: Andy Fingerhut --- vm-ubuntu-24.04/install.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vm-ubuntu-24.04/install.sh b/vm-ubuntu-24.04/install.sh index ccc7728f..a7eae56b 100755 --- a/vm-ubuntu-24.04/install.sh +++ b/vm-ubuntu-24.04/install.sh @@ -27,11 +27,12 @@ print_usage() { 1>&2 echo "" 1>&2 echo "Dates supported:" 1>&2 echo " 2025-Jan-01" + 1>&2 echo " 2025-Jan-30" } if [ $# -eq 0 ] then - VERSION="2025-Jan-01" + VERSION="2025-Jan-30" echo "No version specified. Defaulting to ${VERSION}" elif [ $# -eq 1 ] then @@ -49,6 +50,13 @@ case ${VERSION} in export INSTALL_P4C_SOURCE_VERSION="1dc0afae2207f4bb9f5ab45f105ed569cc1ac89b" export INSTALL_PTF_SOURCE_VERSION="c554f83685186be4cfa9387eb5d6d700d2bbd7c0" ;; + 2025-Jan-30) + # 2025-Jan-01 versions: + export INSTALL_BEHAVIORAL_MODEL_SOURCE_VERSION="892c42198082d3252f4c6facc7363c02ca1d71d2" + export INSTALL_PI_SOURCE_VERSION="2bb40f7ab800b91b26f3aed174bbbfc739a37ffa" + export INSTALL_P4C_SOURCE_VERSION="2776b1948529bc7e8ccfb2f6ea2a9c1ab1f68796" + export INSTALL_PTF_SOURCE_VERSION="c554f83685186be4cfa9387eb5d6d700d2bbd7c0" + ;; latest) echo "Using the latest version of all p4lang repository source code." ;; From d9c87dec69fcd006c6636b4cdf8905b19838518e Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Wed, 5 Aug 2026 17:02:01 -0400 Subject: [PATCH 03/11] Add lots of extra debug commands for installed Python packages Signed-off-by: Andy Fingerhut --- vm-ubuntu-24.04/install-p4dev-v8.sh | 53 +++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/vm-ubuntu-24.04/install-p4dev-v8.sh b/vm-ubuntu-24.04/install-p4dev-v8.sh index 1d80fd5d..a7f4e076 100755 --- a/vm-ubuntu-24.04/install-p4dev-v8.sh +++ b/vm-ubuntu-24.04/install-p4dev-v8.sh @@ -140,6 +140,28 @@ max_of_list() { echo ${max} } +dump_python_lib_info() { + local output_dir=$1 + mkdir -p ${output_dir} + outf=${output_dir}/dirs.txt + echo "All directories named site-packages or dist-packages:" > ${outf} + find / -name site-packages -o -name dist-packages > ${outf} + echo "" > ${outf} + echo "ls -la on each such directory:" > ${outf} + for d in $(find / -name site-packages -o -name dist-packages) + do + echo $d > ${outf} + ls -la $d > ${outf} + done + echo "" > ${outf} + echo "ls -laR on each such directory:" > ${outf} + for d in $(find / -name site-packages -o -name dist-packages) + do + echo $d > ${outf} + ls -laR $d > ${outf} + done +} + # Change this to a lower value if you do not like all this extra debug # output. It is occasionally useful to debug why Python package # install files, or other files installed system-wide, are not going @@ -474,6 +496,10 @@ pip -V || echo "No such command in PATH: pip" pip2 -V || echo "No such command in PATH: pip2" pip3 -V || echo "No such command in PATH: pip3" +DEBUG_DUMP_DIR="${HOME}/install-p4dev-dumpdir" +mkdir -p ${DEBUG_DUMP_DIR} +dump_python_lib_info "${DEBUG_DUMP_DIR}/01-init" + # On new systems if you have never checked repos you should do that first # Install a few packages (vim is not strictly necessary -- installed for @@ -508,6 +534,8 @@ then pkg-config python3-pip fi +dump_python_lib_info "${DEBUG_DUMP_DIR}/02-after-python-apt-installs" + if [ \( "${ID}" = "ubuntu" -a "${VERSION_ID}" = "20.04" \) -o \( "${ID}" = "fedora" -a "${VERSION_ID}" = "35" \) ] then if [ -d automake-1.16.5 ] @@ -581,6 +609,7 @@ pip3 list || echo "Some error occurred attempting to run command: pip3" cd "${INSTALL_DIR}" debug_dump_many_install_files ${INSTALL_DIR}/usr-local-1-before-protobuf.txt +dump_python_lib_info "${DEBUG_DUMP_DIR}/03-before-installing-grpc" set +x echo "------------------------------------------------------------" @@ -598,6 +627,7 @@ then if [ "${PROTOBUF_VERSION_FOR_PIP}" != "" ] then pip3 install protobuf==${PROTOBUF_VERSION_FOR_PIP} + dump_python_lib_info "${DEBUG_DUMP_DIR}/04-after-installing-protobuf-via-pip" fi TIME_GRPC_INSTALL_END=$(date +%s) pip3 list @@ -609,6 +639,7 @@ else if [ "${PROTOBUF_VERSION_FOR_PIP}" != "" ] then pip3 install protobuf==${PROTOBUF_VERSION_FOR_PIP} + dump_python_lib_info "${DEBUG_DUMP_DIR}/04-after-installing-protobuf-via-pip" fi cd "${INSTALL_DIR}" @@ -676,6 +707,7 @@ else sudo make install cd ../.. sudo ldconfig + dump_python_lib_info "${DEBUG_DUMP_DIR}/05-after-installing-grpc-from-source" # Without the following command, later the command 'pkg-config # --cflags grpc' fails, at least on Ubuntu 23.10 after building # grpc v1.54.2 @@ -733,6 +765,8 @@ echo "start install PI:" set -x date +dump_python_lib_info "${DEBUG_DUMP_DIR}/06-before-PI" + TIME_PI_CLONE_START=$(date +%s) TIME_PI_CLONE_END=$(date +%s) TIME_PI_INSTALL_START=$(date +%s) @@ -807,6 +841,8 @@ echo "end install PI:" set -x date +dump_python_lib_info "${DEBUG_DUMP_DIR}/07-before-behavioral-model" + cd "${INSTALL_DIR}" debug_dump_many_install_files ${INSTALL_DIR}/usr-local-4-after-PI.txt @@ -854,6 +890,7 @@ else # This command installs Thrift, which I want to include in my build of # simple_switch_grpc ./install_deps.sh + dump_python_lib_info "${DEBUG_DUMP_DIR}/08-after-behavioral-model-install_deps" # simple_switch_grpc README.md says to configure and build the bmv2 # code first, using these commands: ./autogen.sh @@ -868,9 +905,11 @@ else make sudo make install-strip sudo ldconfig + dump_python_lib_info "${DEBUG_DUMP_DIR}/09-after-behavioral-model-install" # 'sudo make install-strip' installs several files in ${PYTHON_VENV} # with root owner. Change them to be owned by the regular user id. change_owner_and_group_of_venv_lib_python3_files ${PYTHON_VENV} + dump_python_lib_info "${DEBUG_DUMP_DIR}/10-after-behavioral-model-change_owner" DISK_USED_BEFORE_BMV2_CLEANUP=`get_used_disk_space_in_mbytes` if [ ${CLEAN_UP_AS_WE_GO} -eq 1 ] then @@ -894,6 +933,8 @@ date cd "${INSTALL_DIR}" debug_dump_many_install_files ${INSTALL_DIR}/usr-local-5-after-behavioral-model.txt +dump_python_lib_info "${DEBUG_DUMP_DIR}/11-before-p4c" + set +x echo "------------------------------------------------------------" echo "Installing p4lang/p4c" @@ -931,6 +972,8 @@ fi pip3 install scapy==2.5.0 ply pip3 list +dump_python_lib_info "${DEBUG_DUMP_DIR}/12-before-p4c-after-install-scapy" + DISK_USED_BEFORE_P4C_CLEANUP=`get_used_disk_space_in_mbytes` if [ -d p4c ] then @@ -957,6 +1000,7 @@ else MAX_PARALLEL_JOBS=`max_parallel_jobs 2048` make -j${MAX_PARALLEL_JOBS} sudo make install/strip + dump_python_lib_info "${DEBUG_DUMP_DIR}/13-after-p4c-install" sudo ldconfig DISK_USED_BEFORE_P4C_CLEANUP=`get_used_disk_space_in_mbytes` if [ ${CLEAN_UP_AS_WE_GO} -eq 1 -a ${KEEP_P4C_BUILD_FOR_TESTING} -eq 0 ] @@ -991,6 +1035,8 @@ echo "start install mininet:" set -x date +dump_python_lib_info "${DEBUG_DUMP_DIR}/14-before-mininet" + TIME_MININET_START=$(date +%s) # Pin to a particular version, so that I know the patch below will # continue to apply. Will likely want to update this to newer @@ -1015,6 +1061,7 @@ then RESTORE_SUDOERS_FILE=1 fi PYTHON=python3 ./mininet/util/install.sh -nw +dump_python_lib_info "${DEBUG_DUMP_DIR}/15-after-mininet" if [ ${RESTORE_SUDOERS_FILE} -eq 1 ] then sudo mv /etc/sudoers.d/sudoers-dotfiles.orig /etc/sudoers.d/sudoers-dotfiles @@ -1046,6 +1093,7 @@ TIME_PTF_START=$(date +%s) # Ubuntu 22.04. #sudo pip3 install pypcap +dump_python_lib_info "${DEBUG_DUMP_DIR}/16-before-ptf" git clone https://github.com/p4lang/ptf cd ptf if [ "x${INSTALL_PTF_SOURCE_VERSION}" != "x" ]; then @@ -1054,6 +1102,7 @@ fi git log -n 1 pip install . TIME_PTF_END=$(date +%s) +dump_python_lib_info "${DEBUG_DUMP_DIR}/17-after-ptf" echo "p4lang/ptf : $(($TIME_PTF_END-$TIME_PTF_START)) sec" set +x @@ -1080,6 +1129,7 @@ then sudo dnf -y install gflags-devel net-tools fi pip3 install psutil crcmod +dump_python_lib_info "${DEBUG_DUMP_DIR}/18-after-pip-install-psutil-crcmod" # Install p4runtime-shell from source repo, with a slightly modified # setup.cfg file so that it allows us to keep the version of the @@ -1093,6 +1143,7 @@ pip3 install psutil crcmod # otherwise installing p4runtime-shell packages will likely pick some # very recent version of grpcio that may cause trouble. pip3 install wheel +dump_python_lib_info "${DEBUG_DUMP_DIR}/19-after-pip-install-wheel" if [ "${ID}" == "ubuntu" -a "${VERSION_ID}" == "24.04" ] then # Version 1.51.3 fails to install on Ubuntu 24.04 as of @@ -1101,6 +1152,7 @@ then else pip3 install grpcio==1.51.3 fi +dump_python_lib_info "${DEBUG_DUMP_DIR}/20-after-pip-install-grpcio" git clone https://github.com/p4lang/p4runtime-shell cd p4runtime-shell @@ -1111,6 +1163,7 @@ git log -n 1 PATCH_DIR="${THIS_SCRIPT_DIR_ABSOLUTE}/patches" patch -p1 < "${PATCH_DIR}/p4runtime-shell-2023-changes.patch" pip3 install . +dump_python_lib_info "${DEBUG_DUMP_DIR}/21-after-pip-install-p4runtime-shell" pip3 list From fde4a27dc37418d95859d6e83f445245558f29c5 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Wed, 5 Aug 2026 17:22:49 -0400 Subject: [PATCH 04/11] Update debug dump function Signed-off-by: Andy Fingerhut --- vm-ubuntu-24.04/install-p4dev-v8.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/vm-ubuntu-24.04/install-p4dev-v8.sh b/vm-ubuntu-24.04/install-p4dev-v8.sh index a7f4e076..473a48a2 100755 --- a/vm-ubuntu-24.04/install-p4dev-v8.sh +++ b/vm-ubuntu-24.04/install-p4dev-v8.sh @@ -142,24 +142,26 @@ max_of_list() { dump_python_lib_info() { local output_dir=$1 + set +e mkdir -p ${output_dir} outf=${output_dir}/dirs.txt echo "All directories named site-packages or dist-packages:" > ${outf} - find / -name site-packages -o -name dist-packages > ${outf} - echo "" > ${outf} - echo "ls -la on each such directory:" > ${outf} - for d in $(find / -name site-packages -o -name dist-packages) + find / -name site-packages -o -name dist-packages | sort >> ${outf} + echo "" >> ${outf} + echo "ls -la on each such directory:" >> ${outf} + for d in $(find / -name site-packages -o -name dist-packages | sort) do - echo $d > ${outf} - ls -la $d > ${outf} + echo $d >> ${outf} + ls -la $d >> ${outf} done - echo "" > ${outf} - echo "ls -laR on each such directory:" > ${outf} - for d in $(find / -name site-packages -o -name dist-packages) + echo "" >> ${outf} + echo "ls -laR on each such directory:" >> ${outf} + for d in $(find / -name site-packages -o -name dist-packages | sort) do - echo $d > ${outf} - ls -laR $d > ${outf} + echo $d >> ${outf} + ls -laR $d >> ${outf} done + set -e } # Change this to a lower value if you do not like all this extra debug From 06ae7ed3319f29fc40272b9b83681a437e7f5eab Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Thu, 6 Aug 2026 08:09:45 -0400 Subject: [PATCH 05/11] Put recursive directory listings of Python packages in separate files Signed-off-by: Andy Fingerhut --- vm-ubuntu-24.04/install-p4dev-v8.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vm-ubuntu-24.04/install-p4dev-v8.sh b/vm-ubuntu-24.04/install-p4dev-v8.sh index 473a48a2..318bafa6 100755 --- a/vm-ubuntu-24.04/install-p4dev-v8.sh +++ b/vm-ubuntu-24.04/install-p4dev-v8.sh @@ -154,11 +154,13 @@ dump_python_lib_info() { echo $d >> ${outf} ls -la $d >> ${outf} done - echo "" >> ${outf} - echo "ls -laR on each such directory:" >> ${outf} + #echo "" >> ${outf} + #echo "ls -laR on each such directory:" >> ${outf} for d in $(find / -name site-packages -o -name dist-packages | sort) do - echo $d >> ${outf} + outf="${output_dir}/ls-laR-of-$(echo "$d" | tr '/' '-')" + cp /dev/null ${outf} + #echo $d >> ${outf} ls -laR $d >> ${outf} done set -e From fd6e1041da2b87395c570bd4aa94efafe17f6f1b Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Thu, 6 Aug 2026 08:13:22 -0400 Subject: [PATCH 06/11] Avoid doing install-pi.sh script in bmv2 install_dep.sh because PI is already installed by install-p4dev-v8.sh script before behavioral-model is installed. Signed-off-by: Andy Fingerhut --- .../behavioral-model-adjust-ubuntu-packges.patch | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vm-ubuntu-24.04/patches/behavioral-model-adjust-ubuntu-packges.patch b/vm-ubuntu-24.04/patches/behavioral-model-adjust-ubuntu-packges.patch index f057619d..a74071f5 100644 --- a/vm-ubuntu-24.04/patches/behavioral-model-adjust-ubuntu-packges.patch +++ b/vm-ubuntu-24.04/patches/behavioral-model-adjust-ubuntu-packges.patch @@ -1,5 +1,5 @@ diff --git a/install_deps.sh b/install_deps.sh -index 02dd6d2..7673969 100755 +index 02dd6d2..f1510fe 100755 --- a/install_deps.sh +++ b/install_deps.sh @@ -18,31 +18,20 @@ sudo apt-get install -y \ @@ -35,3 +35,11 @@ index 02dd6d2..7673969 100755 wget tmpdir=`mktemp -d -p .` +@@ -50,7 +39,6 @@ cd $tmpdir + + bash ../ci/install-thrift.sh + bash ../ci/install-nanomsg.sh +-bash ../ci/install-pi.sh + sudo ldconfig + bash ../ci/install-pynng.sh + From 02494eb802e427243c8e35724ff906cc9d085035 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Thu, 6 Aug 2026 20:42:30 -0400 Subject: [PATCH 07/11] Add even more Python package debug cmds Signed-off-by: Andy Fingerhut --- vm-ubuntu-24.04/install-p4dev-v8.sh | 58 +++++++++++-------- ...havioral-model-support-venv-2026-apr.patch | 56 +++++++++++++++++- 2 files changed, 89 insertions(+), 25 deletions(-) diff --git a/vm-ubuntu-24.04/install-p4dev-v8.sh b/vm-ubuntu-24.04/install-p4dev-v8.sh index 318bafa6..98304e46 100755 --- a/vm-ubuntu-24.04/install-p4dev-v8.sh +++ b/vm-ubuntu-24.04/install-p4dev-v8.sh @@ -502,7 +502,7 @@ pip3 -V || echo "No such command in PATH: pip3" DEBUG_DUMP_DIR="${HOME}/install-p4dev-dumpdir" mkdir -p ${DEBUG_DUMP_DIR} -dump_python_lib_info "${DEBUG_DUMP_DIR}/01-init" +dump_python_lib_info "${DEBUG_DUMP_DIR}/000-init" # On new systems if you have never checked repos you should do that first @@ -528,6 +528,7 @@ fi TIME_AUTOTOOLS_START=$(date +%s) if [ "${ID}" = "ubuntu" ] then + dump_python_lib_info "${DEBUG_DUMP_DIR}/003-just-before-python3-pip-install" sudo apt-get --yes install \ autoconf automake libtool curl make g++ unzip \ pkg-config python3-pip python3-venv @@ -538,7 +539,7 @@ then pkg-config python3-pip fi -dump_python_lib_info "${DEBUG_DUMP_DIR}/02-after-python-apt-installs" +dump_python_lib_info "${DEBUG_DUMP_DIR}/005-after-python-apt-installs" if [ \( "${ID}" = "ubuntu" -a "${VERSION_ID}" = "20.04" \) -o \( "${ID}" = "fedora" -a "${VERSION_ID}" = "35" \) ] then @@ -597,6 +598,7 @@ DISK_USED_AFTER_AUTOTOOLS=`get_used_disk_space_in_mbytes` # attempt to ensure that all new Python packages installed are # installed into this virtual environment, not into system-wide # directories like /usr/local/bin +dump_python_lib_info "${DEBUG_DUMP_DIR}/008-just-before-venv-creation" python3 -m venv "${PYTHON_VENV}" source "${PYTHON_VENV}/bin/activate" @@ -613,7 +615,7 @@ pip3 list || echo "Some error occurred attempting to run command: pip3" cd "${INSTALL_DIR}" debug_dump_many_install_files ${INSTALL_DIR}/usr-local-1-before-protobuf.txt -dump_python_lib_info "${DEBUG_DUMP_DIR}/03-before-installing-grpc" +dump_python_lib_info "${DEBUG_DUMP_DIR}/010-before-installing-grpc" set +x echo "------------------------------------------------------------" @@ -630,8 +632,9 @@ then sudo apt-get --yes install libprotobuf-dev protobuf-compiler protobuf-compiler-grpc libgrpc-dev libgrpc++-dev if [ "${PROTOBUF_VERSION_FOR_PIP}" != "" ] then + dump_python_lib_info "${DEBUG_DUMP_DIR}/013-just-before-installing-protobuf-via-pip" pip3 install protobuf==${PROTOBUF_VERSION_FOR_PIP} - dump_python_lib_info "${DEBUG_DUMP_DIR}/04-after-installing-protobuf-via-pip" + dump_python_lib_info "${DEBUG_DUMP_DIR}/015-after-installing-protobuf-via-pip" fi TIME_GRPC_INSTALL_END=$(date +%s) pip3 list @@ -642,8 +645,9 @@ else # protobuf package using pip. if [ "${PROTOBUF_VERSION_FOR_PIP}" != "" ] then + dump_python_lib_info "${DEBUG_DUMP_DIR}/013-just-before-installing-protobuf-via-pip" pip3 install protobuf==${PROTOBUF_VERSION_FOR_PIP} - dump_python_lib_info "${DEBUG_DUMP_DIR}/04-after-installing-protobuf-via-pip" + dump_python_lib_info "${DEBUG_DUMP_DIR}/015-after-installing-protobuf-via-pip" fi cd "${INSTALL_DIR}" @@ -708,10 +712,11 @@ else # https://github.com/grpc/grpc/issues/30524 cmake ../.. -DgRPC_SSL_PROVIDER=package make + dump_python_lib_info "${DEBUG_DUMP_DIR}/013-just-before-grpc-sudo-make-install" sudo make install cd ../.. sudo ldconfig - dump_python_lib_info "${DEBUG_DUMP_DIR}/05-after-installing-grpc-from-source" + dump_python_lib_info "${DEBUG_DUMP_DIR}/020-after-installing-grpc-from-source" # Without the following command, later the command 'pkg-config # --cflags grpc' fails, at least on Ubuntu 23.10 after building # grpc v1.54.2 @@ -769,7 +774,7 @@ echo "start install PI:" set -x date -dump_python_lib_info "${DEBUG_DUMP_DIR}/06-before-PI" +dump_python_lib_info "${DEBUG_DUMP_DIR}/025-before-PI" TIME_PI_CLONE_START=$(date +%s) TIME_PI_CLONE_END=$(date +%s) @@ -821,7 +826,9 @@ else /usr/local/bin/protoc --version set -e make + dump_python_lib_info "${DEBUG_DUMP_DIR}/027-PI-just-before-sudo-make-install" sudo make install + dump_python_lib_info "${DEBUG_DUMP_DIR}/029-PI-just-after-sudo-make-install" DISK_USED_BEFORE_PI_CLEANUP=`get_used_disk_space_in_mbytes` if [ ${CLEAN_UP_AS_WE_GO} -eq 1 ] @@ -845,7 +852,7 @@ echo "end install PI:" set -x date -dump_python_lib_info "${DEBUG_DUMP_DIR}/07-before-behavioral-model" +dump_python_lib_info "${DEBUG_DUMP_DIR}/030-before-behavioral-model" cd "${INSTALL_DIR}" debug_dump_many_install_files ${INSTALL_DIR}/usr-local-4-after-PI.txt @@ -893,8 +900,9 @@ else patch -p1 < "${PATCH_DIR}/behavioral-model-support-venv-2026-apr.patch" # This command installs Thrift, which I want to include in my build of # simple_switch_grpc + dump_python_lib_info "${DEBUG_DUMP_DIR}/031-behavioral-model-just-before-install_deps" ./install_deps.sh - dump_python_lib_info "${DEBUG_DUMP_DIR}/08-after-behavioral-model-install_deps" + dump_python_lib_info "${DEBUG_DUMP_DIR}/035-behavioral-model-just-after-install_deps" # simple_switch_grpc README.md says to configure and build the bmv2 # code first, using these commands: ./autogen.sh @@ -907,13 +915,14 @@ else PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-pi --with-thrift ${configure_python_prefix} 'CXXFLAGS=-O0 -g' fi make + dump_python_lib_info "${DEBUG_DUMP_DIR}/038-behavioral-model-just-before-sudo-make-install-strip" sudo make install-strip sudo ldconfig - dump_python_lib_info "${DEBUG_DUMP_DIR}/09-after-behavioral-model-install" + dump_python_lib_info "${DEBUG_DUMP_DIR}/040-after-behavioral-model-install" # 'sudo make install-strip' installs several files in ${PYTHON_VENV} # with root owner. Change them to be owned by the regular user id. change_owner_and_group_of_venv_lib_python3_files ${PYTHON_VENV} - dump_python_lib_info "${DEBUG_DUMP_DIR}/10-after-behavioral-model-change_owner" + dump_python_lib_info "${DEBUG_DUMP_DIR}/045-after-behavioral-model-change_owner" DISK_USED_BEFORE_BMV2_CLEANUP=`get_used_disk_space_in_mbytes` if [ ${CLEAN_UP_AS_WE_GO} -eq 1 ] then @@ -937,7 +946,7 @@ date cd "${INSTALL_DIR}" debug_dump_many_install_files ${INSTALL_DIR}/usr-local-5-after-behavioral-model.txt -dump_python_lib_info "${DEBUG_DUMP_DIR}/11-before-p4c" +dump_python_lib_info "${DEBUG_DUMP_DIR}/050-before-p4c" set +x echo "------------------------------------------------------------" @@ -976,7 +985,7 @@ fi pip3 install scapy==2.5.0 ply pip3 list -dump_python_lib_info "${DEBUG_DUMP_DIR}/12-before-p4c-after-install-scapy" +dump_python_lib_info "${DEBUG_DUMP_DIR}/055-before-p4c-after-install-scapy" DISK_USED_BEFORE_P4C_CLEANUP=`get_used_disk_space_in_mbytes` if [ -d p4c ] @@ -1003,8 +1012,9 @@ else cmake .. -DCMAKE_BUILD_TYPE=Release ${P4C_CMAKE_OPTS} MAX_PARALLEL_JOBS=`max_parallel_jobs 2048` make -j${MAX_PARALLEL_JOBS} + dump_python_lib_info "${DEBUG_DUMP_DIR}/058-p4c-just-before-sudo-make-install-strip" sudo make install/strip - dump_python_lib_info "${DEBUG_DUMP_DIR}/13-after-p4c-install" + dump_python_lib_info "${DEBUG_DUMP_DIR}/060-p4c-just-after-sudo-make-install-strip" sudo ldconfig DISK_USED_BEFORE_P4C_CLEANUP=`get_used_disk_space_in_mbytes` if [ ${CLEAN_UP_AS_WE_GO} -eq 1 -a ${KEEP_P4C_BUILD_FOR_TESTING} -eq 0 ] @@ -1039,8 +1049,6 @@ echo "start install mininet:" set -x date -dump_python_lib_info "${DEBUG_DUMP_DIR}/14-before-mininet" - TIME_MININET_START=$(date +%s) # Pin to a particular version, so that I know the patch below will # continue to apply. Will likely want to update this to newer @@ -1064,8 +1072,9 @@ then sudo mv /etc/sudoers.d/sudoers-dotfiles /etc/sudoers.d/sudoers-dotfiles.orig RESTORE_SUDOERS_FILE=1 fi +dump_python_lib_info "${DEBUG_DUMP_DIR}/065-mininet-just-before-install" PYTHON=python3 ./mininet/util/install.sh -nw -dump_python_lib_info "${DEBUG_DUMP_DIR}/15-after-mininet" +dump_python_lib_info "${DEBUG_DUMP_DIR}/070-mininet-just-after-install" if [ ${RESTORE_SUDOERS_FILE} -eq 1 ] then sudo mv /etc/sudoers.d/sudoers-dotfiles.orig /etc/sudoers.d/sudoers-dotfiles @@ -1097,16 +1106,17 @@ TIME_PTF_START=$(date +%s) # Ubuntu 22.04. #sudo pip3 install pypcap -dump_python_lib_info "${DEBUG_DUMP_DIR}/16-before-ptf" +dump_python_lib_info "${DEBUG_DUMP_DIR}/075-before-ptf" git clone https://github.com/p4lang/ptf cd ptf if [ "x${INSTALL_PTF_SOURCE_VERSION}" != "x" ]; then git checkout ${INSTALL_PTF_SOURCE_VERSION} fi git log -n 1 +dump_python_lib_info "${DEBUG_DUMP_DIR}/078-ptf-just-before-pip-install" pip install . +dump_python_lib_info "${DEBUG_DUMP_DIR}/080-ptf-just-after-pip-install" TIME_PTF_END=$(date +%s) -dump_python_lib_info "${DEBUG_DUMP_DIR}/17-after-ptf" echo "p4lang/ptf : $(($TIME_PTF_END-$TIME_PTF_START)) sec" set +x @@ -1132,8 +1142,9 @@ elif [ "${ID}" = "fedora" ] then sudo dnf -y install gflags-devel net-tools fi +dump_python_lib_info "${DEBUG_DUMP_DIR}/084-before-pip-install-psutil-crcmod" pip3 install psutil crcmod -dump_python_lib_info "${DEBUG_DUMP_DIR}/18-after-pip-install-psutil-crcmod" +dump_python_lib_info "${DEBUG_DUMP_DIR}/085-after-pip-install-psutil-crcmod" # Install p4runtime-shell from source repo, with a slightly modified # setup.cfg file so that it allows us to keep the version of the @@ -1147,7 +1158,7 @@ dump_python_lib_info "${DEBUG_DUMP_DIR}/18-after-pip-install-psutil-crcmod" # otherwise installing p4runtime-shell packages will likely pick some # very recent version of grpcio that may cause trouble. pip3 install wheel -dump_python_lib_info "${DEBUG_DUMP_DIR}/19-after-pip-install-wheel" +dump_python_lib_info "${DEBUG_DUMP_DIR}/090-after-pip-install-wheel" if [ "${ID}" == "ubuntu" -a "${VERSION_ID}" == "24.04" ] then # Version 1.51.3 fails to install on Ubuntu 24.04 as of @@ -1156,7 +1167,7 @@ then else pip3 install grpcio==1.51.3 fi -dump_python_lib_info "${DEBUG_DUMP_DIR}/20-after-pip-install-grpcio" +dump_python_lib_info "${DEBUG_DUMP_DIR}/095-after-pip-install-grpcio" git clone https://github.com/p4lang/p4runtime-shell cd p4runtime-shell @@ -1166,8 +1177,9 @@ fi git log -n 1 PATCH_DIR="${THIS_SCRIPT_DIR_ABSOLUTE}/patches" patch -p1 < "${PATCH_DIR}/p4runtime-shell-2023-changes.patch" +dump_python_lib_info "${DEBUG_DUMP_DIR}/099-p4runtime-shell-just-before-pip-install" pip3 install . -dump_python_lib_info "${DEBUG_DUMP_DIR}/21-after-pip-install-p4runtime-shell" +dump_python_lib_info "${DEBUG_DUMP_DIR}/100-p4runtime-shell-just-after-pip-install" pip3 list diff --git a/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch b/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch index e7a92c81..22376e00 100644 --- a/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch +++ b/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch @@ -1,8 +1,58 @@ +diff --git a/ci/install-nanomsg.sh b/ci/install-nanomsg.sh +index 675a329..833b444 100644 +--- a/ci/install-nanomsg.sh ++++ b/ci/install-nanomsg.sh +@@ -22,5 +22,7 @@ cd build + # some reason ldconfig cannot find it + cmake .. -DCMAKE_INSTALL_PREFIX=/usr + cmake --build . ++dump_python_lib_info "${DEBUG_DUMP_DIR}/033b-behavioral-model-just-before-nanomsg-cmake-install" + sudo cmake --build . --target install ++dump_python_lib_info "${DEBUG_DUMP_DIR}/033c-behavioral-model-just-after-nanomsg-cmake-install" + cd .. +diff --git a/ci/install-pynng.sh b/ci/install-pynng.sh +index 6abcd8e..825bf85 100644 +--- a/ci/install-pynng.sh ++++ b/ci/install-pynng.sh +@@ -6,3 +6,4 @@ + + set -e + python3 -m pip install --upgrade pynng==0.9.0 ++dump_python_lib_info "${DEBUG_DUMP_DIR}/034-behavioral-model-just-after-pip-install-pynng" diff --git a/ci/install-thrift.sh b/ci/install-thrift.sh -index 1316476..ea6203c 100644 +index 587e9d3..9e37666 100644 --- a/ci/install-thrift.sh +++ b/ci/install-thrift.sh -@@ -3,22 +3,18 @@ +@@ -4,25 +4,49 @@ + # + # SPDX-License-Identifier: Apache-2.0 + ++dump_python_lib_info() { ++ local output_dir=$1 ++ set +e ++ mkdir -p ${output_dir} ++ outf=${output_dir}/dirs.txt ++ echo "All directories named site-packages or dist-packages:" > ${outf} ++ find / -name site-packages -o -name dist-packages | sort >> ${outf} ++ echo "" >> ${outf} ++ echo "ls -la on each such directory:" >> ${outf} ++ for d in $(find / -name site-packages -o -name dist-packages | sort) ++ do ++ echo $d >> ${outf} ++ ls -la $d >> ${outf} ++ done ++ #echo "" >> ${outf} ++ #echo "ls -laR on each such directory:" >> ${outf} ++ for d in $(find / -name site-packages -o -name dist-packages | sort) ++ do ++ outf="${output_dir}/ls-laR-of-$(echo "$d" | tr '/' '-')" ++ cp /dev/null ${outf} ++ #echo $d >> ${outf} ++ ls -laR $d >> ${outf} ++ done ++ set -e ++} ++ THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) source $THIS_DIR/common.sh @@ -29,5 +79,7 @@ index 1316476..ea6203c 100644 -cd lib/py -sudo python3 setup.py install -cd ../../.. ++dump_python_lib_info "${DEBUG_DUMP_DIR}/032-behavioral-model-just-before-pip-install-thrift" +cd .. +pip install thrift==0.16.0 ++dump_python_lib_info "${DEBUG_DUMP_DIR}/033-behavioral-model-just-after-pip-install-thrift" From f23c85071a08c430179ca13f5b7338d7dd76ecfe Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Thu, 6 Aug 2026 21:41:46 -0400 Subject: [PATCH 08/11] Add bash function definition that I omitted in previous commit Signed-off-by: Andy Fingerhut --- ...havioral-model-support-venv-2026-apr.patch | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch b/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch index 22376e00..a809f8bb 100644 --- a/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch +++ b/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch @@ -1,8 +1,41 @@ diff --git a/ci/install-nanomsg.sh b/ci/install-nanomsg.sh -index 675a329..833b444 100644 +index 675a329..2dec6cb 100644 --- a/ci/install-nanomsg.sh +++ b/ci/install-nanomsg.sh -@@ -22,5 +22,7 @@ cd build +@@ -4,6 +4,32 @@ + # + # SPDX-License-Identifier: Apache-2.0 + ++dump_python_lib_info() { ++ local output_dir=$1 ++ set +e ++ mkdir -p ${output_dir} ++ outf=${output_dir}/dirs.txt ++ echo "All directories named site-packages or dist-packages:" > ${outf} ++ find / -name site-packages -o -name dist-packages | sort >> ${outf} ++ echo "" >> ${outf} ++ echo "ls -la on each such directory:" >> ${outf} ++ for d in $(find / -name site-packages -o -name dist-packages | sort) ++ do ++ echo $d >> ${outf} ++ ls -la $d >> ${outf} ++ done ++ #echo "" >> ${outf} ++ #echo "ls -laR on each such directory:" >> ${outf} ++ for d in $(find / -name site-packages -o -name dist-packages | sort) ++ do ++ outf="${output_dir}/ls-laR-of-$(echo "$d" | tr '/' '-')" ++ cp /dev/null ${outf} ++ #echo $d >> ${outf} ++ ls -laR $d >> ${outf} ++ done ++ set -e ++} ++ + THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + source $THIS_DIR/common.sh + +@@ -22,5 +48,7 @@ cd build # some reason ldconfig cannot find it cmake .. -DCMAKE_INSTALL_PREFIX=/usr cmake --build . From a56465ab09a43e7df7049ecba7cea8542a57a7a6 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Thu, 6 Aug 2026 21:59:32 -0400 Subject: [PATCH 09/11] Fix another place I omitted definition of bash function Signed-off-by: Andy Fingerhut --- ...havioral-model-support-venv-2026-apr.patch | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch b/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch index a809f8bb..d8d3ccc9 100644 --- a/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch +++ b/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch @@ -1,8 +1,8 @@ diff --git a/ci/install-nanomsg.sh b/ci/install-nanomsg.sh -index 675a329..2dec6cb 100644 +index 675a329..54fcb3d 100644 --- a/ci/install-nanomsg.sh +++ b/ci/install-nanomsg.sh -@@ -4,6 +4,32 @@ +@@ -4,6 +4,34 @@ # # SPDX-License-Identifier: Apache-2.0 @@ -31,11 +31,13 @@ index 675a329..2dec6cb 100644 + done + set -e +} ++ ++DEBUG_DUMP_DIR="${HOME}/install-p4dev-dumpdir" + THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) source $THIS_DIR/common.sh -@@ -22,5 +48,7 @@ cd build +@@ -22,5 +50,7 @@ cd build # some reason ldconfig cannot find it cmake .. -DCMAKE_INSTALL_PREFIX=/usr cmake --build . @@ -44,19 +46,49 @@ index 675a329..2dec6cb 100644 +dump_python_lib_info "${DEBUG_DUMP_DIR}/033c-behavioral-model-just-after-nanomsg-cmake-install" cd .. diff --git a/ci/install-pynng.sh b/ci/install-pynng.sh -index 6abcd8e..825bf85 100644 +index 6abcd8e..e3bf768 100644 --- a/ci/install-pynng.sh +++ b/ci/install-pynng.sh -@@ -6,3 +6,4 @@ +@@ -4,5 +4,34 @@ + # + # SPDX-License-Identifier: Apache-2.0 ++dump_python_lib_info() { ++ local output_dir=$1 ++ set +e ++ mkdir -p ${output_dir} ++ outf=${output_dir}/dirs.txt ++ echo "All directories named site-packages or dist-packages:" > ${outf} ++ find / -name site-packages -o -name dist-packages | sort >> ${outf} ++ echo "" >> ${outf} ++ echo "ls -la on each such directory:" >> ${outf} ++ for d in $(find / -name site-packages -o -name dist-packages | sort) ++ do ++ echo $d >> ${outf} ++ ls -la $d >> ${outf} ++ done ++ #echo "" >> ${outf} ++ #echo "ls -laR on each such directory:" >> ${outf} ++ for d in $(find / -name site-packages -o -name dist-packages | sort) ++ do ++ outf="${output_dir}/ls-laR-of-$(echo "$d" | tr '/' '-')" ++ cp /dev/null ${outf} ++ #echo $d >> ${outf} ++ ls -laR $d >> ${outf} ++ done ++ set -e ++} ++ ++DEBUG_DUMP_DIR="${HOME}/install-p4dev-dumpdir" ++ set -e python3 -m pip install --upgrade pynng==0.9.0 +dump_python_lib_info "${DEBUG_DUMP_DIR}/034-behavioral-model-just-after-pip-install-pynng" diff --git a/ci/install-thrift.sh b/ci/install-thrift.sh -index 587e9d3..9e37666 100644 +index 587e9d3..c54059d 100644 --- a/ci/install-thrift.sh +++ b/ci/install-thrift.sh -@@ -4,25 +4,49 @@ +@@ -4,25 +4,51 @@ # # SPDX-License-Identifier: Apache-2.0 @@ -85,6 +117,8 @@ index 587e9d3..9e37666 100644 + done + set -e +} ++ ++DEBUG_DUMP_DIR="${HOME}/install-p4dev-dumpdir" + THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) source $THIS_DIR/common.sh From 39c8b450636d947a76c9a4e417ddc507b6095625 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Sun, 9 Aug 2026 00:11:33 -0400 Subject: [PATCH 10/11] Try using uv for all/most Python package installations --- vm-ubuntu-24.04/install-p4dev-v8.sh | 32 ++++++++++++------- ...havioral-model-support-venv-2026-apr.patch | 9 +++--- ...ninet-patch-for-2024-sep-enable-venv.patch | 30 ++++++++++++----- 3 files changed, 47 insertions(+), 24 deletions(-) diff --git a/vm-ubuntu-24.04/install-p4dev-v8.sh b/vm-ubuntu-24.04/install-p4dev-v8.sh index 98304e46..39b06b74 100755 --- a/vm-ubuntu-24.04/install-p4dev-v8.sh +++ b/vm-ubuntu-24.04/install-p4dev-v8.sh @@ -594,12 +594,18 @@ TIME_AUTOTOOLS_END=$(date +%s) echo "autotools : $(($TIME_AUTOTOOLS_END-$TIME_AUTOTOOLS_START)) sec" DISK_USED_AFTER_AUTOTOOLS=`get_used_disk_space_in_mbytes` +# Install uv +curl -LsSf https://astral.sh/uv/install.sh | sh +which uv +uv pip list + # Create a new Python virtual environment using venv. Later we will # attempt to ensure that all new Python packages installed are # installed into this virtual environment, not into system-wide # directories like /usr/local/bin dump_python_lib_info "${DEBUG_DUMP_DIR}/008-just-before-venv-creation" -python3 -m venv "${PYTHON_VENV}" +#python3 -m venv "${PYTHON_VENV}" +uv venv "${PYTHON_VENV}" source "${PYTHON_VENV}/bin/activate" pip -V || echo "No such command in PATH: pip" @@ -613,6 +619,8 @@ pip3 -V || echo "No such command in PATH: pip3" pip list || echo "Some error occurred attempting to run command: pip" pip3 list || echo "Some error occurred attempting to run command: pip3" +uv pip list + cd "${INSTALL_DIR}" debug_dump_many_install_files ${INSTALL_DIR}/usr-local-1-before-protobuf.txt dump_python_lib_info "${DEBUG_DUMP_DIR}/010-before-installing-grpc" @@ -633,11 +641,11 @@ then if [ "${PROTOBUF_VERSION_FOR_PIP}" != "" ] then dump_python_lib_info "${DEBUG_DUMP_DIR}/013-just-before-installing-protobuf-via-pip" - pip3 install protobuf==${PROTOBUF_VERSION_FOR_PIP} + uv pip install protobuf==${PROTOBUF_VERSION_FOR_PIP} dump_python_lib_info "${DEBUG_DUMP_DIR}/015-after-installing-protobuf-via-pip" fi TIME_GRPC_INSTALL_END=$(date +%s) - pip3 list + uv pip list else # Do not bother installing protobuf package from source code, as # whatever parts of protobuf we need is installed as a result of @@ -646,7 +654,7 @@ else if [ "${PROTOBUF_VERSION_FOR_PIP}" != "" ] then dump_python_lib_info "${DEBUG_DUMP_DIR}/013-just-before-installing-protobuf-via-pip" - pip3 install protobuf==${PROTOBUF_VERSION_FOR_PIP} + uv pip install protobuf==${PROTOBUF_VERSION_FOR_PIP} dump_python_lib_info "${DEBUG_DUMP_DIR}/015-after-installing-protobuf-via-pip" fi @@ -982,8 +990,8 @@ fi # TODO: It appears that some changes were made from scapy 2.5.0 to # 2.6.0 that require changes in P4 open source tools in order to use # version 2.6.0. Until those changes are made, install scapy 2.5.0. -pip3 install scapy==2.5.0 ply -pip3 list +uv pip install scapy==2.5.0 ply +uv pip list dump_python_lib_info "${DEBUG_DUMP_DIR}/055-before-p4c-after-install-scapy" @@ -1114,7 +1122,7 @@ if [ "x${INSTALL_PTF_SOURCE_VERSION}" != "x" ]; then fi git log -n 1 dump_python_lib_info "${DEBUG_DUMP_DIR}/078-ptf-just-before-pip-install" -pip install . +uv pip install . dump_python_lib_info "${DEBUG_DUMP_DIR}/080-ptf-just-after-pip-install" TIME_PTF_END=$(date +%s) echo "p4lang/ptf : $(($TIME_PTF_END-$TIME_PTF_START)) sec" @@ -1143,7 +1151,7 @@ then sudo dnf -y install gflags-devel net-tools fi dump_python_lib_info "${DEBUG_DUMP_DIR}/084-before-pip-install-psutil-crcmod" -pip3 install psutil crcmod +uv pip install psutil crcmod dump_python_lib_info "${DEBUG_DUMP_DIR}/085-after-pip-install-psutil-crcmod" # Install p4runtime-shell from source repo, with a slightly modified @@ -1157,15 +1165,15 @@ dump_python_lib_info "${DEBUG_DUMP_DIR}/085-after-pip-install-psutil-crcmod" # First install a known working version of the grpcio package, because # otherwise installing p4runtime-shell packages will likely pick some # very recent version of grpcio that may cause trouble. -pip3 install wheel +uv pip install wheel dump_python_lib_info "${DEBUG_DUMP_DIR}/090-after-pip-install-wheel" if [ "${ID}" == "ubuntu" -a "${VERSION_ID}" == "24.04" ] then # Version 1.51.3 fails to install on Ubuntu 24.04 as of # 2024-May-20. - pip3 install grpcio==1.59.3 + uv pip install grpcio==1.59.3 else - pip3 install grpcio==1.51.3 + uv pip install grpcio==1.51.3 fi dump_python_lib_info "${DEBUG_DUMP_DIR}/095-after-pip-install-grpcio" @@ -1178,7 +1186,7 @@ git log -n 1 PATCH_DIR="${THIS_SCRIPT_DIR_ABSOLUTE}/patches" patch -p1 < "${PATCH_DIR}/p4runtime-shell-2023-changes.patch" dump_python_lib_info "${DEBUG_DUMP_DIR}/099-p4runtime-shell-just-before-pip-install" -pip3 install . +uv pip install . dump_python_lib_info "${DEBUG_DUMP_DIR}/100-p4runtime-shell-just-after-pip-install" pip3 list diff --git a/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch b/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch index d8d3ccc9..ca4cf7e1 100644 --- a/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch +++ b/vm-ubuntu-24.04/patches/behavioral-model-support-venv-2026-apr.patch @@ -46,7 +46,7 @@ index 675a329..54fcb3d 100644 +dump_python_lib_info "${DEBUG_DUMP_DIR}/033c-behavioral-model-just-after-nanomsg-cmake-install" cd .. diff --git a/ci/install-pynng.sh b/ci/install-pynng.sh -index 6abcd8e..e3bf768 100644 +index 6abcd8e..3b4ae9f 100644 --- a/ci/install-pynng.sh +++ b/ci/install-pynng.sh @@ -4,5 +4,34 @@ @@ -82,10 +82,11 @@ index 6abcd8e..e3bf768 100644 +DEBUG_DUMP_DIR="${HOME}/install-p4dev-dumpdir" + set -e - python3 -m pip install --upgrade pynng==0.9.0 +-python3 -m pip install --upgrade pynng==0.9.0 ++uv pip install pynng==0.9.0 +dump_python_lib_info "${DEBUG_DUMP_DIR}/034-behavioral-model-just-after-pip-install-pynng" diff --git a/ci/install-thrift.sh b/ci/install-thrift.sh -index 587e9d3..c54059d 100644 +index 587e9d3..088569d 100644 --- a/ci/install-thrift.sh +++ b/ci/install-thrift.sh @@ -4,25 +4,51 @@ @@ -148,5 +149,5 @@ index 587e9d3..c54059d 100644 -cd ../../.. +dump_python_lib_info "${DEBUG_DUMP_DIR}/032-behavioral-model-just-before-pip-install-thrift" +cd .. -+pip install thrift==0.16.0 ++uv pip install thrift==0.16.0 +dump_python_lib_info "${DEBUG_DUMP_DIR}/033-behavioral-model-just-after-pip-install-thrift" diff --git a/vm-ubuntu-24.04/patches/mininet-patch-for-2024-sep-enable-venv.patch b/vm-ubuntu-24.04/patches/mininet-patch-for-2024-sep-enable-venv.patch index cc084f84..f7c79837 100644 --- a/vm-ubuntu-24.04/patches/mininet-patch-for-2024-sep-enable-venv.patch +++ b/vm-ubuntu-24.04/patches/mininet-patch-for-2024-sep-enable-venv.patch @@ -1,5 +1,5 @@ diff --git a/util/install.sh b/util/install.sh -index bf4492d..998cc22 100755 +index bf4492d..1b79b01 100755 --- a/util/install.sh +++ b/util/install.sh @@ -5,6 +5,7 @@ @@ -18,7 +18,7 @@ index bf4492d..998cc22 100755 # Starting around 20.04, installing pyflakes instead of pyflakes3 # causes Python 2 to be installed, which is exactly NOT what we want. if [ "$DIST" = "Ubuntu" -a `expr $RELEASE '>=' 20.04` = "1" ]; then -@@ -187,10 +189,17 @@ function mn_deps { +@@ -187,23 +189,19 @@ function mn_deps { pf=pyflakes3 pep8=python3-pep8 fi @@ -35,21 +35,35 @@ index bf4492d..998cc22 100755 net-tools ${PYPKG}-tk + $install --no-install-recommends $pf $pep8 - # Install pip - $install ${PYPKG}-pip || $install ${PYPKG}-pip-whl -@@ -211,7 +220,10 @@ function mn_deps { +- # Install pip +- $install ${PYPKG}-pip || $install ${PYPKG}-pip-whl +- if ! ${PYTHON} -m pip -V; then +- if [ $PYTHON_VERSION == 2 ]; then +- wget https://bootstrap.pypa.io/pip/2.7/get-pip.py +- else +- wget https://bootstrap.pypa.io/get-pip.py +- fi +- sudo ${PYTHON} get-pip.py +- rm get-pip.py +- fi +- ${python} -m pip install pexpect ++ uv pip install pexpect + $install iproute2 || $install iproute + $install cgroup-tools || $install cgroup-bin + $install cgroupfs-mount +@@ -211,7 +209,10 @@ function mn_deps { echo "Installing Mininet core" pushd $MININET_DIR/mininet - sudo PYTHON=${PYTHON} make install + sudo PYTHON=${PYTHON} make install-mnexec + sudo PYTHON=${PYTHON} make install-manpages -+ ${PYTHON} -m pip uninstall -y mininet || true -+ ${PYTHON} -m pip install -e . --no-binary :all: ++ uv pip uninstall -y mininet || true ++ uv pip install -e . --no-binary :all: popd } -@@ -303,7 +315,7 @@ function install_wireshark { +@@ -303,7 +304,7 @@ function install_wireshark { if ! which wireshark; then echo "Installing Wireshark" if [ "$DIST" = "Fedora" -o "$DIST" = "RedHatEnterpriseServer" ]; then From 3f7bd2e3c2b6934ba77fd6afa2d7557d0a59edb9 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Sun, 9 Aug 2026 00:15:29 -0400 Subject: [PATCH 11/11] Update PATH after installing uv --- vm-ubuntu-24.04/install-p4dev-v8.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vm-ubuntu-24.04/install-p4dev-v8.sh b/vm-ubuntu-24.04/install-p4dev-v8.sh index 39b06b74..287286a3 100755 --- a/vm-ubuntu-24.04/install-p4dev-v8.sh +++ b/vm-ubuntu-24.04/install-p4dev-v8.sh @@ -596,6 +596,9 @@ DISK_USED_AFTER_AUTOTOOLS=`get_used_disk_space_in_mbytes` # Install uv curl -LsSf https://astral.sh/uv/install.sh | sh +echo $PATH +source $HOME/.local/bin/env +echo $PATH which uv uv pip list