Error restoring Joplin after failing upgrade

What app is this about, and its version: Joplin 3.4.12~ynh2
What YunoHost version are you running: 12.1.39
What type of hardware are you using: VPS bought online

Describe your issue

I am running again in an issue similar to the one I had a few month ago

Using the help that I got on the other thread, I restored a few months ago a Joplin app install on a Yunohost fresh install. To do this, I essentially updated the Node.js value in apps/joplin/backup/etc/systemd/system/joplin.service from 22.20.0 to 22.21.0 and restored the updated archive.

Yesterday, I tried to perform an upgrade of the Joplin app, which I interrupted because it got stuck somewhere. I ended up with the Joplin app uninstalled.

After an attempt to simply restore the application, I tried the same fix as in the old post, this time replacing 22.21.0 by 22.22.0, since this is apparently the version that is now installed by the restoration script.

Unfortunately, this didn’t work as intended. I am in particular scratching my head because of this part of the error logs:

2026-01-20 09:44:34,843: WARNING - The service joplin didn't fully execute the action start before the timeout.
2026-01-20 09:44:34,843: WARNING - Please find here an extract of the end of the log of the service joplin:
2026-01-20 09:44:34,844: DEBUG - + ynh_print_warn 'The service joplin didn'\''t fully execute the action start before the timeout.'
2026-01-20 09:44:34,844: DEBUG - + ynh_print_warn 'Please find here an extract of the end of the log of the service joplin:'
2026-01-20 09:44:34,844: DEBUG - + journalctl --quiet --no-hostname --no-pager --lines=20 --unit=joplin
2026-01-20 09:44:34,873: WARNING - Jan 19 20:56:35 systemd[1]: joplin.service: Main process exited, code=exited, status=203/EXEC
2026-01-20 09:44:34,873: WARNING - Jan 19 20:56:35 systemd[1]: joplin.service: Failed with result 'exit-code'.
2026-01-20 09:44:34,874: WARNING - Jan 20 08:29:30 systemd[1]: Started joplin.service - Joplin server.
2026-01-20 09:44:34,874: WARNING - Jan 20 08:29:30 (node)[831453]: joplin.service: Failed to locate executable /opt/node_n/n/versions/node/22.21.0/bin/node: No such file or directory
2026-01-20 09:44:34,874: WARNING - Jan 20 08:29:30 (node)[831453]: joplin.service: Failed at step EXEC spawning /opt/node_n/n/versions/node/22.21.0/bin/node: No such file or directory
2026-01-20 09:44:34,874: WARNING - Jan 20 08:29:30 systemd[1]: joplin.service: Main process exited, code=exited, status=203/EXEC
2026-01-20 09:44:34,874: WARNING - Jan 20 08:29:30 systemd[1]: joplin.service: Failed with result 'exit-code'.
2026-01-20 09:44:34,874: WARNING - Jan 20 08:43:27 systemd[1]: Started joplin.service - Joplin server.
2026-01-20 09:44:34,874: WARNING - Jan 20 08:43:27 systemd[1]: joplin.service: Main process exited, code=exited, status=200/CHDIR
2026-01-20 09:44:34,875: WARNING - Jan 20 08:43:27 systemd[1]: joplin.service: Failed with result 'exit-code'.
2026-01-20 09:44:34,875: WARNING - Jan 20 09:14:55 systemd[1]: Started joplin.service - Joplin server.
2026-01-20 09:44:34,875: WARNING - Jan 20 09:14:55 (node)[838959]: joplin.service: Changing to the requested working directory failed: No such file or directory
2026-01-20 09:44:34,876: WARNING - Jan 20 09:14:55 (node)[838959]: joplin.service: Failed at step CHDIR spawning /opt/node_n/n/versions/node/22.22.0/bin/node: No such file or directory
2026-01-20 09:44:34,876: WARNING - Jan 20 09:14:55 systemd[1]: joplin.service: Main process exited, code=exited, status=200/CHDIR
2026-01-20 09:44:34,876: WARNING - Jan 20 09:14:55 systemd[1]: joplin.service: Failed with result 'exit-code'.
2026-01-20 09:44:34,876: WARNING - Jan 20 09:39:33 systemd[1]: Started joplin.service - Joplin server.
2026-01-20 09:44:34,877: WARNING - Jan 20 09:39:33 (node)[842543]: joplin.service: Changing to the requested working directory failed: No such file or directory
2026-01-20 09:44:34,877: WARNING - Jan 20 09:39:33 (node)[842543]: joplin.service: Failed at step CHDIR spawning /opt/node_n/n/versions/node/22.22.0/bin/node: No such file or directory
2026-01-20 09:44:34,877: WARNING - Jan 20 09:39:33 systemd[1]: joplin.service: Main process exited, code=exited, status=200/CHDIR
2026-01-20 09:44:34,878: WARNING - Jan 20 09:39:33 systemd[1]: joplin.service: Failed with result 'exit-code'.

