Backup Pacman Configuration

@joekamprad Installed pakbak-git and edited the conf file. When i run the script to test it say’s pakbak isn’t a folder? I’m not sure if i misunderstood the basic instructions.
“The target directory must be created or already exist.”
Does this mean i have to create the directory in /var/local? Which i did. Then i uncommented the first line in /etc/pakbak.conf. Then i ran sudo systemctl enable pakbak.path and i’m not sure that it worked properly because it also said something about folder path? What am i missing here? Should i not be able to run the script and make it give the first bakup?

The target directory must be created or already exist.

does it ?

 ✘ joe@empowered64  ~  sudo nano /etc/pakbak.conf  
 joe@empowered64  ~  sudo mkdir /var/cache/pacman/pakbak
 joe@empowered64  ~  systemctl start pakbak.path  
 joe@empowered64  ~  systemctl status pakbak.path    
● pakbak.path - Back up pacman database
   Loaded: loaded (/usr/lib/systemd/system/pakbak.path; enabled; vendor preset: disabled)
   Active: active (waiting) since Sat 2019-08-10 17:19:01 CEST; 7s ago

Aug 10 17:19:01 empowered64 systemd[1]: Started Back up pacman database.

Bildschirmfoto%20vom%202019-08-10%2017-21-47

So this is what i didn’t know.

sudo mkdir /var/cache/pacman/pakbak

So does it automatically create a first back up? Where is it stored? I did see Started Back up pacman database? Do i run the script to test it?

I see the folder there but no backup?

Do i have to create a folder also in /var/local called pacbak? I get this when i run the script.

[rick@archlinux ~]$ sudo sh /usr/lib/systemd/scripts/pakbak
[sudo] password for rick: 
/etc/pakbak.conf: line 1: Backup: command not found
/pakbak isn't a folder.. abort
# Backup the database to this folder
target_folder=/path/to/where/you/want/to/backup

# Define how long backups should be kept
# Can be a number of days or empty to disable
keep_days=5

# Define how many backups should be kept
# If more backup are found, the oldest are deleted
# Can be a number of file or empty to disable
keep_number=5

you may uncommend the first line?
# Backup the database to this folder

and you need to create the folder first.

so id you want use default path create it at your system with:
sudo mkdir /pakbak

then restart it:

systemctl restart pakbak.path

I ran the script again. Is that what i was supposed to do? I got this output.

[rick@archlinux ~]$ sudo sh /usr/lib/systemd/scripts/pakbak
[sudo] password for rick: 
/etc/pakbak.conf: line 1: Backup: command not found
tar: Removing leading `/' from member names

I did get the backup in the pakbak folder.

I’m sorry Joe, My fault i forgot to change the path (target_folder = /var/local/pakbak) in /etc/pakbak.conf
That’s the first thing. Then in your instructions on the wiki it doesn’t say anything about:

sudo mkdir /var/cache/pacman/pakbak  

So what is this for to create cache files of the pacman database in order to back it up to the target folder?
When i run the script why does it give the message about removing / and command not found?

[rick@archlinux ~]$ sudo sh /usr/lib/systemd/scripts/pakbak
[sudo] password for rick: 
/etc/pakbak.conf: line 1: Backup: command not found
tar: Removing leading `/' from member names

The reason i’m asking is because i don’t see anything in the /var/cache/pacman/pakbak folder? Was this just another example of where i could have made the target directory to save the backup?

/etc/pakbak.conf: line 1: Backup: command not found

as it is a script each line will have proceeded, and you have accidentally removed the uncommenting # in the first line so it tries to run the first word from the infoline :wink:

# Backup the database to this folder
target_folder=/var/cache/pacman/pakbak

the pakbak service is backing up /var/lib/pacman/local/ so if it gets bad you can restore it…

but if you want to be save, it would be better to back it up somewhere saver on a backup diskoutside your system :wink: i give you /var/cache/pacman/pakbak only as an example…as if your / rootfilepartition is not that big, it will be full of backupfiles each one 22,9 MB in my system per default it will save 5 so not that bad …

but i just see i do alreade write a wiki for it :wink:

https://endeavouros.com/docs/pacman/how-to-backup-pacman-database-automatically/

1 Like

So i guess i didn’t need to create that directory then. :roll_eyes: I read the wiki but i got confused over the statement. The target directory must be created or already exist and i didn’t clue in as i hadn’t changed the target in the conf file. Sorry for wasting your valuable time. :disappointed:

you are reminding me on creating a time plan for my work here :wink:

Well, as long as I’m getting something right. :grin: