Error updating with pacman and yay

I have the following problem when updating with sudo pacman -Syu: error: core could not be updated (database could not be locked). I think it must be because I abruptly interrupted the update yesterday with yay -Syyu. Now that I re-enter yay -Syyu, it appears:
-> /var/lib/pacman/db.lck is present.
-> There may be another Pacman instance running. Waiting …

It should be fine to just remove the lock file.
Just make sure that you are not running anything that is using pacman,

If you want to be super careful,

  • logout off graphical desktop,
  • go to a tty screen, for e.g. CTR-ALT-F2,
  • login,
  • remove the file
  • reboot.

To remove the file
sudo rm /var/lib/pacman/db.lck

6 Likes

Thank you very much daab, I did everything you told me and everything went well, the problem was solved

1 Like

when you are working with pacman, and if you break a install off or somethiong happend, it creates a lock file.

after removing those lock file is fine mostly doesnt need boot or relogin actually :slight_smile:

just as a side note.

1 Like

I also thank you for your comment ringo, it helps me to better understand what I am learning in Linux.

When updating with sudo pacman -Syu, do you also need to update the system with yay -Syyu by having packages installed on yay, or is there another way that includes both the pacman and yay update at the same time?

pacman is a package manager, yay is a helper, it do also use pacman but is better not use the same time :slight_smile:

-Syyu does sync but mostly pacman -Syu is enough with pacman…

yay is a helper that can use the aur. for me personaly i keep it sanitair, using yay for aur stuf but you can use yay to update to.

as for pacman you can create a alias for pacman , mine calles pie :slight_smile: but thats all personal preferences.

when you do yay -Syua it updates only from aur :slight_smile:

1 Like

Basically the following two (sometimes three!) commands (in this order!) should be enough to keep system in good shape:

   sudo pacman -Syu
   # possibly reboot, see below!
   yay -Syua

Why use two update programs? Can’t yay handle all?

It is a question about design and reliability.

Pacman is designed for managing Arch packages, but not AUR software. Pacman is the most reliable package manager for Arch packages, so always use pacman for them.

Yay is great for AUR software. Even though yay can handle also Arch packages, it is recommended to use yay only for AUR.

Why the order and reboot in between?

Only Arch packages are officially supported, and the system is built on officially supported packages. So having them successfully updated first is essential in keeping the system working as expected.

That’s why updating AUR software should be delayed until

  • pacman has done all package updates successfully, and
  • system is rebooted if e.g. kernel or other critical system package was updated

Pacman does only “full updates”

Pacman updates are designed to follow the “update all or nothing” principle:

  • If all new packages cannot be updated (e.g. because of some error), then pacman updates nothing.

That means pacman does not support partial updates. So you cannot update only some of the updatable packages.

2 Likes

I run an alias called “update” that just go

yay -Syyu && paccache -r 

Even if you don’t want to let yay handle pacman updates (it just pipes the command to pacman, yay don’t actually handle the updates itself and run all pacman updates before AUR updates automatically and also only do “full” updates) running paccache every update is handy to keep your / in check sizewise.

I have never ran into any trouble but sure, I can split the alias into two, if I ever do.

I guess yay will work well even if it is allowed to do all updates.
The post above was meant to give the best practices that I know of.

1 Like

I think most of the modern AUR helpers out there work the same way. I do know pacaur and yay do it the same way, but I don’t know if the older ones do (that are no longer recommended even among people recommending AUR helpers). I mean nobody at the Arch forums would ever recommend a single one of course. Which is kind of weird, because at the same time they have no issues taking pride in the existence of the AUR.

1 Like

Yeah, a bit like a double agenda… But that’s their thing, hard to make any futher comments about that.

Anyway, we must give Arch devs huge credit for this wonderful base that we have in EndeavourOS!

2 Likes

pacman is the most stable package system I have ever encountered. People say they trust their lives to apt, but pacman works so much better even than that.

Btw:
I tend to update at a minimum weekly, often more often (it’s just a simple thing to do before shutting off the computer for the night). If I had waited a month or so, I would run separate exclusive commands like you recommend just to feel a little more in control. Might be placebo, but it feels like it’s a good idea.
I did the same on Manjaro if I ran an old ISO and then switched to testing, which usually meant half a gig of downloads, at a minimum.

Usually I update the system in the beginning of a session, because I see no reason to wait for updates (at least normally).
Actually I wouldn’t want to update as the last thing before shutting down for the day, because next time I use the machine it just might break and I might not directly remember what was updated the last time.

Fortunately there are nice little tools that allow you to see e.g. what was the last update. One of the tools is at the EndeavourOS repo, called pahis (meaning PAcman HIStory). It is a pacman history viewer.
And please, don’t ask me what that name means in my language… :wink:

3 Likes

Now I understand better about the updates with pacman and yay. I just did an update with yay -Syua and I get the following: :: Searching AUR for updates …
-> Missing AUR Packages: python-sip-pyqt5
-> Flagged Out Of Date AUR Packages: rstudio-desktop-bin
there is nothing to do
What does it mean?

1 Like

The first one means that package no longer exists in the AUR nor in the official repos.
That means either that it has been replaced with a package with a different name, or completely discontinued. If you don’t use that package for something, uninstall it (it will tell you if it is needed as a dependency for something else).

The second one means what it says: the AUR has flagged a package as out of date. It usually solves itself in a day or three when the package maintainer updates the package and is not a problem in the short run.

1 Like

How can I uninstall it? Can you give me a hint?

The command for both pacman and yay to uninstall a package is -R
so

sudo pacman -R python-sip-pyqt5

OR

yay -R python-sip-pyqt5

However in this case, since it is a discontinued package, adding the flag “n” might be a good idea since it also then removes all backup copies in your root directory of it.

sudo pacmn -Rn python-sip-pyqt5

OR

yay -Rn python-sip-pyqt5
1 Like
1 Like

It worked with sudo pacman -Rn python-sip-pyqt5. Now when updating with yay -Syua only appears:
-> Flagged Out Of Date AUR Packages: rstudio-desktop-bin
there is nothing to do
But as you say, it is not a big problem that the person responsible for the package does not solve it later. Thank you very much Beardedgeek72

2 Likes