JustinTimperio / pacback

Advanced Version Control for Arch Linux
MIT License
148 stars 4 forks source link

pacback already has an active session running #29

Closed kinleyd closed 4 years ago

kinleyd commented 4 years ago

I had issues similar to that reported under issue titled: Can't create restore point #5

Creating a restore point failed as pacback expected a specific folder to already exist (.cache in my case), and triggered an error. So I manually created the expected folder, but upon re-running: $ sudo pacback -c 1

I continued to get this error: Critical Error! Pacback Already Has An Active Session Running. error: command failed to execute correctly

I tried to find a pacback process to kill but didn't find any, so I rebooted my system, after which the restore point was created.

After another error condition (I don't recall exactly what it was then), I starting getting that same error when I tried to update my system and the pre-upgrade pacback hook got triggered.

The issue seems to be that pacback isn't exiting gracefully under error conditions.

My distro: Arch Linux Kernel 5.8.7, python3 3.8.5, pacback 2.0.0-1

JustinTimperio commented 4 years ago

Hi, yes this happens when pacback reaches an internal fault that causes python to crash. As with the pacman lock system, this can simply be remedied by running sudo rm /tmp/pacback_session.lck.

If you could, can you please send the actual error that python threw? Pacback does gracefully exit and cleans its various lock files when receiving any SIGINT(CTRL-C) and only cannot when the python interpreter reaches some major error. That would be a quite serious bug and is something I would like to patch.

kinleyd commented 4 years ago

Thanks for getting back. I really look forward to pacback being an integral part of my setup!

Regarding the issue:

So I have created a restore point, 1, which shows up as follows:

Restore Points Snapshots │ 01 - Pkgs: 1271 Created: 2020/09/11 │ 00 - Pkgs: 1271 Created: 2020/09/09 │ │ │ 01 - Pkgs: 1270 Created: 2020/09/09 │

Before succeeding at this, I had to manually create the folder /home/lost+found/.cache.

Now I get these messages when I try: $ sudo pacback -f -c 2 Building Full Restore Point 02... Traceback (most recent call last): File "/bin/pacback", line 113, in create.restore_point(config, args.create_rp, args.full_rp, args.add_dir, args.no_confirm, args.label) File "/usr/share/pacback/core/create.py", line 231, in restore_point main(config, info) File "/usr/share/pacback/core/create.py", line 34, in main found_pkgs = utils.search_cache(pkg_search, utils.scan_caches(config), config) File "/usr/share/pacback/core/utils.py", line 143, in scan_caches pkg_paths = find_pkgs_in_dir(fs_paths) File "/usr/share/pacback/core/utils.py", line 35, in find_pkgs_in_dir cache = {f for f in paf.find_files(path) File "/usr/share/pacback/core/paf/file.py", line 72, in find_files z = scan_dir(x) File "/usr/share/pacback/core/paf/file.py", line 19, in scan_dir for x in os.scandir(path): FileNotFoundError: [Errno 2] No such file or directory: '/home/.Trash-0/.cache'

After that, any calls to pacback leads to the error mentioned earlier: Critical Error! Pacback Already Has An Active Session Running.

sudo rm /tmp/pacback_session.lck resolves that, thank you.

Please let me know if I can provide you with any other information to help resolve this.

Thank you again!

Kinley

JustinTimperio commented 4 years ago

Kinley,

So someone pointed this out on Reddit, I made a mistake here by hardcoding and assuming all normal user home paths would exist in /home. I also incorrectly assumed that every directory in /home would be a user path, which in this case is completely wrong. You have a hidden directory in /home called .Trash-0 which pacback is assuming is a user path.

Thankfully I have already written a patch for this by correctly using /etc/passwd to retrieve each normal user's configured /home/user/ path. I hope to push this update today but if you continue to have issues that are creating serious issues for your machine, consider removing /home/.Trash-0.

Thanks, Justin

kinleyd commented 4 years ago

Hey Justin,

Re /home/.Trash-0 I actually don't have such a folder - pacback was looking for that for some reason.

Great to hear that you've identified the problem. Yes, for Arch the user home directory is /home/username. I will look forward to the update. Will it take long to get to the AUR?

I currently use timeshift to manage my system snapshots, and really look forward to adding more granular package management/protection.

Kinley

JustinTimperio commented 4 years ago

The pacback-git package will most likely get updated within a few hours. Once I've done a quick bug test I'll bump versions on the main package.

JustinTimperio commented 4 years ago

So I just pushed a patch fixing these bugs. Both pacback and pacback-git have been bumped to a new release version. https://github.com/JustinTimperio/pacback/releases/tag/v2.0.2

Let me know if this update fixes your issue and I'll close this thread.

Thanks, Justin

kinleyd commented 4 years ago

Yes, the update fixes the issue for me. Thanks a lot Justin!

JustinTimperio commented 4 years ago

You're very welcome!