-
Notifications
You must be signed in to change notification settings - Fork 23
Improve the README and rework the installation script. #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Dscano <d.scano89@gmail.com>
|
@Dscano Looks good to me |
Co-authored-by: Fabian Ruffy <5960321+fruffy@users.noreply.github.com> Signed-off-by: Davide Scano <d.scano89@gmail.com>
|
@jafingerhut @swaroopsarma can you review my PR? |
swaroopsarma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
| @@ -0,0 +1,88 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the version of install_p4_dpdk.sh as of commit 2 on 2026-Feb-01 from this PR's diff to a freshly installed Ubuntu 24.04 system running on an x86_64 processor.
The first problem encountered was that no Python module distutils was found:
$ ./install_p4_dpdk.sh |& tee log-try1.txt
=== P4 DPDK Target Installation Script ===
==> 1/5 Cloning p4-dpdk-target...
Cloning into 'p4-dpdk-target'...
==> 2/5 Installing system dependencies...
Updated Environment Variables ...
SDE: /home/p4/sde
SDE_INSTALL: /home/p4/sde/install
LD_LIBRARY_PATH: /home/p4/sde/install/lib:/home/p4/sde/install/lib64:/home/p4/sde/install/lib/x86_64-linux-gnu/:/usr/local/lib64:/usr/local/lib
./install_p4_dpdk.sh: line 40: pip3: command not found
Traceback (most recent call last):
File "/home/p4/sde/p4-dpdk-target/tools/setup/install_dep.py", line 16, in <module>
from sysutils import Platforms
File "/home/p4/sde/p4-dpdk-target/tools/setup/sysutils.py", line 20, in <module>
from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
The second problem occurred during this step: "==> 3/5 Building p4-dpdk-target...". It could not find the command autoreconf:
./autogen.sh: 3: exec: autoreconf: not found
The README.md changes proposed in this PR do not mention any prerequisites or other commands that should be run before .install_p4_dpdk.sh, so it seems best if install_p4_dpdk.sh installs any packages that it requires. If these installation steps require a particular distribution of Linux, it seems reasonable to document what distributions the script has been tested on in the README.md file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll run it on Ubuntu 24.04 and I'll fix it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect the issues I found are not a difference between Ubuntu 22.04 and Ubuntu 24.04, but between a fresh minimal install of Ubuntu vs. many packages already installed. If you have an easy way to create a fresh minimal install of Ubuntu 22.04 (or 24.04), I suspect you should experience the same issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have address your comment, but I have to test it on Ubuntu 24.04 and 22.04
Signed-off-by: Dscano <d.scano89@gmail.com>
install_p4_dpdk.sh
Outdated
| if ! command -v "$cmd" >/dev/null 2>&1; then | ||
| echo -e "${YELLOW}$cmd not found.${NC}" | ||
| read -r -p "Install $pkgs now? [y/N] " reply | ||
| if [[ "$reply" =~ ^[Yy]$ ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why bother asking the user if they want to do this? If they answer no, the script is likely to fail later, yes? I would recommend doing the install without asking.
install_p4_dpdk.sh
Outdated
| source p4sde_env_setup.sh $SDE | ||
| [[ -f /etc/os-release ]] && . /etc/os-release | ||
|
|
||
| if [[ "${ID:-}" == "ubuntu" ]] && dpkg --compare-versions "${VERSION_ID:-0}" ge "23.04" 2>/dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating the Python venv should also work on older Ubuntu versions. I know for certain that Python venv's can be created and used just fine on Ubuntu 20.04 and Ubuntu 22.04, which are the oldest versions someone is likely to be using nowadays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reworked the script and tested it on Ubuntu 24.04. I still need to test it on 22.04. I noticed that the script gets stuck at connect-proxy in 22.04 and 24.04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried out the latest version of the script. For me it hangs when waiting for an interactive prompt while installing Wireshark, with no way that I can see to answer the prompt.
By adding these lines into the install_p4_dpdk.sh script it will install wireshark first, without any interactive question being asked of the user, and then later it will see that wireshark is already installed and not need to ask any interactive questions:
# 0. Check Dependencies (install if missing)
# ------------------------------------------------------------
print_step "0/5 Checking dependencies..."
+
+# Install Wireshark and tshark on Ubuntu system without having to
+# answer _any_ questions interactively, except perhaps providing your
+# password when prompted by 'sudo'.
+# https://askubuntu.com/questions/1275842/install-wireshark-without-confirm
+echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections
+sudo DEBIAN_FRONTEND=noninteractive apt-get -y install wireshark tshark
+
check_and_install "pip3" "python3-pip"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you tried it on Ubuntu 24.04?
I have experienced the same with connect-proxy . I'll test the script again as soon as possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tried on Ubuntu 24.04 recently, but can do so. The only occurrence of connect-proxy in the p4-dpdk-target repo is to install the package. I am guessing you are finding connect-proxy hanging later when it is executed, not when its package is installed?
Do you know which invocation of connect-proxy is causing this hang for you? I am guessing it is in one of the several other git repos or submodules that ./install_p4_dpdk.sh clones, since it isn't in p4-dpdk-target repo.
When you are testing it, are you in a place in the network that requires an HTTP proxy to get out to the public Internet? I have been testing it from a home system where there are no proxies between me and the public Internet, so perhaps the install scripts somehow detect that and skip running connect-proxy. Or perhaps the execution of connect-proxy is conditional, depending on the value of some environment variables that I am not setting, but you are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ubuntu 24.04 on x86_64 install_p4_dpdk.sh also fails, but for a different reason. Ubuntu 24.04 has Python version 3.12 by default, whereas Ubuntu 22.04 has Python version 3.10 by default. Apparently the distutils package is supported for version 3.10, but is deprecated and not available to install for Python 3.12.
Until someone figures out how to make p4-dpdk-target install using a more recent Python package creation/install method than distutils (perhaps setuptools), I would recommend simply documenting this incompatibility, and link to an issue created to track this incompatibility with Ubuntu 24.04.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested my script on Ubuntu 22.04.5 LTS and the results are attached. The installation script succeeded, but I had to I run sudo fuser -vki /var/lib/dpkg/lock-frontend to release the lock. Otherwise, it stays stuck at the connect-proxy step.
I still have to test if the p4-dpdk is working.
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
connect-proxy
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/22,0 kB of archives.
After this operation, 65,5 kB of additional disk space will be used.
Selecting previously unselected package connect-proxy.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 231581 files and directories currently installed.)
Preparing to unpack .../connect-proxy_1.105-1.2_amd64.deb ...
Unpacking connect-proxy (1.105-1.2) ...
Setting up connect-proxy (1.105-1.2) ...
Processing triggers for man-db (2.10.2-1) ...
I didn't have any proxy configured in my host machine and VM. I didn't had any issue with wireshark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at the logs, and note two things:
- When you did Ctrl-C, the Python stack trace shows that it was executing function execute_system_command. Reading the source of that function, it appears not to print anything. Only the place where execute_system_command is called prints something, if execute_system_command returns. In the stack trace, it must have returned and printed successfully for connect-proxy, so it must be on the next call to execute_system_command after the one where it installs connect-proxy.
- The next package to install after connect-proxy is tshark, which also installs wireshark. I have also seen installing that package hang indefinitely, because it is waiting for input that you cannot see, because the way it is being installed it is not showing you the interactive prompt.
If you try with the changes in my earlier command that install wireshark separately, before the install_dep.py program begins running, it installs wireshark in a way that does not require any interactive prompting, successfully, and so later when install_dep.py runs the apt command to install tshark notices that it is already installed, and quickly completes successfully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch Andy, indeed now is working smooth on Ubuntu 22.04.5 LTS.
Regarding Ubuntu 24.04 I did a try with pip3 install setuptools and then pip3 install distro, but I have to tested it properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added this line :
source ./p4sde_env_setup.sh "$SDE"
**pip3 install setuptools**
pip3 install distro
python3 install_dep.py
I got a few more warnings during the installation, but it succeeded on Ubuntu 24.04
Signed-off-by: Dscano <d.scano89@gmail.com>
Signed-off-by: dscano <d.scano89@gmail.com>
|
@Dscano @jafingerhut I have tested |
Signed-off-by: Dscano <dscano89@gmail.com>
I submitter this PR because the
install_dpdk.shfails onUbuntu 22.04.4 LTS.I have reworked the script and run it on
Ubuntu 22.04.4 LTSand it is working fine@jafingerhut @shweta503 Can you review it ?