User Tools

Site Tools


tech:jdownloader_restart

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tech:jdownloader_restart [2026/09/22 21:04] – update katsimbristech:jdownloader_restart [2026/09/22 21:15] (current) – [Quick Post-Update Check] katsimbris
Line 1: Line 1:
-==== Systemd Update/Restart Compatibility ====+====== JDownloader — Updates, Restart & Troubleshooting ======
  
-JDownloader's updater may temporarily exit the main Java process and launch another Java process to complete an update/restart.+JDownloader runs directly on Ubuntu as a **systemd service**. It is **not a Docker container**.
  
-The original systemd service used:+Permanent installation directory:
  
 <code> <code>
-Type=simple +/opt/jdownloader
-Restart=on-failure+
 </code> </code>
  
-This worked for normal operation, but JDownloader's self-update process twice resulted in:+Systemd service:
  
-* JDownloader shutting down cleanly +<code> 
-* `/opt/jdownloader/JDownloader.jar` disappearing +jdownloader.service 
-* the updater reporting that its self-test succeeded +</code>
-* no replacement JDownloader process successfully completing the handoff +
-* later service starts failing with: <code>Error: Unable to access jarfile /opt/jdownloader/JDownloader.jar</code>+
  
-On September 22, 2026, a systemd override was added to better support JDownloader's update/restart behavior:+The established JDownloader configuration is stored under: 
 + 
 +<code> 
 +/opt/jdownloader/cfg 
 +</code> 
 + 
 +===== Normal Update Procedure ===== 
 + 
 +It is okay to initiate a JDownloader update through **MyJDownloader / the web interface**. 
 + 
 +JDownloader may stop and restart itself while applying an update. Give it a couple of minutes to complete before intervening. 
 + 
 +After an update, verify that the service came back:
  
 <code bash> <code bash>
-sudo mkdir -p /etc/systemd/system/jdownloader.service.d+systemctl is-active jdownloader 
 +</code>
  
-printf '%s\n'  +Normal result:
-'[Service]'  +
-'RemainAfterExit=yes'  +
-'PIDFile=/opt/jdownloader/JDownloader.pid'  +
-| sudo tee /etc/systemd/system/jdownloader.service.d/override.conf+
  
-sudo systemctl daemon-reload </code>+<code> 
 +active 
 +</code>
  
-Verify with:+For more detail:
  
 <code bash> <code bash>
-systemctl show jdownloader \ +sudo systemctl status jdownloader --no-pager
-  -p Type \ +
-  -p Restart \ +
-  -p KillMode \ +
-  -p RemainAfterExit \ +
-  -p PIDFile+
 </code> </code>
  
-Expected:+The running process can also be checked with: 
 + 
 +<code bash> 
 +pgrep -af 'java.*JDownloader' 
 +</code> 
 + 
 +A healthy installation should show Java running:
  
 <code> <code>
-Type=simple +/opt/jdownloader/JDownloader.jar
-Restart=on-failure +
-PIDFile=/opt/jdownloader/JDownloader.pid +
-RemainAfterExit=yes +
-KillMode=control-group+
 </code> </code>
  
-Do **not** change `KillMode=control-group` unless there is a specific reason to do so.+For example:
  
-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.+<code> 
 +/usr/bin/java -Djava.awt.headless=true -jar /opt/jdownloader/JDownloader.jar 
 +</code>
  
-**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.+===== Starting and Stopping JDownloader =====
  
-==== September 21–22, 2026 Update Failure ====+Start JDownloader:
  
-On September 21, JDownloader disappeared after an update/restart and `/opt/jdownloader/JDownloader.jar` was missing.+<code bash> 
 +sudo systemctl start jdownloader 
 +</code>
  
-The JAR was restored from a known-good copy and JDownloader returned to normal operation.+Stop JDownloader:
  
-The same failure happened again on September 22.+<code bash> 
 +sudo systemctl stop jdownloader 
 +</code>
  
-Investigation of the second failure showed that:+Restart JDownloader:
  
