borg icon indicating copy to clipboard operation
borg copied to clipboard

AssertionError when trying to init repository on samba cifs directory

Open Bingo90 opened this issue 8 months ago • 5 comments

I'm trying to create a repository, but I keep getting this error:

Failed to securely erase old repository config file (hardlinks not supported). Old repokey data, if any, might persist on physical storage.
Local Exception
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/borg/archiver.py", line 5391, in main
    exit_code = archiver.run(args)
  File "/usr/lib/python3.13/site-packages/borg/archiver.py", line 5309, in run
    rc = func(args)
  File "/usr/lib/python3.13/site-packages/borg/archiver.py", line 191, in wrapper
    return method(self, args, repository=repository, **kwargs)
  File "/usr/lib/python3.13/site-packages/borg/archiver.py", line 316, in do_init
    repository.commit(compact=False)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/borg/repository.py", line 536, in commit
    self.write_index()
    ~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/borg/repository.py", line 664, in write_index
    assert transaction_id is not None
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Platform: Linux christian-arch 6.14.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 20 Apr 2025 12:38:52 +0000 x86_64
Linux: Unknown Linux  
Borg: 1.4.0  Python: CPython 3.13.3 msgpack: 1.0.5 fuse: pyfuse3 3.4.0 [pyfuse3,llfuse]
PID: 7028  CWD: /home/christian
sys.argv: ['/usr/bin/borg', 'init', '--encryption', 'repokey', '/media/NAS/MB_Backup/Christian/christian-test2/']
SSH_ORIGINAL_COMMAND: None

This is the command I used, but it also doesn't work when using Vorta (flatpak or package, neither work). borg init --encryption repokey /media/NAS/MB_Backup/Christian/christian-test2/

The directory is empty.

It does work when using a folder locally on my PC though.

mount output for network drive: //192.168.178.26/NAS on /media/NAS type cifs (rw,relatime,vers=2.1,cache=strict,upcall_target=app,username=christian,uid=1000,forceuid,gid=1000,forcegid,addr=192.168.178.26,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,reparse=nfs,nativesocket,symlink=native,rsize=65536,wsize=65536,bsize=1048576,retrans=1,echo_interval=60,actimeo=1,closetimeo=1,x-systemd.automount)

Bingo90 avatar Apr 23 '25 02:04 Bingo90

The warning about missing hardlink capability is harmless, borg should also work without that (just a bit less secure in some situations).

The traceback below is strange. Likely we have an issue with the smbfs/cifs fs, but there is no fs related error (like an OSError) visible.

Is that reproducible? Can you also reproduce with another SMB server (e.g. a folder shared from a windows or normal linux machine, not your NAS)?

ThomasWaldmann avatar Apr 23 '25 16:04 ThomasWaldmann

Please add the output of mount to the top post, so we can see the smbfs/cifs mount options.

ThomasWaldmann avatar Apr 23 '25 16:04 ThomasWaldmann

Please add the output of mount to the top post, so we can see the smbfs/cifs mount options.

Sure, added the output for the relevant drive.

Bingo90 avatar Apr 24 '25 16:04 Bingo90

Has that nounix a good reason to be there?

ThomasWaldmann avatar Apr 24 '25 16:04 ThomasWaldmann

Has that nounix a good reason to be there?

It isn't something I've added myself - it's just this in fstab:

//192.168.178.26/NAS /media/NAS cifs auto,x-systemd.automount,credentials=/home/christian/.smbcredentials,iocharset=utf8,noserverino,dir_mode=0777,file_mode=0777,x-gvfs-show 0 0

Bingo90 avatar Apr 25 '25 02:04 Bingo90

Did you find out more meanwhile?

ThomasWaldmann avatar Oct 09 '25 16:10 ThomasWaldmann

Did you find out more meanwhile?

No, unfortunately not

Bingo90 avatar Oct 09 '25 16:10 Bingo90

I tried to reproduce, but couldn't, it just worked for me as expected:

  • borg 1.4.0
  • client: ubuntu 24.04 with cifs-utils for mount.cifs
  • server: ubuntu 24.04 with user home directory exported as samba share

For mounting, I only gave:

sudo mount.cifs //server/user mnt -o cred=path-to-credentials,uid=myuser,gid=mygroup

The uid/gid option is so that my current user has r/w permissions to the mount.

Then tried:

borg init -e repokey mnt/myrepo

Worked without a problem, I also did NOT get the warning msg "Failed to securely erase old repository config file (hardlinks not supported)".

ThomasWaldmann avatar Oct 09 '25 17:10 ThomasWaldmann

I also tried some of the options seen in your mount output: some were not supported by my mount.cifs, but the ones that were supported did not reproduce the issue.

So, guess either your smb client or server is broken?

If your NAS also supports NFS, you can try your luck with that.

ThomasWaldmann avatar Oct 09 '25 17:10 ThomasWaldmann

I am closing this as I can't do more without more information and also it does not look like a borg issue, but rather like a fs issue.

ThomasWaldmann avatar Oct 09 '25 17:10 ThomasWaldmann