Rpm permission denied in distrobox

I’m running Fedora 41 in a distrobox on a Debian host. Permission is being denied for any kind of operation involving rpm:
sudo rpm --import [package]
returns
sudo: rpm: command not found

also during update:

>>> Running trigger-pre-install scriptlet: mesa-amdgpu-va-drivers-1:24.3.0.60301-20950
>>> Finished trigger-pre-install scriptlet: mesa-amdgpu-va-drivers-1:24.3.0.60301-2095
>>> Scriptlet output:
>>> /var/tmp/rpm-tmp.ZCmswy: line 5: /bin/rpm: Permission denied

This happens on multiple occasions at various packages that have post install scripts. However
sudo dnf install rpm
returns

Updating and loading repositories:
Repositories loaded.
Package "rpm-4.20.0-1.fc41.x86_64" is already installed.

Nothing to do.

How can I gain access to rpm inside distrobox?

Details of the container:
cat /etc/*-release

Fedora release 41 (Forty One)
NAME="Fedora Linux"
VERSION="41 (Container Image)"
RELEASE_TYPE=stable
ID=fedora
VERSION_ID=41
VERSION_CODENAME=""
PLATFORM_ID="platform:f41"
PRETTY_NAME="Fedora Linux 41 (Container Image)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:41"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f41/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=41
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=41
SUPPORT_END=2025-12-15
VARIANT="Container Image"
VARIANT_ID=container
Fedora release 41 (Forty One)
Fedora release 41 (Forty One)

uname -a

Linux SyDb 6.12.6-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.6-1 (2024-12-21) x86_64 GNU/Linux

There is an opinion that upgrading container images is not recommended. I don’t think it’s a big issue, as long as we accept the limitations, one of them being that post-install scripts often result in errors.

Regarging the rpm issue, I’m using a Fedora 41 image in Toolbx, not Distrobox, and don’t have such issues. Does reinstalling the rpm package via dnf work?

sudo dnf reinstall rpm

… or does it result in a circular issue?

Ok that did help, now I can use rpm but during installing apps I still get the following:

>>> Running trigger-install scriptlet: systemd-udev-0:256.10-1.fc41.x86_64
>>> Finished trigger-install scriptlet: systemd-udev-0:256.10-1.fc41.x86_64
>>> Scriptlet output:
>>> Failed to send reload request: Permission denied

Is this something I should be concerned about?

I could try to replicate in my fedora-toolbox-41 container. Can you give me an example of an install command that resulted in the above error?

Are you installing packages from the repos with dnf, or local packages with rpm? Are you receiving that error for simple package installations, e.g. sudo dnf install task as well?

I was trying to install this :

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null

as for the post install scripts like with the mesa-amdgpu-va-drivers that was just a regular update

sudo dnf update --refresh

Edit: I tested it and I can install local rpm packages.
Installations worked without errors as long as they didn’t have post install scripts before you advised to reinstall rpm. Just to make sure I’ve installed task using the command you suggested and it installed without any errors.

Also, thank you for taking your time to help me.

Happy to hear the installation of VSCode was successful!