Jellyfin Forum
SOLVED: I restarted my server from web (button), but failed to restart. - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: SOLVED: I restarted my server from web (button), but failed to restart. (/t-solved-i-restarted-my-server-from-web-button-but-failed-to-restart)

Pages: 1 2


I restarted my server from web (button), but failed to restart. - jaiovi - 2024-07-10

Hello! 
Jellyfin 1.9.7 - installed one liner
Ubuntu 22.0 A1 compute OCI

I restarted my server from web (button), but failed to restart. Trying to "sudo systemctl start jellyfin" again showed this status code

Code:
ubuntu@cine-kixta:/var/log/jellyfin$ sudo service jellyfin status
× jellyfin.service - Jellyfin
    Loaded: loaded (/etc/systemd/system/jellyfin.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/jellyfin.service.d
            └─jellyfin.service.conf
    Active: failed (Result: exit-code) since Wed 2024-07-10 14:31:56 UTC; 11min ago
    Process: 1727 ExecStart=/opt/jellyfin/jellyfin.sh (code=exited, status=203/EXEC)
  Main PID: 1727 (code=exited, status=203/EXEC)
        CPU: 764us

Jul 10 14:31:56 cine-kixta systemd[1]: jellyfin.service: Scheduled restart job, restart counter is at 5.
Jul 10 14:31:56 cine-kixta systemd[1]: Stopped Jellyfin.
Jul 10 14:31:56 cine-kixta systemd[1]: jellyfin.service: Start request repeated too quickly.
Jul 10 14:31:56 cine-kixta systemd[1]: jellyfin.service: Failed with result 'exit-code'.
Jul 10 14:31:56 cine-kixta systemd[1]: Failed to start Jellyfin.

I noticed that in /var/logs/jellyfin this status

Code:
[2024-07-10 13:19:47.452 +00:00] [INF] Remote IP filter is "Allowlist"
[2024-07-10 13:19:47.453 +00:00] [INF] Filtered subnets: []
[2024-07-10 13:19:47.575 +00:00] [FTL] Error while starting server
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 8: 'attempt to write a readonly database'.
  at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
  at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
  at Emby.Server.Implementations.Data.SqliteExtensions.Execute(SqliteConnection sqliteConnection, String commandText)
  at Emby.Server.Implementations.Data.ManagedConnection.Execute(String commandText)
  at Emby.Server.Implementations.Data.BaseSqliteRepository.Initialize()
  at Emby.Server.Implementations.Data.SqliteItemRepository.Initialize()
  at Emby.Server.Implementations.ApplicationHost.InitializeServices()
  at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig)
[2024-07-10 13:19:47.583 +00:00] [INF] Running query planner optimizations in the database... This might take a while
[2024-07-10 13:19:47.585 +00:00] [INF] Disposing "CoreAppHost"
[2024-07-10 13:19:47.586 +00:00] [INF] Disposing "PluginManager"

I made chown to ubuntu and jellyfin, none of them worked

Code:
sudo chown -R jellyfin:jellyfin /var/lib/jellyfin

sudo chmod -R u+rw /var/lib/jellyfin