-* the established installation was still `/opt/jdownloader` +<code bash> 
-* JDownloader deliberately entered its update/restart process +sudo systemctl restart jdownloader 
-* the updater launched its self-test from: <code>/opt/jdownloader/tmp/update/self/JDU/JDownloader.jar</code> +</code>
-* 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.+Check whether it is running:
  
-The systemd configuration was then adjusted as described above to better accommodate JDownloader's updater/restart handoff.+<code bash> 
 +systemctl is-active jdownloader 
 +</code>
  
-==== Quick Health Check ====+Detailed status: 
 + 
 +<code bash> 
 +sudo systemctl status jdownloader --no-pager 
 +</code> 
 + 
 +===== If JDownloader Does Not Restart ===== 
 + 
 +First check its status: 
 + 
 +<code bash> 
 +sudo systemctl status jdownloader --no-pager 
 +</code> 
 + 
 +If the service is simply stopped, try starting it: 
 + 
 +<code bash> 
 +sudo systemctl start jdownloader 
 +</code> 
 + 
 +Then verify:
  
 <code bash> <code bash>
 systemctl is-active jdownloader systemctl is-active jdownloader
 +</code>
  
-ls -lh /opt/jdownloader/JDownloader.jar+If the service fails again, **do not immediately reinstall JDownloader, delete files, or replace the configuration**.
  
-cat /opt/jdownloader/JDownloader.pid+Check that the main application files still exist:
  
