Problem updating ospd-openvas

Hello I have a problem compiling ospd-openvas over th eold version:

Installing collected packages: ospd-openvas
Attempting uninstall: ospd-openvas
Found existing installation: ospd-openvas 22.5.3
Uninstalling ospd-openvas-22.5.3:
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: ‘/usr/local/bin/ospd-openvas’
Consider using the --user option or check the permissions

I have folowed suggestions from the archived post, but recieved the foloowing error:

sudo python3 -m pip uninstall ospd-openvas
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Any help would be appreciated

Here is my understanding of what is going on but I’m not 100% sure because I don’t know all the details of your system and installation process for these packages:

If you followed the Greenbone source code installation instructions precisely, you would not have used python-pip to install ospd-opvenvas. Since this is the source code installation method the package manager is not used because the package manager will not install the latest version that is available on GitHub.

Rather, you can see the package is imported from the GitHub repository and then installed into the $INSTALL directory, and then simply moved into its final destination in the Linux file structure.

From the install instructions:

cd $SOURCE_DIR/ospd-openvas-$OSPD_OPENVAS_VERSION

mkdir -p $INSTALL_DIR/ospd-openvas

python3 -m pip install --root=$INSTALL_DIR/ospd-openvas --no-warn-script-location .

sudo cp -rv $INSTALL_DIR/ospd-openvas/* /

So, to install the newer version you can just set the environment variable to the version you want to install and complete the rest of the install instructions.

export OSPD_OPENVAS_VERSION=22.6.0
1 Like

Hi,

this issue is caused by the famous PEP-668 which makes installing Python libraries system wide much more difficult. It seems you need to uninstall the old ospd-openvas installation first before being able to install the new one. I’ve to check how that can be done considering PEP 668.

2 Likes

Thank you for instructions. To give you more details on the installation. I have a fresh install of Debian: Linux debian 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64. This is system is soleley used for OpenVAS. OpenVAS community edition was install from source code and I followed the instructions on the site. The installation works perfectly since then.

Afterwards, I tryed to upgrade to the new version. As stated, I used the instructions on the site ( Workflows - Greenbone Community Documentation, the new virsion components should overwrite the old versions as needed. But the problem arises when updating components that pip installed, as ospd-openvas, notus-scanner, greenbone-feed-sync, gvm-tools.

When updating ospd-openvas ( Building 22.4 from Source - Greenbone Community Documentation) I get the following error. This happens with every component that uses python for instllation.

user@debian:~/build/openvas-scanner$ cd $SOURCE_DIR/ospd-openvas-$OSPD_OPENVAS_VERSION

mkdir -p $INSTALL_DIR/ospd-openvas

python3 -m pip install --root=$INSTALL_DIR/ospd-openvas --no-warn-script-location .

sudo cp -rv $INSTALL_DIR/ospd-openvas/* /
Processing /home/user/source/ospd-openvas-22.6.0
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing metadata (pyproject.toml) … done
Requirement already satisfied: defusedxml<0.8,>=0.6 in /usr/lib/python3/dist-packages (from ospd-openvas==22.6.0) (0.7.1)
Requirement already satisfied: deprecated<2.0.0,>=1.2.10 in /usr/lib/python3/dist-packages (from ospd-openvas==22.6.0) (1.2.13)
Requirement already satisfied: lxml<5.0.0,>=4.5.2 in /usr/lib/python3/dist-packages (from ospd-openvas==22.6.0) (4.9.2)
Requirement already satisfied: packaging<24.0,>=20.4 in /usr/lib/python3/dist-packages (from ospd-openvas==22.6.0) (23.0)
Requirement already satisfied: paho-mqtt>=1.5.1 in /usr/lib/python3/dist-packages (from ospd-openvas==22.6.0) (1.6.1)
Requirement already satisfied: psutil<6.0.0,>=5.5.1 in /usr/lib/python3/dist-packages (from ospd-openvas==22.6.0) (5.9.4)
Requirement already satisfied: python-gnupg<0.6.0,>=0.4.8 in /usr/local/lib/python3.11/dist-packages (from ospd-openvas==22.6.0) (0.5.1)
Requirement already satisfied: redis>=4.5.0 in /usr/local/lib/python3.11/dist-packages (from ospd-openvas==22.6.0) (5.0.1)
Requirement already satisfied: wrapt<2,>=1.10 in /usr/lib/python3/dist-packages (from deprecated<2.0.0,>=1.2.10->ospd-openvas==22.6.0) (1.14.1)
Requirement already satisfied: async-timeout>=4.0.2 in /usr/lib/python3/dist-packages (from redis>=4.5.0->ospd-openvas==22.6.0) (4.0.2)
Building wheels for collected packages: ospd-openvas
Building wheel for ospd-openvas (pyproject.toml) … done
Created wheel for ospd-openvas: filename=ospd_openvas-22.6.0-py3-none-any.whl size=111572 sha256=f988368e2eb0c95b2b10c174abf4ef2bf7b4585a071d760d6934a6a35097ab13
Stored in directory: /home/user/.cache/pip/wheels/47/1a/1a/55ba6792285168442c6350a0ca553ddcee729f629f75b44200
Successfully built ospd-openvas
Installing collected packages: ospd-openvas
Attempting uninstall: ospd-openvas
Found existing installation: ospd-openvas 22.5.3
Uninstalling ospd-openvas-22.5.3:
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: ‘/usr/local/bin/ospd-openvas’
Consider using the --user option or check the permissions.

cp: cannot stat ‘/home/user/install/ospd-openvas/*’: No such file or directory

When trying to uninstall the respective compnent manually, I still get error as stated in my initial post.

I’ve tested the setup now.

sudo python3 -m pip uninstall ospd-openvas --break-system-packages should remove the previous installed ospd-openvas version.

3 Likes

Thanks a lot! This worked! Maybe it should be included in the OpenVAS installation/upgrade instructions.