User Tools

Site Tools


tech:jdownloader_restart

This is an old revision of the document!


Systemd Update/Restart Compatibility

JDownloader's updater may temporarily exit the main Java process and launch another Java process to complete an update/restart.

The original systemd service used:

Type=simple
Restart=on-failure

This worked for normal operation, but JDownloader's self-update process twice resulted in:

* JDownloader shutting down cleanly * `/opt/jdownloader/JDownloader.jar` disappearing * the updater reporting that its self-test succeeded * no replacement JDownloader process successfully completing the handoff * later service starts failing with:

Error: Unable to access jarfile /opt/jdownloader/JDownloader.jar

On September 22, 2026, a systemd override was added to better support JDownloader's update/restart behavior:

sudo mkdir -p /etc/systemd/system/jdownloader.service.d
 
printf '%s\n' 
'[Service]' 
'RemainAfterExit=yes' 
'PIDFile=/opt/jdownloader/JDownloader.pid' 
| sudo tee /etc/systemd/system/jdownloader.service.d/override.conf
 
sudo systemctl daemon-reload 

Verify with:

systemctl show jdownloader \
  -p Type \
  -p Restart \
  -p KillMode \
  -p RemainAfterExit \
  -p PIDFile

Expected:

Type=simple
Restart=on-failure
PIDFile=/opt/jdownloader/JDownloader.pid
RemainAfterExit=yes
KillMode=control-group

Do not change `KillMode=control-group` unless there is a specific reason to do so.

After this change, a controlled `systemctl restart jdownloader` was tested successfully. JDownloader stopped, received a new process ID, recreated `/opt/jdownloader/JDownloader.pid`, checked for updates, and remained running with `/opt/jdownloader/JDownloader.jar` intact.

Status: This is the probable fix for the self-update/restart problem, but it has not yet been confirmed through another actual JDownloader self-update.

September 21–22, 2026 Update Failure

On September 21, JDownloader disappeared after an update/restart and `/opt/jdownloader/JDownloader.jar` was missing.

The JAR was restored from a known-good copy and JDownloader returned to normal operation.

The same failure happened again on September 22.

Investigation of the second failure showed that:

* the established installation was still `/opt/jdownloader` * JDownloader deliberately entered its update/restart process * the updater launched its self-test from:

/opt/jdownloader/tmp/update/self/JDU/JDownloader.jar

* the self-test completed successfully * the updater logged `Self Update successful` * the JDownloader process then shut down cleanly * `/opt/jdownloader/JDownloader.jar` was subsequently missing * no newer replacement JAR was found elsewhere under `/opt/jdownloader` or `/home/mike`

Because this happened twice, it was no longer treated as a one-time failed update.

The systemd configuration was then adjusted as described above to better accommodate JDownloader's updater/restart handoff.

Quick Health Check

systemctl is-active jdownloader
 
ls -lh /opt/jdownloader/JDownloader.jar
 
cat /opt/jdownloader/JDownloader.pid
 
pgrep -af 'java.*JDownloader' 

Normal results should show:

* `active` * `/opt/jdownloader/JDownloader.jar` exists * `JDownloader.pid` contains a process ID * the same process ID is running Java with `/opt/jdownloader/JDownloader.jar`

If `JDownloader.jar` is missing, do not repeatedly restart the service. Stop JDownloader first and inspect the updater state before restoring files.

tech/jdownloader_restart.1790125450.txt.gz · Last modified: by katsimbris