Closed NicoHood closed 7 years ago
It's not really a snap-pac issue. I don't know you're btrfs layout (which subvolumes, etc). I suggest posting this on the arch forum.
I am using the suggested btrfs layout. This means @/
mounted as /
get backed up. And in the path is the file /var/lib/pacman/db.lck
which will be created when pacman is run. So this pacman hooks needs to ensure that this file is removed before the pre hook runs (aka pacman is not locked anymore). I am not sure if a hook for pacman can run that late.
https://bbs.archlinux.org/viewtopic.php?pid=1652907#p1652907
I don't think snap-pac should be touching /var/lib/pacman/db.lck
. That file is never in any pre/post snapshot I have taken when using pacman/snap-pac. It sounds like a pacman error occurred and it was left behind when a snapshot was taken, but I'm not sure.
I am sorry, but this file is in every pre/post snapshot I've made.
I stand corrected. I do have the db.lck
file in pre/post snapshots (I mistakenly looked at the timeline ones). The pre snapshot is the very first snapshot taken and the post snapshot is the very last one. I don't think there's a way to make them earlier/later than when pacman creates this file. Thanks for bringing it back up.
Solution 1: Document that users need to remove this manually when restoring from a snapshot. Solution 2: Document that users can exclude the path from snapshots by making it a subvolume (but would also exclude subdirs). Solution 3: Have snap-pac mess with the file - I don't think that is a good idea or feasible.
Other ideas?
I can only think of solution 1 for now. Solution 2 is not a good idea, as this will remove the installed package structure from the backup. Solution 3 is also too hacky. The file has its purpose.
Another idea would be to ask if we can change pacman itself, that you can have pre lock hooks and past lock hooks.
Added info about this to troubleshooting section, so closing.
Thanks. I'd add the acutal path to the file like this:
"removing the lock file in /var/lib/pacman/db.lck
."
That's the default location, but it could be present somewhere else if the user changes pacman.conf
's settings (RootDir
, DBPath
, etc.). Pacman gives the exact location to the user when present.
Then possibly only add db.lck
. I am saying this, so you can search for this error better. If its in the readme I'd search for those keywords (as I did when you said you added it). Just a suggestion from my side. But thanks for the note, its good to know that its not essentially this path.
Hello guys. I understand that touching directly db.lck
could be not a good idea as first impression, I think could be good that, after a snapshot restore, snap-pac popup a window with the message like "If you get the error xxxxx pacman locked db xxxx, run rm -rf /var/lib/pacman/db.lck for unlocking pacman"
It is also possible to create filters for that file!
I recently needed to restore an older snapshot of my root. I've followed this instructions.
This were my snapshots:
I've restored snapshot 20 and when i tried
pacman -Syu
it gave me:I am not sure if you can conside that in snap-pac. A delay might also be somehow ugly.