[Borg & Borg Server] Deduplicated, encrypted and remote backups

Hello,
I just installed Borg and had the same error message when using sudo.

mondomain.fr : Dec  5 10:26:44 : admin : /etc/sudoers.d/borg is owned by uid 983, should be 0 ; 
TTY=pts/0 ; PWD=/home ; USER=root ; 

I had an email each time.
I didn’t have the error anymore after running :

chown root:root /etc/sudoers.d/borg

Whaou ! ,
I didn’t remember installing Borg before I was born. :smiley:
2021-12-05 10_46_41-Services _ YunoHost Admin

1 Like

@Cyril be sure your server has the correct date, run this command:

date

@ljf date seems ok :

date
dimanche 5 décembre 2021, 15:17:50 (UTC+0100)

I just check now, and the information is correct now :


I run the first backup with Borg, and it just finished.
Maybe it has fixed something…

Do you have the same error as me when you run a diagnostic?

Yes it was a minor issue.

I just made a new version that fixed this alert in diagnosis.

1 Like

Je confirme que la dernière MAJ règle le problème. Merci !

Hi,
I’ve upgraded to version 1.1.16~ynh28

Upgrading borgbackup...

WARNING: You are using pip version 21.3; however, version 21.3.1 is available.

You should consider upgrading via the '/opt/borg-env/bin/python -m pip install --upgrade pip' command.

:thinking: should I?

I guess pip is part of ynh system, not just a borg dependency so I guess it’s safer let ynh select what version is to use.

BTW upgrading finished with success

On my side, I have, since a few weeks now (yes I know, it’s bad to wait) errors on each backups.
I have 2 backups to the same repo (one daily for nextcloud+system, one weekly for the rest).
Here is a log I got this night : https://paste.yunohost.org/raw/upedavupin.hs

I had the same issue in Yunohost 4.3.5, unsure where it’s coming from. Thanks for the fix.

/etc/sudoers.d/borg

Since I upgraded to YunoHost 11, borg do not work anymore.

Even in command line, I have this error :

~ borg -V
Traceback (most recent call last):
  File "/opt/borg-env/bin/borg", line 6, in <module>
    from borg.archiver import main
ModuleNotFoundError: No module named 'borg'

You should try to force upgrade your borg.
If it’s not enough try to remove the borg-env and force upgrade again

rm -Rf /opt/borg-env
1 Like
sudo yunohost app upgrade borg -F

And now, borg -V works.
Let’s wait for tonight for an automatic backup :slightly_smiling_face:

Edit : automatic backup succeded :slightly_smiling_face:

2 Likes

Hi,

Same issue than others with a fresh borg install on YNH 4.3.6.2 (server date is ok)


borg : /etc/sudoers.d/borg is owned by uid 994, should be 0 ; TTY=unknown ; PWD=/ ; USER=root ;

Solved with chown root:root /etc/sudoers.d/borg

Hello,

I installed Borg app on my yuno (Stable, Debian 10 based) using CLI, and wanted to backup on a local folder (/home/backup/borg).

Tried to restart the service, but its status stay on “activating” :

$service borg status
● borg.service - Run backup borg
   Loaded: loaded (/etc/systemd/system/borg.service; static; vendor preset: enabled)
   Active: activating (start) since Tue 2022-06-28 20:16:07 CEST; 1 day 18h ago
 Main PID: 18279 (sudo)
    Tasks: 4 (limit: 4605)
   Memory: 17.6M
   CGroup: /system.slice/borg.service
           ├─18279 /usr/bin/sudo /usr/local/bin/backup-with-borg borg
           ├─18285 /bin/bash /usr/local/bin/backup-with-borg borg
           ├─18288 sudo yunohost app setting borg last_run -v 220628_2016
           └─18290 /usr/bin/python3 /usr/bin/yunohost app setting borg last_run -v 220628_2016

Jun 29 13:20:07 server.noho.st sudo[18279]: Still waiting...
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

All other Yunohost automated actions (Diagnosis, etc…) are blocked by this.

