Errno 2 when listing yunohost backups. I know the reason but I don't know how to fix this

Hello friends,

My YunoHost server

Hardware: Raspberry Pi 3B+
YunoHost version: 4.3.6.3 (stable)
I have access to my server : Through SSH & through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

Hi,
I am writing my personal bash script for backup my yunohost apps. I just use yunohost backup create --apps ... command. And this data is stored on external drive connected to RPi via USB. Everything is fine but I removed one or two backups using just rm -rf command.
So when I want to list my backups - via webadmin or SSH - I can’t do this and I have Errno 2. Listing script just can’t retrieve data about backups that I removed manually.

And there is my question
How to clean list of created backups that Yunohost will stop checking for this specific backups that I removed? Or maybe there is a another way to fix this?

Traceback (most recent call last):
  File "/usr/bin/yunohost", line 72, in <module>
    parser=parser
  File "/usr/lib/moulinette/yunohost/__init__.py", line 25, in cli
    ret = moulinette.cli(args, output_as=output_as, timeout=timeout, top_parser=parser)
  File "/usr/lib/python3/dist-packages/moulinette/__init__.py", line 131, in cli
    args, output_as=output_as, timeout=timeout
  File "/usr/lib/python3/dist-packages/moulinette/interfaces/cli.py", line 496, in run
    ret = self.actionsmap.process(args, timeout=timeout)
  File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 599, in process
    return func(**arguments)
  File "/usr/lib/moulinette/yunohost/backup.py", line 2384, in backup_list
    archives = sorted(archives, key=lambda x: os.path.getctime(x))
  File "/usr/lib/moulinette/yunohost/backup.py", line 2384, in <lambda>
    archives = sorted(archives, key=lambda x: os.path.getctime(x))
  File "/usr/lib/python3.7/genericpath.py", line 65, in getctime
    return os.stat(filename).st_ctime
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/ssd/backup/20220505/20220505-164025.tar'

Thank you for your help.

Sounds like there may still be a .json file corresponding to that old archive, probably ? Like

Unfortunately not.
This is the error:

root@cichamalina:/mnt/ssd/backup# yunohost backup list
Traceback (most recent call last):
  File "/usr/bin/yunohost", line 72, in <module>
    parser=parser
  File "/usr/lib/moulinette/yunohost/__init__.py", line 25, in cli
    ret = moulinette.cli(args, output_as=output_as, timeout=timeout, top_parser=parser)
  File "/usr/lib/python3/dist-packages/moulinette/__init__.py", line 131, in cli
    args, output_as=output_as, timeout=timeout
  File "/usr/lib/python3/dist-packages/moulinette/interfaces/cli.py", line 496, in run
    ret = self.actionsmap.process(args, timeout=timeout)
  File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 599, in process
    return func(**arguments)
  File "/usr/lib/moulinette/yunohost/backup.py", line 2384, in backup_list
    archives = sorted(archives, key=lambda x: os.path.getctime(x))
  File "/usr/lib/moulinette/yunohost/backup.py", line 2384, in <lambda>
    archives = sorted(archives, key=lambda x: os.path.getctime(x))
  File "/usr/lib/python3.7/genericpath.py", line 65, in getctime
    return os.stat(filename).st_ctime
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/ssd/backup/20220505/20220505-164840.tar'

And this is file structure in this directory /mnt/ssd/backup/:

20220506-093448.tar  apps  backup.csv  conf  data  hooks  info.json 

Even directory 20220505 does not longer exist.

Uh wokay that content is a bit funky …

Naively, maybe that info.json is confusing Yunohost. Can you share what it contains ?

What about ls -l /home/yunohost,backup/archives ?

Naively, maybe that info.json is confusing Yunohost. Can you share what it contains ?

No. I can even unmount drive and still I see this error.

What about ls -l /home/yunohost.backup/archives ?

And that is the solution! In /home/yunohost.backup/archives where symlinks that were pointing to this removed backups. I removed them and now everything is fine!

Thank You!

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