So it seems that something still requires Node 22.21.0 to be used, but I don’t understand what.

I tried to grep for 22.21.0 from within the extracted archive, without success:

sudo grep "22\.21\.0" * -rl

Any help would be greatly appreciated.

Share relevant logs or error messages

https://paste.yunohost.org/raw/iwotiroyis

Ok, cleaning `/tmp`, removing the content of `/home/yunohost.backup/tmp` and rebooting seems to have removed the dependency to 22.21.0. However, even though 22.22.0 is installed, it is not found at service execution. Here is an extract of the logs

2026-01-20 12:09:30,229: DEBUG - Skipping loading nodejs, because it doesn't seem to be provisioned yet. This is likely to happen during restore and other specific contexts.
2026-01-20 12:09:30,232: DEBUG - + ynh_abort_if_errors
2026-01-20 12:09:30,233: DEBUG - + trap ynh_exit_properly EXIT
2026-01-20 12:09:30,233: DEBUG - + /usr/share/yunohost/helpers.v2.1.d/vendor/n/n install 22
2026-01-20 12:09:30,356: DEBUG -   installing : node-v22.22.0
2026-01-20 12:09:30,548: DEBUG -        mkdir : /opt/node_n/n/versions/node/22.22.0
2026-01-20 12:09:30,553: DEBUG -        fetch : https://nodejs.org/dist/v22.22.0/node-v22.22.0-linux-x64.tar.xz
2026-01-20 12:09:32,772: DEBUG -      copying : node/22.22.0
2026-01-20 12:09:42,063: DEBUG -    installed : v22.22.0 to /opt/node_n/bin/node
2026-01-20 12:09:42,100: DEBUG -       active : v18.20.4 at /usr/bin/node
2026-01-20 12:09:42,101: DEBUG - + ynh_exit_properly
...
2026-01-20 12:15:28,161: WARNING - The service joplin didn't fully execute the action start before the timeout.
2026-01-20 12:15:28,161: WARNING - Please find here an extract of the end of the log of the service joplin:
2026-01-20 12:15:28,161: DEBUG - + ynh_print_warn 'Please find here an extract of the end of the log of the service joplin:'
2026-01-20 12:15:28,161: DEBUG - + journalctl --quiet --no-hostname --no-pager --lines=20 --unit=joplin
2026-01-20 12:15:28,187: WARNING - Jan 20 08:29:30 systemd[1]: joplin.service: Main process exited, code=exited, status=203/EXEC
2026-01-20 12:15:28,188: WARNING - Jan 20 08:29:30 systemd[1]: joplin.service: Failed with result 'exit-code'.
2026-01-20 12:15:28,188: WARNING - Jan 20 08:43:27 systemd[1]: Started joplin.service - Joplin server.
2026-01-20 12:15:28,188: WARNING - Jan 20 08:43:27 systemd[1]: joplin.service: Main process exited, code=exited, status=200/CHDIR
2026-01-20 12:15:28,188: WARNING - Jan 20 08:43:27 systemd[1]: joplin.service: Failed with result 'exit-code'.
2026-01-20 12:15:28,189: WARNING - Jan 20 09:14:55 systemd[1]: Started joplin.service - Joplin server.
2026-01-20 12:15:28,189: WARNING - Jan 20 09:14:55 (node)[838959]: joplin.service: Changing to the requested working directory failed: No such file or directory
2026-01-20 12:15:28,189: WARNING - Jan 20 09:14:55 (node)[838959]: joplin.service: Failed at step CHDIR spawning /opt/node_n/n/versions/node/22.22.0/bin/node: No such file or directory
2026-01-20 12:15:28,190: WARNING - Jan 20 09:14:55 systemd[1]: joplin.service: Main process exited, code=exited, status=200/CHDIR
2026-01-20 12:15:28,190: WARNING - Jan 20 09:14:55 systemd[1]: joplin.service: Failed with result 'exit-code'.
2026-01-20 12:15:28,190: WARNING - Jan 20 09:39:33 systemd[1]: Started joplin.service - Joplin server.
2026-01-20 12:15:28,190: WARNING - Jan 20 09:39:33 (node)[842543]: joplin.service: Changing to the requested working directory failed: No such file or directory
2026-01-20 12:15:28,190: WARNING - Jan 20 09:39:33 (node)[842543]: joplin.service: Failed at step CHDIR spawning /opt/node_n/n/versions/node/22.22.0/bin/node: No such file or directory
2026-01-20 12:15:28,190: WARNING - Jan 20 09:39:33 systemd[1]: joplin.service: Main process exited, code=exited, status=200/CHDIR
2026-01-20 12:15:28,191: WARNING - Jan 20 09:39:33 systemd[1]: joplin.service: Failed with result 'exit-code'.
2026-01-20 12:15:28,191: WARNING - Jan 20 12:10:27 systemd[1]: Started joplin.service - Joplin server.
2026-01-20 12:15:28,191: WARNING - Jan 20 12:10:27 (node)[3085]: joplin.service: Changing to the requested working directory failed: No such file or directory
2026-01-20 12:15:28,191: WARNING - Jan 20 12:10:27 (node)[3085]: joplin.service: Failed at step CHDIR spawning /opt/node_n/n/versions/node/22.22.0/bin/node: No such file or directory
2026-01-20 12:15:28,191: WARNING - Jan 20 12:10:27 systemd[1]: joplin.service: Main process exited, code=exited, status=200/CHDIR
2026-01-20 12:15:28,191: WARNING - Jan 20 12:10:27 systemd[1]: joplin.service: Failed with result 'exit-code'.

And here the full logs:

https://paste.yunohost.org/raw/yeyusiteja

Can you paste the contents of /etc/systemd/system/joplin.systemd?

/opt/node_n/n/versions/node/22.22.0/bin/node is the working directory or executable there? Does the node file exist?

Thanks a lot for your time @otm33 ! The file `/etc/systemd/system/joplin.service` does not exist (I suppose it is removed after the failed restore).

After the attempted restoration, `/opt/node_n/n/versions/node/22.22.0` does not exist anymore. However, if I installed it by hand as suggested in the other thread:

N_PREFIX=/opt/node_n/ /usr/share/yunohost/helpers.v2.1.d/vendor/n/n install 22.22.0

I see that it is installed:

$ sudo N_PREFIX=/opt/node_n/ /usr/share/yunohost/helpers.v2.1.d/vendor/n/n install 22.22.0
  installing : node-v22.22.0
       mkdir : /opt/node_n/n/versions/node/22.22.0
       fetch : https://nodejs.org/dist/v22.22.0/node-v22.22.0-linux-x64.tar.xz
     copying : node/22.22.0
   installed : v22.22.0
$ ls -l /opt/node_n/n/versions/node/22.22.0/bin/
total 120516
lrwxrwxrwx 1 root root        45 Jan 12 23:03 corepack -> ../lib/node_modules/corepack/dist/corepack.js
-rwxr-xr-x 1 root root 123405064 Jan 12 23:03 node
lrwxrwxrwx 1 root root        38 Jan 12 23:03 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxrwxrwx 1 root root        38 Jan 12 23:03 npx -> ../lib/node_modules/npm/bin/npx-cli.js

But this does not seem to change the outcome of the restoration (see logs after another attempt)

https://paste.yunohost.org/raw/ocifurabab

Also, I looked at the node folder during the restoration process and during this step:

Info: [##############+++...] > Reloading NGINX web server and joplin's service...                         

it exists. So I guess it is automatically removed by the cleanup mechanism after the failed restore.

There’s --no-remove-on-failure command line switch that allows to restore an app into broken state, can you try with that to see what breaks exactly?

Thanks for the input. Here is the content of /etc/systemd/system/joplin.service:

[Unit]
Description=Joplin server
After=network.target

[Service]
Type=simple
User=joplin
Group=joplin
Environment="PATH=/opt/node_n/n/versions/node/22.22.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
EnvironmentFile=/var/www/joplin/.env
WorkingDirectory=/var/www/joplin/packages/server
ExecStart=/opt/node_n/n/versions/node/22.22.0/bin/node dist/app.js

# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these
# .. but this should be a good baseline
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
RestrictNamespaces=yes
RestrictRealtime=yes
DevicePolicy=closed
ProtectClock=yes
ProtectHostname=yes
ProtectProc=invisible
ProtectSystem=full
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
LockPersonality=yes
SystemCallArchitectures=native
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged

# Denying access to capabilities that should not be relevant for webapps
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG

[Install]
WantedBy=multi-user.target

And then the output of ls -l /opt/node_n/n/versions/node/22.22.0/:

total 956
drwxr-xr-x 2 root root   4096 Jan 20 12:59 bin
-rw-r--r-- 1 root root 771735 Jan 12 23:03 CHANGELOG.md
drwxr-xr-x 3 root root   4096 Jan 12 23:03 include
drwxr-xr-x 3 root root   4096 Jan 12 23:03 lib
-rw-r--r-- 1 root root 143299 Jan 12 23:03 LICENSE
-rw-r--r-- 1 root root  41705 Jan 12 23:03 README.md
drwxr-xr-x 4 root root   4096 Jan 12 23:03 share

also, it seems that node is correctly installed and available:

$ cd /opt/node_n/n/versions/node/22.22.0/bin/ && ./node --version
v22.22.0

But the workdir referenced in the service file/var/www/joplin/packages/server does not exit:

# ls -lah /var/www/joplin/
total 28K
drwxr-x---   6 joplin joplin 4.0K Jan 19 19:21 .
drwxr-xr-x+ 18 root   root   4.0K Jan 20 12:58 ..
drwxr-x---   5 joplin joplin 4.0K Jan 19 19:21 build
drwxr-x---   4 joplin joplin 4.0K Jul 29 17:37 .cache
-rw-r-----   1 joplin joplin 1.2K Jan 19 19:21 .env
drwxr-x---   3 joplin joplin 4.0K Aug 31 14:06 .npm
drwxr-x---   3 joplin joplin 4.0K Jul 29 17:29 .yarn

So this could well be the issue here, but I am unsure how to solve this (creating the dir by hand seems dirty and I have no idea what it should contain).

Here the logfile:

https://paste.yunohost.org/raw/xeleyivuki

Thanks a lot for the packaging of this great app!

What are the contents of build/ folder? Seems like it’s restoring a partially built version :thinking:

Here it is:

$ls -lah build
total 1.4M
drwxr-x---   5 joplin joplin 4.0K Jan 19 19:21 .
drwxr-x---   6 joplin joplin 4.0K Jan 19 19:21 ..
-rw-r-----   1 joplin joplin 2.2K Jan 17 11:21 gulpfile.js
drwxr-x--- 402 joplin joplin  16K Jan 19 19:24 node_modules
-rw-r-----   1 joplin joplin 8.3K Jan 17 11:21 package.json
drwxr-x---  13 joplin joplin 4.0K Jan 19 19:21 packages
-rw-r-----   1 joplin joplin  844 Jan 17 11:21 tsconfig.json
drwxr-x---   5 joplin joplin 4.0K Jan 19 19:21 .yarn
-rw-r-----   1 joplin joplin 1.3M Jan 19 19:21 yarn.lock
-rw-r-----   1 joplin joplin 1.3K Jan 17 11:21 .yarnrc.yml

Typically Joplin_ynh would then move contents of build/packages to /var/www/joplin, does aforementioned folder contain server?

I’m still curious about what are we restoring here, this does not seem like a backup of a working version :thinking:

1 Like

Actually it does:

/var/www/joplin/build/packages# ls -lah
total 52K
drwxr-x--- 13 joplin joplin 4.0K Jan 19 19:21 .
drwxr-x---  5 joplin joplin 4.0K Jan 19 19:21 ..
drwxr-x---  5 joplin joplin 4.0K Jan 19 19:21 fork-htmlparser2
drwxr-x---  6 joplin joplin 4.0K Jan 19 19:21 fork-sax
drwxr-x---  4 joplin joplin 4.0K Jan 19 19:21 fork-uslug
drwxr-x---  5 joplin joplin 4.0K Jan 19 19:21 htmlpack
drwxr-x--- 19 joplin joplin 4.0K Jan 19 19:21 lib
drwxr-x---  9 joplin joplin 4.0K Jan 19 19:21 renderer
drwxr-x---  7 joplin joplin 4.0K Jan 19 19:21 server
drwxr-x--- 11 joplin joplin 4.0K Jan 19 19:21 tools
drwxr-x---  6 joplin joplin 4.0K Jan 19 19:21 turndown
drwxr-x---  6 joplin joplin 4.0K Jan 19 19:21 turndown-plugin-gfm
drwxr-x---  3 joplin joplin 4.0K Jan 19 19:21 utils

/var/www/joplin/build/packages# ls server/
assets	gulpfile.js  jest.config.js  jest.setup.js  LICENSE.md	node_modules  nodemon.json  package.json  public  readme  README.md  SAML.md  schema.sqlite  src  stripeConfig.json  tsconfig.json


And the folder itself is also not empty. But just in doubt, I’ll try to restore an automatic backup from the same day and see if that works.

1 Like

Just tried with another automatic backup: it seems that the problem is the same:

https://paste.yunohost.org/raw/kazexisohe

Therefore, the question is why is the `server` folder not restored?

Finally got to it! The backup was indeed corrupted and I made a mistake when trying to restore the other correct backup.

Here is what I ended up doing:

  • Untar the correct backup: tar -xvf auto_joplin-2026-01-19.tar
  • Switch the node version from 22.21.0 to 22.22.0 in apps/joplin/backup/etc/systemd/system/joplin.service
  • Recompress with tar -cvf joplin.tar app backup.csv info.json
  • Restore with sudo yunohost backup restore joplin.tar --apps

Thanks a lot @orhtej2 for pointing me to the right direction!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.