borg icon indicating copy to clipboard operation
borg copied to clipboard

run in venv w/ root rights

Open CrysK opened this issue 1 year ago • 2 comments

Hello folks,

I have switched borg from apt v1.2.0 to python3 v1.2.8 (Ubuntu 22 LTS). So far everything has worked great, everything according to the instructions. I have installed everything in a user virtualenv. But now I don't have access to my old backups anymore, because I had run them in the past as root (I think because I also backed up /boot /etc ...). But I can't start borg as root in venv: ERROR: unknown command "borg"

What do I change so that I can run borg with the existing backups? Do I have to change the rights of the backups? Or do I have to install borg as root in a venv (which is not the purpose of a venv!?)?

Thank you very much!

CrysK avatar May 01 '24 13:05 CrysK

as you didn't share the command you executed I suspect you tried to use sudo to run borg in the venv, and sudo rightfully took the venv out of the path

if you use sudo on a borg installed in a virtualenv, you need to pass the complete path of the executable

RonnyPfannschmidt avatar May 01 '24 13:05 RonnyPfannschmidt

as you didn't share the command you executed

I try as user:

source borg1-env/bin/activate
sudo borg info /path/to/repo

and get sudo: borg: command not found

the same with:

alias borg='source borg1-env/bin/activate; borg'
borg info /path/to/repo
# or
sudo borg info /path/to/repo

as root on the complicated way:

sudo su
cd /
source borg1-su-env/bin/activate # this is a another venv
borg info /path/to/repo # this works

Is there a possibility that I "simply" use borg. Freshly rolled into the console simply borg or sudo borg?

CrysK avatar May 01 '24 19:05 CrysK

The simplest option is often the best: just use the binaries: https://borgbackup.readthedocs.io/en/stable/installation.html#standalone-binary

CrysK avatar May 04 '24 19:05 CrysK