-pgrep -af 'java.*JDownloader' </code>+<code bash> 
 +ls -lh /opt/jdownloader/JDownloader.jar /opt/jdownloader/Core.jar 
 +</code> 
 + 
 +Check whether another JDownloader Java process is already running: 
 + 
 +<code bash> 
 +pgrep -af 'java.*JDownloader' 
 +</code> 
 + 
 +If ''JDownloader.jar'' is missing or the service still will not start, stop here and investigate the updater logs before changing the installation. 
 + 
 +===== Configuration ===== 
 + 
 +The established JDownloader configuration is stored under: 
 + 
 +<code> 
 +/opt/jdownloader/cfg 
 +</code> 
 + 
 +This directory contains the settings used by the established installation. 
 + 
 +**Preserve this directory during troubleshooting or recovery.** 
 + 
 +Do not replace it with the configuration from a newly created or temporary JDownloader installation. 
 + 
 +===== .jd_home Warning ===== 
 + 
 +During an update failure, troubleshooting, or recovery, another JDownloader installation may appear under: 
 + 
 +<code> 
 +/home/mike/.jd_home 
 +</code> 
 + 
 +Do **not** assume this is the permanent installation. 
 + 
 +The systemd-managed installation is: 
 + 
 +<code> 
 +/opt/jdownloader 
 +</code> 
 + 
 +A ''.jd_home'' installation may contain newly downloaded JDownloader application files while having a new or default configuration. 
 + 
 +In particular, do **not** replace: 
 + 
 +<code> 
 +/opt/jdownloader/cfg 
 +</code> 
 + 
 +with: 
 + 
 +<code> 
 +/home/mike/.jd_home/cfg 
 +</code> 
 + 
 +unless there is a specific, verified reason to do so. 
 + 
 +The presence of newer ''JDownloader.jar'' or ''Core.jar'' files under ''.jd_home'' does not by itself mean that JDownloader should be moved there. 
 + 
 +===== Logs ===== 
 + 
 +Show the most recent systemd log entries: 
 + 
 +<code bash> 
 +journalctl -u jdownloader -n 100 --no-pager 
 +</code> 
 + 
 +Follow the service log live: 
 + 
 +<code bash> 
 +journalctl -u jdownloader -f 
 +</code> 
 + 
 +Press ''Ctrl+C'' to stop following the log. 
 + 
 +JDownloader's own logs are stored under: 
 + 
 +<code> 
 +/opt/jdownloader/logs 
 +</code> 
 + 
 +These logs can be useful when diagnosing an update or restart failure. 
 + 
 +===== September 21, 2026 Update Failure ===== 
 + 
 +On September 21, 2026, an update initiated through JDownloader resulted in the service becoming unavailable. 
 + 
 +Investigation established that JDownloader was operating from the correct installation: 
 + 
 +<code> 
 +/opt/jdownloader 
 +</code> 
 + 
 +At approximately 13:28, JDownloader deliberately initiated its normal update/restart process and launched itself with: 
 + 
 +<code> 
 +JDownloader.jar -forceupdate 
 +</code> 
 + 
 +The updater continued to operate against the correct ''/opt/jdownloader'' installation. 
 + 
 +Its updater self-test used: 
 + 
 +<code> 
 +/opt/jdownloader/tmp/update/self/JDU/JDownloader.jar 
 +</code> 
 + 
 +and reported: 
 + 
 +<code> 
 +Validate: OK 
 +SelfTest Results: OK 
 +Self Update successful 
 +</code> 
 + 
 +JDownloader subsequently performed a normal shutdown. At 13:31:59, systemd recorded: 
 + 
 +<code> 
 +jdownloader.service: Deactivated successfully. 
 +</code> 
 + 
 +However, by the next attempt to start the service at 13:32:55: 
 + 
 +<code> 
 +/opt/jdownloader/JDownloader.jar 
 +</code> 
 + 
 +was no longer available. 
 + 
 +Systemd therefore reported: 
 + 
 +<code> 
 +Error: Unable to access jarfile /opt/jdownloader/JDownloader.jar 
 +</code> 
 + 
 +and subsequent automatic restart attempts failed for the same reason. 
 + 
 +The exact reason the updater failed to leave a usable replacement ''JDownloader.jar'' in ''/opt/jdownloader'' was not established. 
 + 
 +The investigation **did not find evidence that initiating the update through MyJDownloader was incorrect**, nor did it establish systemd's ''Restart=on-failure'' setting as the cause. 
 + 
 +A separate fresh JDownloader installation was discovered under: 
 + 
 +<code> 
 +/home/mike/.jd_home 
 +</code> 
 + 
 +It contained newer application files, but its ''cfg'' directory contained only a small/default configuration. 
 + 
 +The established configuration under: 
 + 
 +<code> 
 +/opt/jdownloader/cfg 
 +</code> 
 + 
 +was therefore preserved. 
 + 
 +For this specific recovery, fresh copies of ''JDownloader.jar'' and ''Core.jar'' were restored to ''/opt/jdownloader'' while retaining the existing ''cfg'' directory. 
 + 
 +After recovery: 
 + 
 +<code bash> 
 +systemctl is-active jdownloader 
 +</code> 
 + 
 +returned: 
 + 
 +<code> 
 +active 
 +</code> 
 + 
 +and the running Java process again used: 
 + 
 +<code> 
 +/opt/jdownloader/JDownloader.jar 
 +</code> 
 + 
 +MyJDownloader also reconnected using the existing configuration. 
 + 
 +**Important:** Copying application files from ''.jd_home'' was an incident-specific recovery procedure. It should not be treated as the normal JDownloader update procedure. 
 + 
 +===== Quick Post-Update Check ===== 
 + 
 +After initiating a JDownloader update or restart, wait a couple of minutes and run: 
 + 
 +<code bash> 
 +systemctl is-active jdownloader 
 +ls -lh /opt/jdownloader/JDownloader.jar 
 +cat /opt/jdownloader/JDownloader.pid 
 +pgrep -af 'java.*JDownloader' 
 +</code>
  
 Normal results should show: Normal results should show:
  
-* `active` +* ''jdownloader'' is ''active'' 
-* `/opt/jdownloader/JDownloader.jar` exists +* ''/opt/jdownloader/JDownloader.jar'' exists 
-* `JDownloader.pid` contains a process ID +* ''JDownloader.pid'' contains a process ID 
-* the same process ID is running Java with `/opt/jdownloader/JDownloader.jar`+* the same process ID is running Java with ''/opt/jdownloader/JDownloader.jar'' 
 + 
 +If ''JDownloader.jar'' is missing, **do not repeatedly restart the service, reinstall JDownloader, or replace ''/opt/jdownloader/cfg''**. 
 + 
 +Stop the service first: 
 + 
 +<code bash> 
 +sudo systemctl stop jdownloader 
 +</code> 
 + 
 +Then investigate the updater state before restoring any files.
  
-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