Heimdall container service is not starting

Hi

I created container of heimdall, for auto-start at boot in podman I created a service using “podman generate systemd” command .

When I tried to start the service using “sytemctl start heimdall.service”, I am getting this error
"Job for heimdall.service failed because the control process exited with error code.
See “systemctl status heimdall.service” and “journalctl -xeu heimdall.service” for details."

How to rectifiy this issue.

Regards
Rajesh

Please give us also the output of the commands above. Paste them please as preformated text </> here.

$ systemctl status heimdall.service

× heimdall.service - Podman container-heimdall.service
     Loaded: loaded (/etc/systemd/system/heimdall.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Wed 2022-08-10 11:50:42 IST; 16min ago
       Docs: man:podman-generate-systemd(1)
    Process: 1393 ExecStartPre=/bin/rm -f /run/heimdall.service.ctr-id (code=exited, status=0/SUCCESS)
    Process: 1394 ExecStart=/usr/bin/podman run --cidfile=/run/heimdall.service.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --re>
    Process: 1405 ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=/run/heimdall.service.ctr-id (code=exited, status=125)
   Main PID: 1394 (code=exited, status=125)
        CPU: 199ms

$journalctl -xeu heimdall.service

Aug 10 11:50:42 nemo systemd[1]: heimdall.service: Scheduled restart job, restart counter is at 6.
Aug 10 11:50:42 nemo systemd[1]: Stopped heimdall.service - Podman container-heimdall.service.
Aug 10 11:50:42 nemo systemd[1]: heimdall.service: Start request repeated too quickly.
Aug 10 11:50:42 nemo systemd[1]: heimdall.service: Failed with result 'exit-code'.
Aug 10 11:50:42 nemo systemd[1]: Failed to start heimdall.service - Podman container-heimdall.service.

Aug 10 11:50:42 nemo systemd[1]: heimdall.service: Scheduled restart job, restart counter is at 6.
â–‘â–‘ Subject: Automatic restarting of a unit has been scheduled
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
â–‘â–‘ 
â–‘â–‘ Automatic restarting of the unit heimdall.service has been scheduled, as the result for
â–‘â–‘ the configured Restart= setting for the unit.
Aug 10 11:50:42 nemo systemd[1]: Stopped heimdall.service - Podman container-heimdall.service.
â–‘â–‘ Subject: A stop job for unit heimdall.service has finished
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
â–‘â–‘ 
â–‘â–‘ A stop job for unit heimdall.service has finished.
â–‘â–‘ 
â–‘â–‘ The job identifier is 2120 and the job result is done.
Aug 10 11:50:42 nemo systemd[1]: heimdall.service: Start request repeated too quickly.
Aug 10 11:50:42 nemo systemd[1]: heimdall.service: Failed with result 'exit-code'.
â–‘â–‘ Subject: Unit failed
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
â–‘â–‘ 
â–‘â–‘ The unit heimdall.service has entered the 'failed' state with result 'exit-code'.
Aug 10 11:50:42 nemo systemd[1]: Failed to start heimdall.service - Podman container-heimdall.service.
â–‘â–‘ Subject: A start job for unit heimdall.service has failed
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
â–‘â–‘ 
â–‘â–‘ A start job for unit heimdall.service has finished with a failure.
â–‘â–‘ 
â–‘â–‘ The job identifier is 2120 and the job result is failed.

Hi I got the solution,

Previously, I was logged as user and placed systemd units in this location under /etc/systemd/systemctl, I’ve modified the location to ~/.config/systemd/user and used the following commands to enable and start the service.

$ systemctl --user enable heimdall.service
$ systemctl --user start heimdall.service

Now my pods are starting after reboot.

Reference Video :Managing Containers in Podman with Systemd Unit Files - YouTube

2 Likes

I’ve had problems with this as systemd wouldn’t start the container until that user had logged in after reboot and the process was getting killed after a while of idle time. One workaround is to make it a system systemd service but set the User= to the user who owns the container runtime so it’s not dependent on the login.