[Errno 20] Not a directory #1007

Closed
opened 2025-02-24 22:08:55 +00:00 by mrclschstr · 3 comments

What I'm trying to do and why

As I already mentioned in #1006, I am currently testing the update from borgmatic 1.8.X to 1.9.X. During the restore of files I noticed the following warnings:

hetzner: Extracting archive latest
borgmatic/bootstrap: open: [Errno 20] Not a directory: '/borgmatic/bootstrap'
borgmatic/bootstrap/manifest.json: makedirs: [Errno 20] Not a directory: '/borgmatic/bootstrap'
borgmatic/bootstrap: makedirs: [Errno 20] Not a directory: '/borgmatic/bootstrap'
borgmatic/mariadb_databases: makedirs: [Errno 20] Not a directory: '/borgmatic/mariadb_databases'
borgmatic/mariadb_databases/mariadb: makedirs: [Errno 20] Not a directory: '/borgmatic/mariadb_databases'
borgmatic/mariadb_databases/mariadb/nextcloud: makedirs: [Errno 20] Not a directory: '/borgmatic/mariadb_databases'
borgmatic/mariadb_databases/mariadb: makedirs: [Errno 20] Not a directory: '/borgmatic/mariadb_databases'
borgmatic/mariadb_databases: makedirs: [Errno 20] Not a directory: '/borgmatic/mariadb_databases'
Exception ignored in: <function RemoteRepository.__del__ at 0x7f83551bd260>
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/borg/remote.py", line 637, in __del__
AttributeError: 'NoneType' object has no attribute 'debug'

summary:
Successfully ran configuration file

Restoring files still works without any recognizable problems.

Steps to reproduce

Just restore (extract) files from a backup:

docker compose exec -T borgmatic borgmatic extract --archive latest --verbosity 1

Actual behavior

The files are restored without any recognizable problems, but the error messages mentioned above appear in the log.

Expected behavior

The extract function is not affected.

Other notes / implementation ideas

No response

borgmatic version

1.9.12

borgmatic installation method

Container

Borg version

1.4.0

Python version

3.13.2

Database version (if applicable)

n/a

Operating system and version

Ubuntu 22.04.5 LTS

### What I'm trying to do and why As I already mentioned in #1006, I am currently testing the update from borgmatic 1.8.X to 1.9.X. During the restore of files I noticed the following warnings: ``` hetzner: Extracting archive latest borgmatic/bootstrap: open: [Errno 20] Not a directory: '/borgmatic/bootstrap' borgmatic/bootstrap/manifest.json: makedirs: [Errno 20] Not a directory: '/borgmatic/bootstrap' borgmatic/bootstrap: makedirs: [Errno 20] Not a directory: '/borgmatic/bootstrap' borgmatic/mariadb_databases: makedirs: [Errno 20] Not a directory: '/borgmatic/mariadb_databases' borgmatic/mariadb_databases/mariadb: makedirs: [Errno 20] Not a directory: '/borgmatic/mariadb_databases' borgmatic/mariadb_databases/mariadb/nextcloud: makedirs: [Errno 20] Not a directory: '/borgmatic/mariadb_databases' borgmatic/mariadb_databases/mariadb: makedirs: [Errno 20] Not a directory: '/borgmatic/mariadb_databases' borgmatic/mariadb_databases: makedirs: [Errno 20] Not a directory: '/borgmatic/mariadb_databases' Exception ignored in: <function RemoteRepository.__del__ at 0x7f83551bd260> Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/borg/remote.py", line 637, in __del__ AttributeError: 'NoneType' object has no attribute 'debug' summary: Successfully ran configuration file ``` Restoring files still works without any recognizable problems. ### Steps to reproduce Just restore (extract) files from a backup: ``` docker compose exec -T borgmatic borgmatic extract --archive latest --verbosity 1 ``` ### Actual behavior The files are restored without any recognizable problems, but the error messages mentioned above appear in the log. ### Expected behavior The extract function is not affected. ### Other notes / implementation ideas _No response_ ### borgmatic version 1.9.12 ### borgmatic installation method Container ### Borg version 1.4.0 ### Python version 3.13.2 ### Database version (if applicable) n/a ### Operating system and version Ubuntu 22.04.5 LTS
Owner

The traceback itself is coming from Borg, and I'm not sure exactly what's causing it. If you can reproduce it without borgmatic, e.g. by manually running the extract command that borgmatic itself is running, then you might be able to file a ticket with the Borg project. You can see the extract command that borgmatic is running in the borgmatic output when run with --verbosity 2.

But I think I know what's causing the "Not a directory" messages, which I believe are also from Borg. The /borgmatic directory within an archive is where borgmatic stores database backups. You normally shouldn't need to extract them as long as borgmatic restore works for restoring your databases. But even if you do extract /borgmatic paths from an archive, /borgmatic should get created on your filesystem as a normal directory like any other from the archive (in the current directory by default).

The problem stems from the fact that you already have a file in the current directory named borgmatic, and therefore Borg can't create a directory there! That's why it's complaining that borgmatic is "Not a directory".

You have a few different options for working around this:

  • Delete the borgmatic file before extracting.
  • Or extract the archive to a different location (see --destination or just cd first).
  • Or omit the borgmatic path when extracting (see --path).
The traceback itself is coming from Borg, and I'm not sure exactly what's causing it. If you can reproduce it without borgmatic, e.g. by manually running the `extract` command that borgmatic itself is running, then you might be able to file a ticket with the Borg project. You can see the `extract` command that borgmatic is running in the borgmatic output when run with `--verbosity 2`. But I think I know what's causing the "Not a directory" messages, which I believe are also from Borg. The `/borgmatic` directory within an archive is where borgmatic stores database backups. You normally shouldn't need to extract them as long as `borgmatic restore` works for restoring your databases. But even if you do extract `/borgmatic` paths from an archive, `/borgmatic` *should* get created on your filesystem as a normal directory like any other from the archive (in the current directory by default). The problem stems from the fact that you already have a file in the current directory named `borgmatic`, and therefore Borg can't create a directory there! That's why it's complaining that `borgmatic` is "Not a directory". You have a few different options for working around this: * Delete the `borgmatic` file before extracting. * Or extract the archive to a different location (see `--destination` or just `cd` first). * Or omit the `borgmatic` path when extracting (see `--path`).
Author

Thank you for pointing me in the right direction. You are right that a file called /borgmatic exists in the container, which would also explain the error messages. I did some digging and I have a hunch that the bash completion setup is not working properly and is leaving a file named borgmatic in the root directory, see: github.com/borgmatic-collective/docker-borgmatic@17543f35ee/Dockerfile (L74)

I will leave an issue in the appropriate github repos. Thanks for the great help!

EDIT: For reference https://github.com/modem7/docker-borgmatic/issues/173

Thank you for pointing me in the right direction. You are right that a file called `/borgmatic` exists in the container, which would also explain the error messages. I did some digging and I have a hunch that the bash completion setup is not working properly and is leaving a file named `borgmatic` in the root directory, see: https://github.com/borgmatic-collective/docker-borgmatic/blob/17543f35eef6d59e77a15b079dba2add96c0066a/Dockerfile#L74 I will leave an issue in the appropriate github repos. Thanks for the great help! **EDIT:** For reference https://github.com/modem7/docker-borgmatic/issues/173
Owner

Ah, nice sleuthing! I'll close this ticket for now and follow along with the one you just filed.

Ah, nice sleuthing! I'll close this ticket for now and follow along with the one you just filed.
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#1007
No description provided.