Bug 12884 - borgbackup 1.2.0 crashes on running any borg command
Summary: borgbackup 1.2.0 crashes on running any borg command
Status: CLOSED FIXED
Alias: None
Product: IPFire
Classification: Unclassified
Component: --- (show other bugs)
Version: 2
Hardware: unspecified Unspecified
: - Unknown - Crash
Assignee: Adolf Belka
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-22 11:27 UTC by Adolf Belka
Modified: 2022-07-12 10:34 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adolf Belka 2022-06-22 11:27:54 UTC
borgbackup 1.2.0 update built with no problems. However it has been reported on the forum that it is not working.

https://community.ipfire.org/t/borgbackup-dependency-broken/8113


Running any borg command such as borg -h for example gives the following errors.

Traceback (most recent call last):
  File "/usr/bin/borg", line 33, in <module>
    sys.exit(load_entry_point('borgbackup==1.2.0', 'console_scripts', 'borg')())
  File "/usr/bin/borg", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 919, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 518, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for borgbackup
Comment 1 Adolf Belka 2022-06-22 11:32:19 UTC
Bug confirmed on my IPFire  vm systems with borgbackup installed.

Checked borgbackup 1.2.0 on Arch Linux system and borg -h gives help screen, so the problem is not related specifically to the version number.

Compared with Arch Linux installation and found that python-msgpack is installed on their system as a required dependency.
Found requirements file that listed dependencies and msgpack is included there.

This must be a run time dependency as the build completed successfully without any errors and without mentioning msgpack.

running build of borgbackup with python3-msgpack also installed and will test addon in a vm setup.
Comment 2 Adolf Belka 2022-06-22 16:51:09 UTC
msgpack is or was bundled with borgbackup for many versions. It is not 100% clear but it looks like it may now need to be included again, although there is a msgpack.py file in the helpers section of the borgbackup source tarball.

Just in case I built python3-msgpack version 1.0.3  borgbackup specifies that msgpack<=1.0.3

Then on a vm I installed python3-pkgconfig using pakfire. Then I copied the .ipfire packages for python3-msgpack and borgbackup onto the vm machine from the build machine.

Then python3-msgpack was extracted and installed followed by borgbackup.

No difference to running borg -h

Will do a test of going back to the previous version, 1.1.17, of borgbackup to confirm it still works in CU168
Comment 3 Adolf Belka 2022-06-23 13:37:58 UTC
I think I have figured things out.

By running a chroot shell in my IPFire build I ran borg -h and borg -V and got a reply. This was with python3-msgpack built.

Repeating this with no python3-msgpack resulted in a different error message which said that python-msgpack module was not found.

So there was no metadata issue when running in the chroot shell. In this case all the python borgbackup directories have been installed in the python site-packages directory.
In a normal install then only the packages listed in the rootfile are installed.

Reading up about the import.metadata library I found that it gets its information from a file(s) in the egg-info directory. In the borgbackup-1.2.0 release these files were commented out in the rootfile and hence not available when borgbackup was installed.

Checking back with earlier versions of borgbackup these files were not commented out. That was an error I made when I did the 1.2.0 update of borgbackup.

I will now organise a build which includes python3-msgpack and with the egg-info files not commented out in the rootfile and see how that build and installs on my vm.
Comment 4 Adolf Belka 2022-06-23 21:40:32 UTC
Modifying the borgbackup rootfile to include the egg-info directory files has made the importlib.metadata error message to disappear.

@michael also suggested that the egg-info files needed to be present.

So the old error message disappeared but a new one occurred.
Missing module packaging.

python3-packaging was added with borgbackup-1.2.0 but only for the build. It is clear from the latest error message that it is also required for execution.

New build with python3-packaging having the .py files uncommented and moved from common to packages directory under rootfiles. Also added as another dependency for borgbackup in the lfs file.
Comment 5 Adolf Belka 2022-06-24 11:44:41 UTC
I have now successfully built, installed and run borgbackup.

I tested out initialising a backup repo and then carried out two backups to it. All went successfully.

Will now create a patch and submit it to the dev mailing list.
Comment 6 Adolf Belka 2022-06-24 12:17:05 UTC
Patch series submitted to dev mailing list and to patchwork.

https://patchwork.ipfire.org/project/ipfire/list/?series=2922
Comment 9 Adolf Belka 2022-06-30 09:56:25 UTC
I have upgraded a CU168 vm to CU169 and created a borgbackup repo and ran two backups. I also extracted the backups as tar archives and was able to confirm their correctness.

So borgbackup is working fine for a fresh install in CU169.
Comment 10 Peter Müller 2022-07-06 10:07:08 UTC
Excellent - thank you for reporting back.