You are not logged in.

#1 2022-12-25 12:26:33

Euler-Maskerony
Member
Registered: 2020-06-27
Posts: 30

I broke pacman

I accidentally deleted sync and local directories in /var/lib/pacman, because I thought it will redownload them after. So now I can neither download nor update. I tried to install pacutils package to restore db from pacman.log, but as you may think it also not an option. How to restore db? Help me, please.

Offline

#2 2022-12-25 12:49:55

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: I broke pacman

Euler-Maskerony wrote:

I accidentally deleted sync and local directories in /var/lib/pacman, because I thought it will redownload them after. So now I can neither download nor update.

What happens if you try to download or update? Please post the exact commands used along with the full output. Thanks.

Here's an example from my system to show what I mean:

archie:~$ doas rm -rf /var/lib/pacman/*
archie:~$ doas pacman -Syu
:: Synchronising package databases...
 gnome-unstable                      45.0   B   125   B/s 00:00 [-----------------------------------] 100%
 testing                             29.9 KiB  1107 KiB/s 00:00 [-----------------------------------] 100%
 core                               152.8 KiB  3.73 MiB/s 00:00 [-----------------------------------] 100%
 extra                             1719.3 KiB  8.00 MiB/s 00:00 [-----------------------------------] 100%
 community-testing                   42.6 KiB  2.45 MiB/s 00:00 [-----------------------------------] 100%
 community                            7.2 MiB  8.35 MiB/s 00:01 [-----------------------------------] 100%
 multilib-testing                     4.9 KiB   378 KiB/s 00:00 [-----------------------------------] 100%
 multilib                           161.2 KiB  5.08 MiB/s 00:00 [-----------------------------------] 100%
:: Starting full system upgrade...
 there is nothing to do
archie:~$ ls /var/lib/pacman/                                                          
local  sync
archie:~$

Deleting those files doesn't seem to break anything for me anyway.


Jin, Jîyan, Azadî

Offline

#3 2022-12-25 12:54:49

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: I broke pacman

Head_on_a_Stick wrote:
Euler-Maskerony wrote:

I accidentally deleted sync and local directories in /var/lib/pacman, because I thought it will redownload them after. So now I can neither download nor update.

What happens if you try to download or update? Please post the exact commands used along with the full output. Thanks.

Here's an example from my system to show what I mean:

archie:~$ doas rm -rf /var/lib/pacman/*
archie:~$ doas pacman -Syu
:: Synchronising package databases...
 gnome-unstable                      45.0   B   125   B/s 00:00 [-----------------------------------] 100%
 testing                             29.9 KiB  1107 KiB/s 00:00 [-----------------------------------] 100%
 core                               152.8 KiB  3.73 MiB/s 00:00 [-----------------------------------] 100%
 extra                             1719.3 KiB  8.00 MiB/s 00:00 [-----------------------------------] 100%
 community-testing                   42.6 KiB  2.45 MiB/s 00:00 [-----------------------------------] 100%
 community                            7.2 MiB  8.35 MiB/s 00:01 [-----------------------------------] 100%
 multilib-testing                     4.9 KiB   378 KiB/s 00:00 [-----------------------------------] 100%
 multilib                           161.2 KiB  5.08 MiB/s 00:00 [-----------------------------------] 100%
:: Starting full system upgrade...
 there is nothing to do
archie:~$ ls /var/lib/pacman/                                                          
local  sync
archie:~$

Deleting those files doesn't seem to break anything for me anyway.

Now you should post something like "pacman -Q"' to see if you still have a local package database.

Offline

#4 2022-12-25 12:55:37

Euler-Maskerony
Member
Registered: 2020-06-27
Posts: 30

Re: I broke pacman

~ » sudo pacman -Syyu
:: Synchronizing package databases...
 core                      152.8 KiB   108 KiB/s 00:01 [#############################] 100%
 extra                    1719.3 KiB  1653 KiB/s 00:01 [#############################] 100%
 community                   7.2 MiB  3.45 MiB/s 00:02 [#############################] 100%
 multilib                  161.2 KiB  1008 KiB/s 00:00 [#############################] 100%
:: Starting full system upgrade...
 there is nothing to do
~ » ls /var/lib/pacman
local  sync
~ » ls /var/lib/pacman/local
ALPM_DB_VERSION  pacutils-0.11.1-1

Here is the problem. pacman thinks there are no packages.

Offline

#5 2022-12-25 12:55:46

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: I broke pacman

archie:~$ pacman -Q|grep -c .
921
archie:~$

tongue


Jin, Jîyan, Azadî

Offline

#6 2022-12-25 12:59:53

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,567
Website

Re: I broke pacman

/var/lib/pacman/sync is downloaded again, but /var/lib/pacman/local is a record of all the packages installed on the local system. Removing the latter will cause pacman to think *nothing* is installed to the local system, so when you next try to install a package (that is already present), you will be informed that there are conflicting files.

I assume you are trying to follow https://wiki.archlinux.org/title/Pacman … l_database in which case please elaborate on "I tried to install pacutils package to restore db from pacman.log, but as you may think it also not an option.", what happens when you try to install pacutils?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#7 2022-12-25 13:10:20

Euler-Maskerony
Member
Registered: 2020-06-27
Posts: 30

Re: I broke pacman

WorMzy wrote:

/
I assume you are trying to follow https://wiki.archlinux.org/title/Pacman … l_database in which case please elaborate on "I tried to install pacutils package to restore db from pacman.log, but as you may think it also not an option.", what happens when you try to install pacutils?

It tries to install all dependencies which are already installed.
I have already figured it out and installed pacutils without dependencies. Now I'm following these instructions, but I have empty files.list file and file pkglist full of packages names. What am I doing wrong?

Offline

#8 2022-12-25 13:17:23

Euler-Maskerony
Member
Registered: 2020-06-27
Posts: 30

Re: I broke pacman

WorMzy wrote:

I assume you are trying to follow https://wiki.archlinux.org/title/Pacman … l_database in which case please elaborate on "I tried to install pacutils package to restore db from pacman.log, but as you may think it also not an option.", what happens when you try to install pacutils?

Wait, something happening. I think I am downloading packages. Seems like everything is ok.

Offline

#9 2022-12-25 13:30:36

Euler-Maskerony
Member
Registered: 2020-06-27
Posts: 30

Re: I broke pacman

Update the local database so that packages that are not required by any other package are marked as explicitly installed and the other as dependences. You will need to be extra careful in the future when removing packages, but with the original database lost, it is the best we can do.

Can somebody explain me, what does it mean? What I should be aware of while deleting packages?

Offline

#10 2022-12-25 14:08:05

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,567
Website

Re: I broke pacman

Packages can be either 'explicitly installed' or 'installed as a dependency'. Packages which are marked as the latter are treated as orphans if nothing requires them, and so will be included in the `pacman -Qtd` output as candidates for removal. You should check this output and use `pacman -D --asexplicit` to mark any packages that you want to remain installed if you clear out your orphaned packages.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#11 2022-12-25 16:56:25

webcapcha
Member
Registered: 2019-02-14
Posts: 167

Re: I broke pacman

Can package originally installed explicitly later be marked as dependency?

I have ttf-dejavu-2.37+18+g9b5d1b2f-3 marked as orphaned within pacman -Qqd but if I remember correct I did install it manually.


Ukrainian

Offline

#12 2022-12-25 17:21:18

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,567
Website

Re: I broke pacman

webcapcha wrote:

Can package originally installed explicitly later be marked as dependency?

I have ttf-dejavu-2.37+18+g9b5d1b2f-3 marked as orphaned within pacman -Qqd but if I remember correct I did install it manually.

You aren't specifying the --unrequired (-t) flag, so you're just listing all the packages on your system that are dependencies. Packages can be both explicitly installed and a dependency of another package.

But yes, you can change the installation reason for explicitly installed packages as well. AFAIK the install reason will not change unless you explicitly use the --database (-D) flag with the corresponding option, however.

See pacman's manpage for more details.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#13 2022-12-25 17:30:24

webcapcha
Member
Registered: 2019-02-14
Posts: 167

Re: I broke pacman

The question was a little different. I mean I know that ttf-dejavu marked as dependency for now. I can confirm that. But I'm pretty confident I installed it manually because it's a family of fonts.

So is it possible that package for some reason change state from explicitly installed to the dependency state without my interaction?


Ukrainian

Offline

#14 2022-12-25 20:43:52

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,567
Website

Re: I broke pacman

AFAIK the install reason will not change unless you explicitly use the --database (-D) flag with the corresponding option, however.

This isn't entirely correct -- I forgot that you can also set the install reason (using --asexplicit or --asdepends) during --sync (-S) and --upgrade (-U) operations too.

I certainly wouldn't expect an explicitly installed package to change to 'installed as a dependency' under any other circumstances.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#15 2022-12-26 17:52:52

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: I broke pacman

Head_on_a_Stick wrote:
archie:~$ pacman -Q|grep -c .
921
archie:~$

tongue

Dafuq? Where does pacman -Q look up its stuff?

Offline

#16 2022-12-26 17:55:28

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: I broke pacman

Sorry Awebb, I only deleted the database in an ephemeral systemd-nspawn container. Just winding up the OP really. Sorry again. I'll shut up now.


Jin, Jîyan, Azadî

Offline

#17 2022-12-27 00:52:28

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,178

Re: I broke pacman

webcapcha wrote:

The question was a little different. I mean I know that ttf-dejavu marked as dependency for now. I can confirm that. But I'm pretty confident I installed it manually because it's a family of fonts.

Why should its being a family of fonts mean you installed it manually? ttf-dejavu is highly likely to have been installed as a dependency. Certainly it is installed as a dependency on my system. (Other packages could satisfy the same dependency, but ttf-dejavu is a common option.)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB