Radicale does not work after restore from backup

For some reason, my freedombox on rockpro64 failed to boot, so I made a fresh Debian install on a laptop, installed freedombox on it (26.7.1), and restored the last backup (which unfortunately was one week old due to having issues to setup remote backup).

At the restore, there was a failure with radicale, restore was stopped. I tried restoring everything except radicale, it worked. Then I tried radicale, it was apparently complete, but radicale does not work (last diagnostic is failed and no client can connect).

Searching into the journal, I see repeated occurenxe of this from yesterday when I reinstalled:

mai 10 22:54:15 freedombo-t400 systemd[1]: Starting uwsgi-app@radicale.service - radicale uWSGI app...
mai 10 22:54:15 freedombo-t400 (uwsgi)[6631]: uwsgi-app@radicale.service: Failed to set up special execution directory in /var/lib: File exists
mai 10 22:54:15 freedombo-t400 (uwsgi)[6631]: uwsgi-app@radicale.service: Failed at step STATE_DIRECTORY spawning /usr/bin/uwsgi: File exists
mai 10 22:54:15 freedombo-t400 systemd[1]: uwsgi-app@radicale.service: Main process exited, code=exited, status=238/STATE_DIRECTORY
mai 10 22:54:15 freedombo-t400 systemd[1]: uwsgi-app@radicale.service: Failed with result 'exit-code'.
mai 10 22:54:15 freedombo-t400 systemd[1]: Failed to start uwsgi-app@radicale.service - radicale uWSGI app.

This is repeating itself today. Any advice is appreciated.

EDIT: I just updated the journal quote, as some lines had been truncated, missing perhaps the most interesting part (“File exists”).

$ ls -ld /var/lib/radicale
drwxr-xr-x 3 root root 4096 May 10 22:42 /var/lib/radicale
$ sudo chown radicale:radicale /var/lib/radicale
$ ls -ld /var/lib/radicale
drwxr-xr-x 3 radicale radicale 4096 May 10 22:42 /var/lib/radicale

Then, in plinth, I disabled radicale and re-enabled it. Now radicale works.

Permission or owner issue in the restore function for radicale?

It does not work again. So the solution was wrong.

On my machine, /var/lib/radicale is symlinked to /var/lib/private/radicale.

lrwxrwxrwx 1 root     root       16 Mar 31 08:19 radicale -> private/radicale

while, private/radicale looks like this:

drwxr-xr-x 1 radicale radicale  22 Mar 20  2023 radicale

Thanks. I tried that, but it still fails, and I still have exactly the same errors like shown above.

I tried uninstalling radicale, installing it again and restoring the backup.

In the journal, I see:

mai 12 19:40:14 freedombo-t400 uwsgi[20192]: DAMN ! worker 1 (pid: 20240) died :( trying respawn ...
mai 12 19:40:14 freedombo-t400 uwsgi[20192]: Respawned uWSGI worker 1 (new pid: 20247)
mai 12 19:40:14 freedombo-t400 uwsgi[20192]: DAMN ! worker 2 (pid: 20241) died :( trying respawn ...
mai 12 19:40:14 freedombo-t400 uwsgi[20192]: Respawned uWSGI worker 2 (new pid: 20248)
mai 12 19:40:14 freedombo-t400 uwsgi[20192]: DAMN ! worker 3 (pid: 20242) died :( trying respawn ...
mai 12 19:40:14 freedombo-t400 uwsgi[20247]: chdir() to /var/lib/radicale/collections
mai 12 19:40:14 freedombo-t400 uwsgi[20247]: chdir(): Permission denied [core/uwsgi.c line 3498]
mai 12 19:40:14 freedombo-t400 uwsgi[20192]: Respawned uWSGI worker 3 (new pid: 20249)
mai 12 19:40:14 freedombo-t400 uwsgi[20248]: chdir() to /var/lib/radicale/collections
mai 12 19:40:14 freedombo-t400 uwsgi[20248]: chdir(): Permission denied [core/uwsgi.c line 3498]
mai 12 19:40:14 freedombo-t400 uwsgi[20249]: chdir() to /var/lib/radicale/collections
mai 12 19:40:14 freedombo-t400 uwsgi[20249]: chdir(): Permission denied [core/uwsgi.c line 3498]

/var/lib/radicale is a symbolic link to /var/lib/private/radicale

root@freedombo-t400:/var/lib/private# ls -la
total 16
drwx------  4 root   root    4096 12 mai   16:41 .
drwxr-xr-x 54 root   root    4096 12 mai   16:41 ..
drwxr-xr-x  3 nobody nogroup 4096 12 mai   16:37 radicale
drwxr-xr-x  3 root   root    4096 12 mai   16:41 uwsgi

I don’t know whether nobody and nogroup are the proper owner and group.

Have you tried uninstalling and restoring directly without installing the app?

This is how I did initially, so this time I tried doing differently.

First, you could give it a shot at doing a sudo chown -r radicale:radicale /var/lib/private/radicale.

I tried changing the permissions of /var/lib/private, adding x for all, I changed the shell of radicale to bash, did sudo su radicale then cd /var/lib/radicale/collections and it worked. However, radicale still fails.

RE: uninstalling

If I understood correctly, you reinstalled FreedomBox from the beginning and restored everything, except Radicale (because it failed during the first restore).

I wondered if the uninstall process was able to remove these directories that give permission errors or if this botched restore created these directories with permissions that block their removal and now can’t be written to.

But does your /var/lib/private/radicale still says nobody:nogroup?

Strangely, all my files in that directory, including the directory itself are owned by radicale:radicale.

I tried restoring all with the first restore, but restore of radicale failed. Then I did restore again without radicale. Then then I uninstalled radicale and installed it agin.

Also uwsgi is radicale:radicale?

This is my /var/lib/private:

drwx------ 1 root     root      26 Mar 31 08:19 .
drwxr-xr-x 1 root     root     644 Mar 31 08:19 ..
drwxr-xr-x 1 radicale radicale  22 Mar 20  2023 radicale
drwxr-xr-x 1 root     root      16 Mar 31 08:19 uwsgi

I was suggesting stopping the service first and then:

sudo chown -R radicale:radicale /var/lib/private/radicale

Then starting the service.

Edit: fixed wrong case in short option

Yes. So I decided to change it like you. I also see a radicale directory in uwsgi, also owned by nobody:nogroup, while uwsgi is owned by root.

/var/lib/private/uwsgi looks like this:

drwxr-xr-x 1 root   root    16 Mar 31 08:19 .
drwx------ 1 root   root    26 Mar 31 08:19 ..
drwxr-xr-x 1 nobody nogroup  0 Mar 31 08:19 radicale

Starting the service after did not work, but after reboot it works! This ownership change seems to have fixed the problem :partying_face: :partying_face: :partying_face:

Thanks a lot for the help :clap::clap::clap:

1 Like

I did another reinstall and restore on another computer (x86 PC), and radicale wasn’t working properly. I got it working after:

  • changing the owner of /var/lib/private/radicale (by the way the right option is -R, not -r)
  • rebooting
  • uninstalling and re-installing radicale, and restoring the backup

To me, that seems to say that there is some problem with radicale, but I am not sure it is exactly identified.

EDIT: this morning, it does not work again.
EDIT2: /var/lib/radicale was a normal director, with an empty collections sub-directory. After removing it and creating a symlink to /var/lib/private/radicale and rebooting, radicale is working. Let’s see over the next days.

2 Likes

@Avron I had a similar issue recently and was able to make it work as described here:

Tl;dr: Purge, reinstall and manual restore of the data files incl. chowning them properly.

Hope this helps!
Axel