You are not logged in.

#1 2023-07-09 02:18:29

Unrivaled
Member
Registered: 2022-10-01
Posts: 4

Any way to recover my package db? [SOLVED]

I made a big oopsie and deleted my /var/lib/pacman folder while deleting cache manually with rm -rf.
When I use the pacman (or yay) -Sc it doesn't delete my cache even if I hit "y" for REASONS, so I do it myself, but this time I deleted the last folder it checks because I'm a stupid piece of shit and now my db is gone! 
https://wiki.archlinux.org/title/Pacman … l_database
The pacrestore script doesn't fill any of the text files it creates and the Xyne's script throws an error (the "updated" version someone created does too)   
I copy pasted the script as is, so maybe I had to do something that I don't know how.

https://files.catbox.moe/hyp929.png

What can I do? I have my pacman.log from day one and the other command (paclog --pkglist --logfile=/var/log/pacman.log) works and spits my packages (not every single one because I have no idea how to make Konsole input without limits) 
Reinstalling my system is a huge pain for me, I'd rather not.

Thank you beforehand.



moderator edit -- replaced oversized image with link.
Pasting pictures and code

Last edited by Unrivaled (2023-07-09 18:28:16)

Offline

#2 2023-07-09 05:43:08

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,132

Re: Any way to recover my package db? [SOLVED]

pacman (or yay) -Sc it doesn't delete my cache even if I hit "y" for REASONS

"REASONS" are laid out in the manpage, maybe read it at some time…

I have my pacman.log from day one and the other command (paclog --pkglist --logfile=/var/log/pacman.log) works and spits my packages (not every single one because I have no idea how to make Konsole input without limits)

So where's the problem? Wy did you even bother w/ Xyne's script?

Since you probably wiped the cache, files.list is supposed to be empty, but from your mostly unhelpful screenshot it almost looks like you ran the script as "sh pacrecover.sh"
That's totally and completely and fundamentally wrong on several levels.
Make the script executionable and use the commend from the wiki where the paclog output gets piped into ./pacrecover.sh - do NOT invoke that as "sh", sh (most likely) runs bash in POSIX mode what might "break" the script.

Also please replace the oversized image w/ a link, the board has a 250x250px max rule

Online

#3 2023-07-09 16:42:58

Unrivaled
Member
Registered: 2022-10-01
Posts: 4

Re: Any way to recover my package db? [SOLVED]

seth wrote:

"REASONS" are laid out in the manpage, maybe read it at some time…

I don't know why as a newbie I would think this is nothing but a pacman bug when the "yes" command instead of the output being "ummm you have to read this to figure out how to wipe your cache!" it says "removing old packages from cache..."

seth wrote:

So where's the problem? Why did you even bother w/ Xyne's script?

Because the AUR script wasn't spitting the pkgs, even when I tried using the whole paclog command and the shell script.
I also stated I have no idea how to make konsole output the 1400~ packages without cutting them off, so I wasn't having the whole list in the first place.

seth wrote:

Since you probably wiped the cache, files.list is supposed to be empty, but from your mostly unhelpful screenshot it almost looks like you ran the script as "sh pacrecover.sh"
That's totally and completely and fundamentally wrong on several levels.
Make the script executionable and use the commend from the wiki where the paclog output gets piped into ./pacrecover.sh - do NOT invoke that as "sh", sh (most likely) runs bash in POSIX mode what might "break" the script.

./pacrecover.sh was giving me a "command not found" for whatever reason, so I had to use sh instead. And yes, it was executable. Maybe I was doing something wrong, but at that point I didn't know any better.
Whatever, it seems I made a mistake when writing the command. From what I remember last night I ran the script and it filled my pkg list so that's good. I already recovered my packages.

Sorry for not answering, it was 5AM when you replied so I was already sleeping!

Offline

#4 2023-07-09 17:10:17

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,132

Re: Any way to recover my package db? [SOLVED]

./pacrecover.sh was giving me a "command not found" for whatever reason

"Whatever reason" is
a) typo
b) you forgot to "chmod +x" the file
c) you placed it onto a filesystem that was mounted "noexec"
Most likely (b)

The most critical part is to feed the output of paclog into the script, otherwise it doesn't do anything.



I don't know why as a newbie I would think this is nothing but a pacman bug when the "yes" command instead of the output being "ummm you have to read this to figure out how to wipe your cache!" it says "removing old packages from cache..."

You're not a newbie at reading, I assume. So the cop-out doesn't count.
https://man.archlinux.org/man/core/pacm … PLY_TO_-S) says:

Use one --clean switch to only remove packages that are no longer installed; use two to remove all files from the cache.

Don't coyppaste commands into a terminal if you don't even know what they're doing. One malign source and you're fucked.

Online

#5 2023-07-09 17:39:42

Unrivaled
Member
Registered: 2022-10-01
Posts: 4

Re: Any way to recover my package db? [SOLVED]

Don't coyppaste commands into a terminal if you don't even know what they're doing. One malign source and you're fucked.

You're right, though I probably misread it at some point and thought the -Sc should do the trick for all (I often use the -h command to see what I can do). I don't usually run commands people write unless I know what they do or is from a reputable source like the arch wiki. I appreciate you tell me that, though.

"Whatever reason" is
a) typo
b) you forgot to "chmod +x" the file
c) you placed it onto a filesystem that was mounted "noexec"
Most likely (b)
The most critical part is to feed the output of paclog into the script, otherwise it doesn't do anything.

Maybe I did one of those; ./ works now.
Whatever, thing is done for all I know.

Thanks for replying.

Offline

#6 2023-07-09 17:50:01

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,132

Re: Any way to recover my package db? [SOLVED]

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Online

Board footer

Powered by FluxBB