Autostart Jellyfin podman container

Hey there, I need some help!
I always used Jellyfin with docker-compose, but right now I’m trying to embrace the podman way, even though I never used it before.
I managed to create a working container following the official docs, so just launching the following command does start Jellyfin correctly:

podman run  \
        --detach  \
        --label "io.containers.autoupdate=registry"  \
        --name jellyfin  \
        --publish 8096:8096/tcp  \
        --rm  \
        --user $(id -u):$(id -g)  \
        --userns keep-id  \
        --volume jellyfin-cache:/cache:Z  \
        --volume jellyfin-config:/config:Z  \
        --mount type=bind,source=/mnt/Kingston,destination=/media,ro=false,relabel=shared  \
        docker.io/jellyfin/jellyfin:latest

Now the problem is that I can’t find a way to autostart this container on boot.
With docker-compose I didn’t have to do anything beside enabling the docker daemon.
With podman, following the docs again, I created ~/.config/containers/systemd/jellyfin.container, which contains:

[Container]
Image=docker.io/jellyfin/jellyfin:latest
AutoUpdate=registry
PublishPort=8096:8096/tcp
UserNS=keep-id
Volume=jellyfin-config:/config:Z
Volume=jellyfin-cache:/cache:Z
Volume=/mnt/Kingston:/media:z

[Service]
# Inform systemd of additional exit status
SuccessExitStatus=0 143

[Install]
# Start by default on boot
WantedBy=default.target

But when I do systemctl --user daemon-reload && systemctl --user start jellyfin, the service seems to start correctly, but I can’t connect to Jellyfin.

Doing systemctl --user status jellyfin shows this:

○ jellyfin.service
     Loaded: loaded (/home/andrea/.config/containers/systemd/jellyfin.container; generated)
    Drop-In: /usr/lib/systemd/user/service.d
             └─10-timeout-abort.conf
     Active: inactive (dead) since Mon 2024-09-09 10:36:36 CEST; 18min ago
   Duration: 38ms
    Process: 9331 ExecStart=/usr/bin/podman run --name=systemd-jellyfin --cidfile=/run/user/1000/jellyfin.cid --replace --rm --cgroups=split --sdnotify=conmon -d --userns keep-id -v je>
    Process: 9384 ExecStop=/usr/bin/podman rm -v -f -i --cidfile=/run/user/1000/jellyfin.cid (code=exited, status=0/SUCCESS)
    Process: 9444 ExecStopPost=/usr/bin/podman rm -v -f -i --cidfile=/run/user/1000/jellyfin.cid (code=exited, status=0/SUCCESS)
   Main PID: 9331 (code=exited, status=0/SUCCESS)
        CPU: 94ms

set 09 10:36:36 fedora systemd[1913]: Starting jellyfin.service...
set 09 10:36:36 fedora systemd[1913]: Started jellyfin.service.

So it seems like something is wrong, but I really cannot understand what’s the problem.

I could just give up and install Jellyfin from rpmfusion, but I’d like to keep it portable.

So, can you help me figure this out?

Thanks!

PS. Note that manually launching the container with podman run... still works. The problem is with the systemd service

Hiya! If you’re running the service at user level I think you need to enable session linger.
I found this old question that looks similar, can you give it a shot?

Hey, thank you for your answer!
I just enabled linger, but unfortunately nothing changes. With systemctl --user start jellyfin.service the service starts, but it’s still dead.

Trying to enable it instead it gives me this error:

Failed to enable unit: Unit /run/user/1000/systemd/generator/jellyfin.service is transient or generated.

I’m not an expert but I think you can’t manually enable services generated by quadlets, they’re enabled based on the Install section.
Is there anything interesting if you get the logs?
journalctl --user -u jellyfin

Oh, I see, didn’t know that. Thanks.

Not very much to me, but hopefully it speaks to someone. It just says it’s failing, I have no idea what “protocol” means in this context…

-- Boot 3063a99483be4195a098ad8e1055a385 --
set 11 09:56:08 fedora systemd[1789]: Starting jellyfin.service...
set 11 09:56:08 fedora podman[1886]: 2024-09-11 09:56:08.891394565 +0200 CEST m=+0.156074716 system refresh
set 11 09:56:08 fedora podman[1886]: 2024-09-11 09:56:08.948772785 +0200 CEST m=+0.213452936 container create 8e253b3e67a0b8fa2e4906acc8192d8a854d84b553968fc79c40cefbe15cf29b (image=docker.io/jellyfin/jellyfin:l>
set 11 09:56:08 fedora podman[1886]: 2024-09-11 09:56:08.924032016 +0200 CEST m=+0.188712177 image pull de4f7879e9d1e9e33507239cdb2cfc2b8df7b361ecf2cbb45a340dd3a71747ba docker.io/jellyfin/jellyfin:latest
set 11 09:56:09 fedora podman[1886]: 2024-09-11 09:56:09.637344118 +0200 CEST m=+0.902024290 container init 8e253b3e67a0b8fa2e4906acc8192d8a854d84b553968fc79c40cefbe15cf29b (image=docker.io/jellyfin/jellyfin:lat>
set 11 09:56:09 fedora podman[1886]: 2024-09-11 09:56:09.664710175 +0200 CEST m=+0.929390326 container start 8e253b3e67a0b8fa2e4906acc8192d8a854d84b553968fc79c40cefbe15cf29b (image=docker.io/jellyfin/jellyfin:la>
set 11 09:56:09 fedora systemd[1789]: jellyfin.service: Failed with result 'protocol'.
set 11 09:56:09 fedora systemd[1789]: Failed to start jellyfin.service.
set 11 10:21:19 fedora systemd[1789]: Starting jellyfin.service...
set 11 10:21:19 fedora systemd[1789]: Started jellyfin.service.