r/redhat•
omento

[Question] Enabling Rootless User Namespaces? - RHEL 7.7

I haven't tried on a base 7.7 installation, but upgrading a 7.6 VM to 7.7 rootless containers with podman don't work out-of-the-box. There's still some configuration to be done. Personally was hoping for a RHEL 8 experience of everything just working, but it probably would if it wasn't an upgrade that would alter pre-existing configurations.

The only documentation I've found so far are the following, but something in the RHEL 7.7 docs themselves would be nice. Not sure if Atomic's instructions are 100% applicable, or if the preview is still accurate from 7.6.

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html/getting_started_with_containers/get_started_with_container_images#user_namespaces_options

https://www.redhat.com/en/blog/preview-running-containers-without-root-rhel-76

----------------------------------

Update

Alright, so I was able to get it working and it's fairly simple. The only catch is permissions on entitlement certs which are different by default in 7.7 than below (but don't get altered to match during the 7.7 upgrade). Tracking that in this Bugzilla report.

Steps:

  1. Upgrade to or Install RHEL 7.7
  2. Enable the optional and extras repositories:
  3. Provide max_user_namespaces value. I use 15064 as it's the default for the other max_*_namespaces attributes.
  4. Reload sysctl
  5. Fix permissions on certs if upgrading to 7.7.
  6. Add existing users to /etc/subuid and /etc/subgid manually. Newly created users get added automatically. *
  7. Install podman and slirp4netns
  8. Be rootless

​

$ sudo subscription-manager repos \
    --enable rhel-7-server-optional-rpms \
    --enable rhel-7-server-extras-rpms

$ sudo su -c 'echo "user.max_user_namespaces=15064" > /etc/sysctl.d/00-namespaces.conf'

$ sudo sysctl --system

$ sudo su -c 'echo "<user>:100000:65536" >> /etc/subuid'
$ sudo su -c 'echo "<user>:100000:65536" >> /etc/subgid'

$ sudo chmod 644 /etc/pki/entitlements/<value>-key.pem

$ sudo yum install podman slirp4netns -y

* Example subgid and subuid files:

user0:100000:65536
user1:165536:65536
user2:231072:65536

Posted Aug 13, 2019, 6:41 PM UTC · edited

60
slack1994•

Thanks, I also had to run:

podman system migrate

Probably because I had started from an older version of podman and upgraded.

1