I think I misuse the app. Do I have to install the Borg Server app on the same server to do local backup with borg ?

No

The service should not be running everytime. It’s running only when the cron (or systemd timer) trigger it.
“All other Yunohost automated actions (Diagnosis, etc…) are blocked by this.” → are you sure that your server was not just backing up (it could take a loooong time the first time). It’s normal to not be able to do yunohost action if your backup is running.

Waited almost 3 days before killing the process, the folder size did not change, no CPU activity when looking on htop (when restic run his own backup on distant server, the CPU is under moderate to heavy load).

Here is a df of the server :

Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           387M   40M  347M  11% /run
/dev/sda3       907G  203G  659G  24% /
tmpfs           1.9G   48K  1.9G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1      1000M   81M  851M   9% /boot
tmpfs           387M     0  387M   0% /run/user/5828

Imho, this should not take days to backup no more than 203 GB.

Was the backup folder misplaced (under /home) ?

Home folders are backuped until you have put a .nobackup inside /home/backup dir, it’s possible it create a strange loop.

You probably should watch borg log inside /var/log/borg .

Reinstalled the app, changed the folder to /borgbackup (not in /home).

Plus, I think I used a password with spaces inside, which I should not have done. This time, used a random password without spaces.

Testing the reinstallation with systemctl start borg

The backup ran correctly, but got this on error log :

Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising  error: KeyError('method') (don't panic this is just a warning)
mysqldump: Got error: 1049: "Unknown database 'monitorix'" when selecting the database
Could not back up monitorix
Nothing to save

Well, Monitorix seems to be not backuped, not really a concern.

Anyway, the service is failed :

root@myserver:/var/log/borg# systemctl status borg.service
● borg.service - Run backup borg
   Loaded: loaded (/etc/systemd/system/borg.service; static; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2022-07-02 14:11:51 CEST; 59min ago
  Process: 32656 ExecStart=/usr/bin/sudo /usr/local/bin/backup-with-borg borg (code=exited, status=1/FAILURE)
 Main PID: 32656 (code=exited, status=1/FAILURE)

Jul 02 14:11:51 myserver.noho.st sudo[14846]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/yunohost app setting borg mailalert
Jul 02 14:11:51 myserver.noho.st sudo[14846]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jul 02 14:11:51 myserver.noho.st sudo[14846]: pam_unix(sudo:session): session closed for user root
Jul 02 14:11:51 myserver.noho.st sudo[14848]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/yunohost app setting borg state -v failed
Jul 02 14:11:51 myserver.noho.st sudo[14848]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jul 02 14:11:51 myserver.noho.st sudo[14848]: pam_unix(sudo:session): session closed for user root
Jul 02 14:11:51 myserver.noho.st sudo[32656]: pam_unix(sudo:session): session closed for user root
Jul 02 14:11:51 myserver.noho.st systemd[1]: borg.service: Main process exited, code=exited, status=1/FAILURE
Jul 02 14:11:51 myserver.noho.st systemd[1]: borg.service: Failed with result 'exit-code'.
Jul 02 14:11:51 myserver.noho.st systemd[1]: Failed to start Run backup borg.

Edit : tried yunohost service restart borg : the command run endless, blocking all further yunohost commands.
Restarted the service with a classic service borg restart works (but the status of the service is still Active : failed)

Hello,
I think I can prospect to found an answer, but I do it here…
So, I have a server A on a VPS with two Borg Backup.
The first one borg make a daily backup on an external server B, hosted at home on a Borg Server…
The second one borg__2 make a daily backup on a local folder /mnt/backups/borgachives
The url /mnt/backups is a disk partition which have also a folder archives with a symlink

$ ls -l /home/yunohost.backup/
total 4
lrwxrwxrwx 1 root root   21 Dec 10  2021 archives -> /mnt/backups/archives
drwxrwxrwx 2 root root 4096 Jul  2 04:09 tmp

I think the first backup from server A to server B do also the second local backup and is a deduplicated backup.
How can I configure this first borg backup to do not included the borg__2 and the folder /mnt/backups/borgarchives ??

thanks