gerbera icon indicating copy to clipboard operation
gerbera copied to clipboard

Gerbera binds to non-existent/invalid IPv4 address

Open mill1000 opened this issue 2 years ago • 4 comments

Upon reboot, gerbera starts and binds to a non-existent/invalid IPv4 address. I've tried specifying the interface and it made no difference.

Jul 17 16:25:42 RockHole gerbera[1637]: 2022-07-17 16:25:42   info: Initialising UPnP with interface: eth0, port: <unset>
Jul 17 16:25:42 RockHole gerbera[1637]: 2022-07-17 16:25:42   info: IPv4: Server bound to: :49152
Jul 17 16:25:42 RockHole gerbera[1637]: 2022-07-17 16:25:42   info: IPv6: Server bound to: fe80::f9f2:31c6:219d:f9a7:49152
Jul 17 16:25:42 RockHole gerbera[1637]: 2022-07-17 16:25:42   info: IPv6 ULA/GLA: Server bound to: :49153
Jul 17 16:25:42 RockHole gerbera[1637]: 2022-07-17 16:25:42   info: Will send UPnP Alive advertisements every 60 seconds
Jul 17 16:25:42 RockHole gerbera[1637]: 2022-07-17 16:25:42   info: The Web UI can be reached by following this link: http://:49152

If I restart the service it binds as expected and the web interface is accessible.

My systemd service

[Unit]
Description=Gerbera Media Server
After=network.target network-online.target

[Service]
Type=simple
User=gerbera
Group=gerbera
ExecStart=/usr/local/bin/gerbera -c /etc/gerbera/config.xml -e eth0
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

mill1000 avatar Jul 17 '22 22:07 mill1000

Did you check your systemd units whether network.target or network-online.target exist. You may check the defaults of services like mysql or dhcpd.

KarlStraussberger avatar Aug 21 '22 12:08 KarlStraussberger

Both appear to exist

rock@RockHole:~ $ sudo systemctl status network.target
● network.target - Network
   Loaded: loaded (/lib/systemd/system/network.target; static; vendor preset: enabled)
   Active: active since Sun 2022-07-17 16:31:52 MDT; 1 months 6 days ago
     Docs: man:systemd.special(7)
           https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
rock@RockHole:~ $ sudo systemctl status network-online.target
● network-online.target - Network is Online
   Loaded: loaded (/lib/systemd/system/network-online.target; static; vendor preset: enabled)
   Active: active since Sun 2022-07-17 16:31:52 MDT; 1 months 6 days ago
     Docs: man:systemd.special(7)
           https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

dhcpd.service only asks for network.target

rock@RockHole:~ $ cat /lib/systemd/system/dhcpcd.service
[Unit]
Description=DHCP Client Daemon
Wants=network.target
Documentation=man:dhcpcd(8)

[Service]
Type=forking
ExecStart=/usr/sbin/dhcpcd
Restart=always

[Install]
WantedBy=multi-user.target

mill1000 avatar Aug 23 '22 23:08 mill1000

Should work as it is.

You may try to remove network.target from the After line and maybe add something like mysql.target (a service that works).

KarlStraussberger avatar Sep 05 '22 20:09 KarlStraussberger

Had the same issue. The solution for me was:

[Unit]
Description=Gerbera Media Server
After=network-online.target
Wants=network-online.target

Default gerbera.service doesn't wait until network is up.

brannegan avatar Sep 19 '22 05:09 brannegan

Thanks. I'll give that a shot. I've seen similar issues with hzeller/gmrender-resurrect

mill1000 avatar Sep 23 '22 01:09 mill1000