Hi,
When my Zynthian v5.1 ORAM-2504.1 is running without a network, the journal is flooded with filebrowser restart and error messages. They are fired once every 2 seconds, so after a while there are hundreds of these messages making journalctl
unusable.
May 27 14:45:15 zynthian systemd[1]: filebrowser.service: Scheduled restart job, restart counter is at 1.
May 27 14:45:15 zynthian systemd[1]: Stopped filebrowser.service - Zynthian File Browser.
May 27 14:45:15 zynthian systemd[1]: Started filebrowser.service - Zynthian File Browser.
May 27 14:45:15 zynthian filebrowser.sh[1087]: Error: flag needs an argument: 'a' in -a
May 27 14:45:15 zynthian filebrowser.sh[1087]: Usage:
May 27 14:45:15 zynthian filebrowser.sh[1087]: filebrowser [flags]
May 27 14:45:15 zynthian filebrowser.sh[1087]: filebrowser [command]
May 27 14:45:15 zynthian filebrowser.sh[1087]: Available Commands:
May 27 14:45:15 zynthian filebrowser.sh[1087]: cmds Command runner management utility
May 27 14:45:15 zynthian filebrowser.sh[1087]: completion Generate the autocompletion script for the specified shell
May 27 14:45:15 zynthian filebrowser.sh[1087]: config Configuration management utility
May 27 14:45:15 zynthian filebrowser.sh[1087]: hash Hashes a password
May 27 14:45:15 zynthian filebrowser.sh[1087]: help Help about any command
May 27 14:45:15 zynthian filebrowser.sh[1087]: rules Rules management utility
May 27 14:45:15 zynthian filebrowser.sh[1087]: upgrade Upgrades an old configuration
May 27 14:45:15 zynthian filebrowser.sh[1087]: users Users management utility
May 27 14:45:15 zynthian filebrowser.sh[1087]: version Print the version number
May 27 14:45:15 zynthian filebrowser.sh[1087]: Flags:
May 27 14:45:15 zynthian filebrowser.sh[1087]: -a, --address string address to listen on (default ">
May 27 14:45:15 zynthian filebrowser.sh[1087]: -b, --baseurl string base url
May 27 14:45:15 zynthian filebrowser.sh[1087]: --cache-dir string file cache directory (disabled >
May 27 14:45:15 zynthian filebrowser.sh[1087]: -t, --cert string tls certificate
May 27 14:45:15 zynthian filebrowser.sh[1087]: -c, --config string config file path
May 27 14:45:15 zynthian filebrowser.sh[1087]: -d, --database string database path (default "./fileb>
May 27 14:45:15 zynthian filebrowser.sh[1087]: --disable-exec disables Command Runner feature
May 27 14:45:15 zynthian filebrowser.sh[1087]: --disable-preview-resize disable resize of image previews
May 27 14:45:15 zynthian filebrowser.sh[1087]: --disable-thumbnails disable image thumbnails
May 27 14:45:15 zynthian filebrowser.sh[1087]: --disable-type-detection-by-header disables type detection by read>
May 27 14:45:15 zynthian filebrowser.sh[1087]: -h, --help help for filebrowser
May 27 14:45:15 zynthian filebrowser.sh[1087]: --img-processors int image processors count (default>
May 27 14:45:15 zynthian filebrowser.sh[1087]: -k, --key string tls key
May 27 14:45:15 zynthian filebrowser.sh[1087]: -l, --log string log output (default "stdout")
May 27 14:45:15 zynthian filebrowser.sh[1087]: --noauth use the noauth auther when usin>
May 27 14:45:15 zynthian filebrowser.sh[1087]: --password string hashed password for the first u>
May 27 14:45:15 zynthian filebrowser.sh[1087]: -p, --port string port to listen on (default "808>
May 27 14:45:15 zynthian filebrowser.sh[1087]: -r, --root string root to prepend to relative pat>
May 27 14:45:15 zynthian filebrowser.sh[1087]: --socket string socket to listen to (cannot be >
May 27 14:45:15 zynthian filebrowser.sh[1087]: --socket-perm uint32 unix socket file permissions (d>
May 27 14:45:15 zynthian filebrowser.sh[1087]: --token-expiration-time string user session timeout (default ">
May 27 14:45:15 zynthian filebrowser.sh[1087]: --username string username for the first user whe>
May 27 14:45:15 zynthian filebrowser.sh[1087]: Use "filebrowser [command] --help" for more information about a command.
May 27 14:45:15 zynthian filebrowser.sh[1087]: 2025/05/27 14:45:15 flag needs an argument: 'a' in -a
May 27 14:45:15 zynthian systemd[1]: filebrowser.service: Main process exited, code=exited, status=1/FAILURE
May 27 14:45:15 zynthian systemd[1]: filebrowser.service: Failed with result 'exit-code'.
I repaired this by adding some conditions to the systemd service file (/etc/systemd/system/filebrowser.service
):
Original file:
[Unit]
Description=Zynthian File Browser
[Service]
Environment=HOME=/zynthian/zynthian-sw/filebrowser
Environment=ZYNTHIAN_DIR=/zynthian
Environment=ZYNTHIAN_SW_DIR=/zynthian/zynthian-sw
WorkingDirectory=/zynthian/zynthian-sw/filebrowser
ExecStart=/zynthian/zynthian-sys/sbin/filebrowser.sh
Restart=always
RestartSec=2
[Install]
WantedBy=multi-user.target
Adapted version:
- Added dependency on network (without network the browser is useless)
- limited the number of restarts to 2 (when it doesn’t work after two attempts, it probably won’t work at all)
- restart after 3 seconds (gives it a little more time)
[Unit]
Description=Zynthian File Browser
Wants=network-online.target
After=network-online.target
StartLimitIntervalSec=15
[Service]
Environment=HOME=/zynthian/zynthian-sw/filebrowser
Environment=ZYNTHIAN_DIR=/zynthian
Environment=ZYNTHIAN_SW_DIR=/zynthian/zynthian-sw
WorkingDirectory=/zynthian/zynthian-sw/filebrowser
ExecStart=/zynthian/zynthian-sys/sbin/filebrowser.sh
Restart=always
RestartSec=3
StartLimitBurst=2
[Install]
WantedBy=multi-user.target
Starting with network enabled the browser runs at first attempt.
When you start without a network and plug a cable in later, you can always start the filebrowser using the terminal: systemctl start filebrowser
. Or make a shell script fb
that contains this command.
Hope this helps someone.
Kind regards,
Hans.