I run my podman containers in unprivileged systemd user services. This has previously worked quite well. I wanted to use the RestrictAddressFamilies= option in systemd.exec to limit the containers to only the families AF_UNIX AF_NETLINK AF_INET AF_INET6.
This is because I run all the containers with --net=host, but want to limit access to a SocketCAN interface to just one container, with the addition of another option RestrictAddressFamilies=AF_CAN, making the allowed set AF_UNIX AF_NETLINK AF_INET AF_INET6 AF_CAN just for that one container.
With this I ran into a very strange issue, where with the RestrictAddressFamilies= option applied, the container fails to start with the message level=error msg="running/usr/bin/newuidmap 2742 0 1000 1 1 100000 65536: newuidmap: write to uid_map failed: Operation not permitted\n"
However, if any single Podman command is run outside of the service, the service immediately starts working. I'm guessing the RestrictAddressFamilies= option is somehow blocking the newuidmap call, but once that's setup once it doesn't need to be run again, and so the container in the restricted service begins to work without issue for the remaining time the system is up. Once rebooted, the issue arises again until another command is run manually.
Steps to reproduce the issue
Steps to reproduce the issue
Create the systemd user service file ~/.config/systemd/user/ros_humble_desktop.service
Issue Description
I run my podman containers in unprivileged systemd user services. This has previously worked quite well. I wanted to use the
RestrictAddressFamilies=
option in systemd.exec to limit the containers to only the familiesAF_UNIX AF_NETLINK AF_INET AF_INET6
.This is because I run all the containers with
--net=host
, but want to limit access to a SocketCAN interface to just one container, with the addition of another optionRestrictAddressFamilies=AF_CAN
, making the allowed setAF_UNIX AF_NETLINK AF_INET AF_INET6 AF_CAN
just for that one container.With this I ran into a very strange issue, where with the
RestrictAddressFamilies=
option applied, the container fails to start with the messagelevel=error msg="running
/usr/bin/newuidmap 2742 0 1000 1 1 100000 65536: newuidmap: write to uid_map failed: Operation not permitted\n"
However, if any single Podman command is run outside of the service, the service immediately starts working. I'm guessing the
RestrictAddressFamilies=
option is somehow blocking thenewuidmap
call, but once that's setup once it doesn't need to be run again, and so the container in the restricted service begins to work without issue for the remaining time the system is up. Once rebooted, the issue arises again until another command is run manually.Steps to reproduce the issue
Steps to reproduce the issue
~/.config/systemd/user/ros_humble_desktop.service
systemctl --user daemon-reload && systemctl --user enable --now ros_humble_desktop.service
journalctl --user-unit ros_humble_desktop.service -f
Describe the results you received
Repeated failure to start the service/container with the below:
Until I run a command like
podman info
outside the service, then it works:https://github.com/user-attachments/assets/70e33234-b1f4-4727-96d1-6f8c0780a8b1
Describe the results you expected
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
No
Additional environment details
Running inside a unprivileged systemd user service on Debian Linux 12 Bookworm.
Additional information
Only happens before any other Podman commands are run on the host, then it begins and stays working until reboot.