Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bundled borg is preferred over system borg (macOS) #2100

Open
2 tasks done
ThomasWaldmann opened this issue Oct 18, 2024 · 12 comments
Open
2 tasks done

bundled borg is preferred over system borg (macOS) #2100

ThomasWaldmann opened this issue Oct 18, 2024 · 12 comments
Labels
status:needs details Needs more details before it can be solved.

Comments

@ThomasWaldmann
Copy link
Collaborator

Description

After stumbling over #2099 I also noticed that vorta seems to prefer the borg that comes bundled with it, even if the user has installed another borg on their system.

In my case, I have:

tw@MacBook-Pro ~ % which borg       
/opt/homebrew/bin/borg
tw@MacBook-Pro ~ % borg -V
borg 1.4.0

And that borg is the Apple Silicon binary, which would be better than the currently bundled Intel binary inside vorta.

Reproduction

  • I tried to reproduce the issue.
  • I was able to reproduce the issue.

OS

macOS 15

Version of Vorta

0.10.0 beta1

What did you install Vorta with?

Binary

Version of Borg

1.4.0

Logs

No response

@ThomasWaldmann ThomasWaldmann changed the title bundled borg is preferred over system borg bundled borg is preferred over system borg (macOS) Oct 18, 2024
@m3nu
Copy link
Contributor

m3nu commented Oct 18, 2024

Not seeing that. It's using the Homebrew version for me.

Screenshot 2024-10-18 at 19 18 47

@m3nu m3nu added the status:needs details Needs more details before it can be solved. label Oct 18, 2024
@ThomasWaldmann
Copy link
Collaborator Author

ThomasWaldmann commented Oct 18, 2024

I just restarted vorta, still the same: it wants to use the bundled borg.

2024-10-18 21:05:20,068 - vorta.i18n - DEBUG - Loading translation succeeded for ['en-DE', 'en-Latn-DE', 'de-DE', 'de-Latn-DE', 'de'].
2024-10-18 21:05:20,072 - vorta.scheduler - WARNING - Failed to connect to DBUS interface to detect sleep/resume events
2024-10-18 21:05:20,228 - root - DEBUG - Not a private SSH key file: authorized_keys
2024-10-18 21:05:20,229 - root - DEBUG - Not a private SSH key file: ykpub
2024-10-18 21:05:20,243 - vorta.views.source_tab - DEBUG - Added item number 0 from 1
2024-10-18 21:05:20,612 - root - INFO - Using DarwinNetworkStatus NetworkStatusMonitor implementation.
2024-10-18 21:05:20,688 - vorta.borg.jobs_manager - DEBUG - Add job for site default
2024-10-18 21:05:20,688 - vorta.borg.jobs_manager - DEBUG - Start job on site: default
2024-10-18 21:05:20,689 - vorta.borg.borg_job - INFO - Running command /Applications/Vorta.app/Contents/Resources/borg-dir/borg.exe --version
2024-10-18 21:05:21,204 - vorta.borg.jobs_manager - DEBUG - Finish job for site: default
2024-10-18 21:05:21,204 - vorta.borg.jobs_manager - DEBUG - No more jobs for site: default
2024-10-18 21:05:25,290 - vorta.scheduler - DEBUG - Refreshing all scheduler timers
2024-10-18 21:05:25,291 - vorta.scheduler - INFO - Setting timer for profile 1
2024-10-18 21:05:25,291 - vorta.scheduler - DEBUG - Scheduling next run for 2024-10-19 00:03:32.628913

@ThomasWaldmann
Copy link
Collaborator Author

Just checked out vorta master branch and installed it to a venv:

That one finds the homebrew borg:

2024-10-18 21:48:17,192 - vorta.borg.borg_job - INFO - Running command /opt/homebrew/bin/borg --version

@ThomasWaldmann
Copy link
Collaborator Author

ThomasWaldmann commented Oct 18, 2024

    @classmethod
    def prepare_bin(cls):
        """Find packaged borg binary. Prefer globally installed."""

        borg_in_path = shutil.which('borg')

        if borg_in_path:
            return borg_in_path
        elif sys.platform == 'darwin':
            # macOS: Look in pyinstaller bundle
            from Foundation import NSBundle

            mainBundle = NSBundle.mainBundle()

            bundled_borg = os.path.join(mainBundle.bundlePath(), 'Contents', 'Resources', 'borg-dir', 'borg.exe')
            if os.path.isfile(bundled_borg):
                return bundled_borg
        return None

Guess we need some additional logging in the else-branch for os.environ["PATH"] because the shutil.which obviously could not find my homebrew borg (and it is found if I use which in a terminal).

@m3nu
Copy link
Contributor

m3nu commented Oct 18, 2024

vorta.spec has the path that's being searched. This is an Apple app setting. Currently it's

/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin

@ThomasWaldmann
Copy link
Collaborator Author

That might be, but something is broken there.

My borg is in /opt/homebrew/bin and does not get found by shutil.which.

@maximede
Copy link

Same issue on my side.
If that helps, vorta was installed with brew too

@m3nu
Copy link
Contributor

m3nu commented Oct 22, 2024

I think in the case of Thomas, it was Borg that was installed from homebrew.

Is there a difference when using Vorta downloaded from Github? (Homebrew also downloads from there, so it should be the same file). In which path is your Borg binary? Also in /opt/homebrew/bin?

@maximede
Copy link

Same for me, both borg and vorta are installed from homebrew

# which borg
/opt/homebrew/bin/borg

@m3nu
Copy link
Contributor

m3nu commented Oct 22, 2024

Still can't reproduce this with fresh settings.

Screenshot 2024-10-22 at 13 47 33

@ThomasWaldmann
Copy link
Collaborator Author

BTW, IIRC finding the homebrew borg from vorta has worked for me at some time in the past. I remember installing the Apple Silicon version of borg from homebrew, so that Vorta does not use the bundled Intel version of borg. At that time, I verified that the Apple Silicon version gets invoked by vorta. But that was quite a while ago.

Recently, upgraded macOS and also vorta (see top post).

@ThomasWaldmann
Copy link
Collaborator Author

BTW, I reproduced the issue (see top post) with vorta 0.9.1 installed via brew.

It also wants to use the bundled borg and not the one from homebrew.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:needs details Needs more details before it can be solved.
Projects
None yet
Development

No branches or pull requests

3 participants