podman generate systemd --name logserver --files (--new did not work in RHCSA exam)

Greetings All,

I did clear my RHCSA exam. But I was curious as to why --new did not work while I was setting up container as a service.

Overall Steps followed:

Ran yum module install container-tools -y as root. Logged in as user "walhala" on node1 server and logged into the given registry. Then,

1) podman run -d --name logserver registry.example.com/rsyslog-cert 

2) loginctl enable-linger walhala

3) mkdir -p ~/.config/systemd/user ; cd ~/.config/systemd/user

4) podman generate systemd --name logserver --files # worked
podman generate systemd --name logserver --files --new # Did not work

5) cd; podman stop logserver; podman rm logserver

6) systemctl --user daemon reload

7) systemctl --user enable --now container-logserver.service

After reboot, container was getting created but had to be started using "systemctl --user start container-logserver.service".

Anyone knows what I could have done to fix this issue?

0 Kudos
3 Replies
Flight Engineer Flight Engineer
Flight Engineer

I use loginctl without my user name:

$ loginctl enable-linger

It also works with the user name on RHEL-8.6, but loginctl in older RHEL releases might have a bug.


Flight Engineer
Flight Engineer

Hi OliverPereira, i also have this question that why this container service not configured propoerly, but still could not find answer from anywhere.

i also passed RHCSA couple of weeks back. but still confused about this question.

in my exam, podman gives error and dont recognize the "generate systemd".

.............strange .........


0 Kudos
Flight Engineer
Flight Engineer

My instructor said that the shell used while setting up a systemd account matters for containers starting on boot.

So what I was told to do is run a couple of steps before yours:

1. create a new user (and not as a system account type, oddly enough)

2. ssh into the box as this new user (don't su -, again a bit odd)

then continue with your commands. 


So the container-as-a-service runs as this new user, and the container starts up after reboot.

Sr. Solution Architect
0 Kudos
Join the discussion
You must log in to join this conversation.