Even restarting, the log didnt regenerate (where's saved then?)

Also I noticed that /opt/jellyfin/jellyfin.sh didn't existed, so I created this file:
Code:
#!/bin/bash

/usr/bin/jellyfin

And now we have 1 exit code:
Code:
× jellyfin.service - Jellyfin
    Loaded: loaded (/etc/systemd/system/jellyfin.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/jellyfin.service.d
            └─jellyfin.service.conf
    Active: failed (Result: exit-code) since Wed 2024-07-10 14:59:26 UTC; 2s ago
    Process: 2374 ExecStart=/opt/jellyfin/jellyfin.sh (code=exited, status=1/FAILURE)
  Main PID: 2374 (code=exited, status=1/FAILURE)
        CPU: 327ms

Jul 10 14:59:26 cine-kixta systemd[1]: jellyfin.service: Scheduled restart job, restart counter is at 5.
Jul 10 14:59:26 cine-kixta systemd[1]: Stopped Jellyfin.
Jul 10 14:59:26 cine-kixta systemd[1]: jellyfin.service: Start request repeated too quickly.
Jul 10 14:59:26 cine-kixta systemd[1]: jellyfin.service: Failed with result 'exit-code'.
Jul 10 14:59:26 cine-kixta systemd[1]: Failed to start Jellyfin.


sudo journalctl -u jellyfin gets:
Code:
Jul 10 15:15:53 cine-kixta jellyfin.sh[2578]: [15:15:53] [INF] [1] Main: Log directory path: /home/ubuntu/.local/share/jellyfin/log
Jul 10 15:15:53 cine-kixta jellyfin.sh[2578]: [15:15:53] [INF] [1] Main: Config directory path: /home/ubuntu/.config/jellyfin
Jul 10 15:15:53 cine-kixta jellyfin.sh[2578]: [15:15:53] [INF] [1] Main: Cache path: /home/ubuntu/.cache/jellyfin
Jul 10 15:15:53 cine-kixta jellyfin.sh[2578]: [15:15:53] [INF] [1] Main: Web resources path: /usr/lib/jellyfin/bin/jellyfin-web
Jul 10 15:15:53 cine-kixta jellyfin.sh[2578]: [15:15:53] [INF] [1] Main: Application directory: /usr/lib/jellyfin/bin/
Jul 10 15:15:53 cine-kixta jellyfin.sh[2578]: [15:15:53] [ERR] [1] Main: The server is expected to host the web client, but the provided content directory is either invalid or empty: /usr/lib/jellyfin/bin/jellyf>
Jul 10 15:15:53 cine-kixta systemd[1]: [b]jellyfin.service: Main process exited, code=exited, status=1/FAILURE[/b]
Jul 10 15:15:53 cine-kixta systemd[1]: [b]jellyfin.service: Failed with result 'exit-code'.[/b]
Jul 10 15:15:53 cine-kixta systemd[1]: jellyfin.service: Scheduled restart job, restart counter is at 4.
Jul 10 15:15:53 cine-kixta systemd[1]: Stopped Jellyfin.
Jul 10 15:15:53 cine-kixta systemd[1]: Started Jellyfin.
Jul 10 15:15:53 cine-kixta systemd[1]: Started Jellyfin.
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Jellyfin version: 10.9.7
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Environment Variables: ["[JELLYFIN_LOG_DIR, /home/ubuntu/.local/share/jellyfin/log]"]
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Arguments: ["/usr/lib/jellyfin/bin/jellyfin.dll"]
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Operating system: Ubuntu 22.04.4 LTS
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Architecture: Arm64
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: 64-Bit Process: True
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: User Interactive: True
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Processor count: 2
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Program data path: /home/ubuntu/.local/share/jellyfin
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Log directory path: /home/ubuntu/.local/share/jellyfin/log
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Config directory path: /home/ubuntu/.config/jellyfin
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Cache path: /home/ubuntu/.cache/jellyfin
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Web resources path: /usr/lib/jellyfin/bin/jellyfin-web
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [INF] [1] Main: Application directory: /usr/lib/jellyfin/bin/
Jul 10 15:15:53 cine-kixta jellyfin.sh[2589]: [15:15:53] [ERR] [1] Main: The server is expected to host the web client, but the provided content directory is either invalid or empty: /usr/lib/jellyfin/bin/jellyf>
Jul 10 15:15:53 cine-kixta systemd[1]: jellyfin.service: Main process exited, code=exited, status=1/FAILURE
Jul 10 15:15:53 cine-kixta systemd[1]: jellyfin.service: Failed with result 'exit-code'.
Jul 10 15:15:54 cine-kixta systemd[1]: jellyfin.service: Scheduled restart job, restart counter is at 5.
Jul 10 15:15:54 cine-kixta systemd[1]: Stopped Jellyfin.
Jul 10 15:15:54 cine-kixta systemd[1]: jellyfin.service: Start request repeated too quickly.
Jul 10 15:15:54 cine-kixta systemd[1]: jellyfin.service: Failed with result 'exit-code'.
Jul 10 15:15:54 cine-kixta systemd[1]: Failed to start Jellyfin.

Looking forward to the answer


RE: I restarted my server from web (button), but failed to restart. - TheDreadPirate - 2024-07-10

Since you are running Jellyfin directly on Ubuntu, /opt/jellyfin is not used. Just delete that directory and the script you created. And you should not be starting jellyfin simply by typing "jellyfin", which is what appears to be happening.

You need to be using systemctl to manage jellyfin.

Code:
sudo systemctl restart jellyfin

Stop, start, and status are also valid commands.

As for the "restart" button in the web, I also noticed this issue and there appears to be an open issue already.

https://github.com/jellyfin/jellyfin/issues/12161


RE: I restarted my server from web (button), but failed to restart. - jaiovi - 2024-07-10

(2024-07-10, 04:01 PM)TheDreadPirate Wrote: Since you are running Jellyfin directly on Ubuntu, /opt/jellyfin is not used.  Just delete that directory and the script you created.  And you should not be starting jellyfin simply by typing "jellyfin", which is what appears to be happening.

You need to be using systemctl to manage jellyfin.

Code:
sudo systemctl restart jellyfin

Stop, start, and status are also valid commands.

As for the "restart" button in the web, I also noticed this issue and there appears to be an open issue already.

https://github.com/jellyfin/jellyfin/issues/12161

Thank you. But even then, by default /etc/systemd/system/jellyfin.service appeared like this.
Code:
  GNU nano 6.2                                                                                            /etc/systemd/system/jellyfin.service                                                                                                     
[Unit]
Description=Jellyfin
After=network.target

[Service]
Type=simple
User=ubuntu
Restart=always
ExecStart=/opt/jellyfin/jellyfin.sh

[Install]
WantedBy=multi-user.target

ExecStart where should point at?


RE: I restarted my server from web (button), but failed to restart. - TheDreadPirate - 2024-07-10

(2024-07-10, 04:15 PM)jaiovi Wrote: Thank you. But even then, by default /etc/systemd/system/jellyfin.service appeared like this.
Code:
  GNU nano 6.2                                                                                            /etc/systemd/system/jellyfin.service                                                                                                     
[Unit]
Description=Jellyfin
After=network.target

[Service]
Type=simple
User=ubuntu
Restart=always
ExecStart=/opt/jellyfin/jellyfin.sh

[Install]
WantedBy=multi-user.target

ExecStart where should point at?

That file should not exist in a "one-liner" install.  A package/one-liner install will create this file.

/etc/systemd/system/multi-user.target.wants/jellyfin.service

Which looks like this.

Code:
[Unit]
Description = Jellyfin Media Server
After = network-online.target

[Service]
Type = simple
EnvironmentFile = /etc/default/jellyfin
User = jellyfin
Group = jellyfin
WorkingDirectory = /var/lib/jellyfin
ExecStart = /usr/bin/jellyfin $JELLYFIN_WEB_OPT $JELLYFIN_FFMPEG_OPT $JELLYFIN_SERVICE_OPT $JELLYFIN_NOWEBAPP_OPT $JELLYFIN_ADDITIONAL_OPTS
Restart = on-failure
TimeoutSec = 15
SuccessExitStatus=0 143

[Install]
WantedBy = multi-user.target



RE: I restarted my server from web (button), but failed to restart. - jaiovi - 2024-07-10

(2024-07-10, 04:27 PM)TheDreadPirate Wrote:
(2024-07-10, 04:15 PM)jaiovi Wrote: Thank you. But even then, by default /etc/systemd/system/jellyfin.service appeared like this.
Code:
  GNU nano 6.2                                                                                            /etc/systemd/system/jellyfin.service                                                                                                     
[Unit]
Description=Jellyfin
After=network.target

[Service]
Type=simple
User=ubuntu
Restart=always
ExecStart=/opt/jellyfin/jellyfin.sh

[Install]
WantedBy=multi-user.target

ExecStart where should point at?

That file should not exist in a "one-liner" install.  A package/one-liner install will create this file.

/etc/systemd/system/multi-user.target.wants/jellyfin.service

Which looks like this.

Code:
[Unit]
Description = Jellyfin Media Server
After = network-online.target

[Service]
Type = simple
EnvironmentFile = /etc/default/jellyfin
User = jellyfin
Group = jellyfin
WorkingDirectory = /var/lib/jellyfin
ExecStart = /usr/bin/jellyfin $JELLYFIN_WEB_OPT $JELLYFIN_FFMPEG_OPT $JELLYFIN_SERVICE_OPT $JELLYFIN_NOWEBAPP_OPT $JELLYFIN_ADDITIONAL_OPTS
Restart = on-failure
TimeoutSec = 15
SuccessExitStatus=0 143

[Install]
WantedBy = multi-user.target

FIXED! The possible issue is that web restart changes .service configuration.

Writing the above configuration in /etc/systemd/system/jellyfin.service , then sudo systemctl daemon-reload

Also enable user and writing in the following directories:
Code:
sudo chown -R jellyfin:jellyfin /var/lib/jellyfin
sudo chmod -R u+rw /var/lib/jellyfin
sudo chown -R jellyfin:jellyfin /etc/default/jellyfin
sudo chmod -R u+rw /etc/default/jellyfin
sudo chmod 644 /etc/jellyfin/migrations.xml

sudo systemctl start jellyfin - It's up and running. Thanks!


RE: I restarted my server from web (button), but failed to restart. - paulc - 2024-07-10

(2024-07-10, 03:16 PM)jaiovi Wrote: Hello! 
Jellyfin 1.9.7 - installed one liner
Ubuntu 22.0 A1 compute OCI

I restarted my server from web (button), but failed to restart. Trying to "sudo systemctl start jellyfin" again showed this status code

......

Looking forward to the answer

Do you have the Reports plugin activated? Disabling fixed the web button restart failure on my Windows 10 setup.


RE: I restarted my server from web (button), but failed to restart. - TheDreadPirate - 2024-07-10

(2024-07-10, 05:48 PM)paulc Wrote:
(2024-07-10, 03:16 PM)jaiovi Wrote: Hello! 
Jellyfin 1.9.7 - installed one liner
Ubuntu 22.0 A1 compute OCI

I restarted my server from web (button), but failed to restart. Trying to "sudo systemctl start jellyfin" again showed this status code

......

Looking forward to the answer

Do you have the Reports plugin activated? Disabling fixed the web button restart failure on my Windows 10 setup.

Interesting.  I will give this a try.


RE: I restarted my server from web (button), but failed to restart. - TheDreadPirate - 2024-07-10

For me, the Playback Reporting plugin was the culprit. Which makes sense since it has its own database file.


RE: I restarted my server from web (button), but failed to restart. - paulc - 2024-07-10

(2024-07-10, 05:54 PM)TheDreadPirate Wrote: Interesting.  I will give this a try.

I remembered a problem a long time ago with the Restart button and Reports.  

When this post showed up, I activated the Reports plugin to test and it failed with the same error message.
Code:
[2024-07-10 13:27:46.321 -04:00] [FTL] [11] Main: Error while starting server
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 8: 'attempt to write a readonly database'.
  at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
  at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
  at Emby.Server.Implementations.Data.SqliteExtensions.Execute(SqliteConnection sqliteConnection, String commandText)
  at Emby.Server.Implementations.Data.ManagedConnection.Execute(String commandText)
  at Emby.Server.Implementations.Data.BaseSqliteRepository.Initialize()
  at Emby.Server.Implementations.Data.SqliteItemRepository.Initialize()
  at Emby.Server.Implementations.ApplicationHost.InitializeServices()
  at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig)
[2024-07-10 13:27:46.692 -04:00] [INF] [11] Main: Running query planner optimizations in the database... This might take a while
[2024-07-10 13:27:46.694 -04:00] [INF] [11] Emby.Server.Implementations.ApplicationHost: Disposing "CoreAppHost"
[2024-07-10 13:27:46.695 -04:00] [INF] [11] Emby.Server.Implementations.ApplicationHost: Disposing "PluginManager"
I deactivated the Reports plugin and it restarted fine.


RE: I restarted my server from web (button), but failed to restart. - TheDreadPirate - 2024-07-10

I opened an issue on the plugins github.

https://github.com/jellyfin/jellyfin-plugin-playbackreporting/issues/89