Files not owned by package

Hello,

First of all my question:

I think my package manager database / state is broken. What steps should I take to check its health and maybe fix it?

Context: I run EndeavourOS in a hypervisor which is why I use qemu-guest-agent. Today I noticed the guest agent was not running. I checked to see if it’s installed (I am 100% sure I have it, but first thing to do right?) and of course the package is there. So I thought "let me remove and reinstall it, maybe some update messed it up:

[user@host ~]$ yay -Rncs qemu-guest-agent
[sudo] password for user: 
checking dependencies...

Package (1)       Old Version  Net Change

qemu-guest-agent  7.1.0-5        0.00 MiB


:: Do you want to remove these packages? [Y/n] 
:: Processing package changes...
(1/1) removing qemu-guest-agent                                          [----------------------------------------] 100%

Now, I notice the the size is 0.00MiB, which seems weird, but no errors reported and package is removed. Happy days, let me reinstall:

[user@host ~]$ yay -Sy qemu-guest-agent
:: Synchronising package databases...
 core is up to date
 extra is up to date
 community                                     7.0 MiB  13.5 MiB/s 00:01 [----------------------------------------] 100%
 multilib is up to date
 endeavouros is up to date
resolving dependencies...
looking for conflicting packages...

Package (1)             New Version  Net Change

extra/qemu-guest-agent  7.1.0-5        0.99 MiB

Total Installed Size:  0.99 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                                           [----------------------------------------] 100%
(1/1) checking package integrity                                         [----------------------------------------] 100%
(1/1) loading package files                                              [----------------------------------------] 100%
(1/1) checking for file conflicts                                        [----------------------------------------] 100%
error: failed to commit transaction (conflicting files)
qemu-guest-agent: /usr/bin/qemu-ga exists in filesystem
qemu-guest-agent: /usr/lib/systemd/system/qemu-guest-agent.service exists in filesystem
qemu-guest-agent: /usr/lib/udev/rules.d/99-qemu-guest-agent.rules exists in filesystem
qemu-guest-agent: /usr/share/man/man8/qemu-ga.8.gz exists in filesystem
Errors occurred, no packages were upgraded.
 -> error installing repo packages

So, first of all non-zero size which is good (0.99MiB). Secondly, seems like there are files present that should not be there? I check to see, maybe I installed some other package from aur instead of extras repo accidentally?

[user@host ~]$ yay -Qo /usr/bin/qemu-ga 
error: No package owns /usr/bin/qemu-ga
[user@host ~]$ yay -Qo /usr/lib/systemd/system/qemu-guest-agent.service 
error: No package owns /usr/lib/systemd/system/qemu-guest-agent.service

No owner! So, my original uninstall probably removed that weird “0.00MiB” because it thought there was nothing to remove and left things there?

At this point, I thought “let me take a back up of these, then delete them - get my reinstall done and then I can look into it on the forums”. But I notice:

[user@host ~]$ ls -al /usr/bin/qemu-ga /usr/lib/systemd/system/qemu-guest-agent.service /usr/lib/udev/rules.d/99-qemu-guest-agent.rules /usr/share/man/man8/qemu-ga.8.gz
-rwxr-xr-x 1 root root 0 Sep 11 18:49 /usr/bin/qemu-ga
-rw-r--r-- 1 root root 0 Sep 11 18:49 /usr/lib/systemd/system/qemu-guest-agent.service
-rw-r--r-- 1 root root 0 Sep 11 18:49 /usr/lib/udev/rules.d/99-qemu-guest-agent.rules
-rw-r--r-- 1 root root 0 Sep 11 18:49 /usr/share/man/man8/qemu-ga.8.gz

Yep, they’re all zero size! So that explains why the original uninstall claimed 0.00MiB would be removed, but why were they not deleted? Anyway, no point in backing anything up, I just delete and try the reinstall:

[user@host ~]$ sudo rm /usr/bin/qemu-ga /usr/lib/systemd/system/qemu-guest-agent.service /usr/lib/udev/rules.d/99-qemu-guest-agent.rules /usr/share/man/man8/qemu-ga.8.gz
[sudo] password for user: 
[user@host ~]$ yay -Sy qemu-guest-agent
:: Synchronising package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 endeavouros is up to date
resolving dependencies...
looking for conflicting packages...

Package (1)             New Version  Net Change

extra/qemu-guest-agent  7.1.0-5        0.99 MiB

Total Installed Size:  0.99 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                                     [------------------------------------] 100%
(1/1) checking package integrity                                   [------------------------------------] 100%
(1/1) loading package files                                        [------------------------------------] 100%
(1/1) checking for file conflicts                                  [------------------------------------] 100%
:: Processing package changes...
(1/1) installing qemu-guest-agent                                  [------------------------------------] 100%
:: Running post-transaction hooks...
(1/3) Reloading system manager configuration...
(2/3) Reloading device manager configuration...
(3/3) Arming ConditionNeedsUpdate...
[user@host ~]$ systemctl start qemu-guest-agent
[user@host ~]$ systemctl status qemu-guest-agent
● qemu-guest-agent.service - QEMU Guest Agent
     Loaded: loaded (/usr/lib/systemd/system/qemu-guest-agent.service; enabled; preset: disabled)
     Active: active (running) since Sun 2022-09-25 12:00:34 BST; 2s ago
   Main PID: 11361 (qemu-ga)
      Tasks: 2 (limit: 19134)
     Memory: 392.0K
        CPU: 3ms
     CGroup: /system.slice/qemu-guest-agent.service
             └─11361 /usr/bin/qemu-ga

Sep 25 12:00:34 host systemd[1]: Started QEMU Guest Agent.

So, it’s finally installed.

Now, I’m comfortable with Linux but relatively new to Arch-based stuff and a very basic user of pacman. In fact, the things I know are precisely these three:

  1. yay -Sy ...
  2. yay -Rncs ...
  3. UpdateInTerminal

I do know however that the package manager database is not to be messed with and I should be careful and best not ignore this, so… what do you think my next steps should be? Anything I can do to get pacman to check its database/state to at least confirm whether there’s more breakage?

Thanks!

was there any electric fallout with an update as example… library’s can loose its owner…?

try to use pacman -Qk or paccheck for this might be more errors?

those conflicting path can be removed easily with sudo rm xxx…

but check with two commands ?

1 Like

Thank you for these commands.

The pacman -Qk listed all packages as “X total files, 0 missing files”.

The paccheck listed all packages as “all dependencies satisfied” and “all files match database”.

So at least I feel a bit safer now.

Now, with regards to power failures and such, I don’t recall one. The only thing that happened was that recently a grub update broke my boot. Luckily I always take a snapshot from Proxmox before updating boot loader / kernel so I simply restored the snapshot and waited a couple of days before trying to update grub again. I don’t think this could have caused it as Proxmox and QEMU are quite reliable…

What is the status of your disk as a whole? That seems like some widespread corruption. You have many zero-byte files and your pacman databases are incorrect.

It is easy to fix it for just that one package. You can use --overwrite. You should see if the problem is more widespread than that though.

Err…you should almost never use that command. That is a seriously scorched earth way to remove a package.

Hi @dalto. Appart from the 4 files from qemu-guest-agent that were zero-sized, I have not found any other zero-sized files. Everything works nicely (and this is my main workstation, I use it daily). I haven’t noticed any issues with the disk.

Regarding -Rncs: I understand it’s aggressive but I do review what gets removed. Furthermore, not only do I have snapper grabbing snapshots every so often (thanks for BTRFS assistant by the way, it is awesome!), but in addition I also take snapshots of the entire disk with Proxmox (like I said this is a VM with GPU passthrough that I use for my main machine). So it is extremely rare I would not be able to recover from any system breakage (I even recovered from the recent grub broken update where the boo loader broke in less than 2 minutes using Proxmox).

P.S. Thanks for teaching --overwrite, will keep it in mind, though I hope I won’t need it of course…

So, I finished a BTRFS scrub with no errors. Everything looks ok and pacman seems happy other than this weird incident.

If anything weird pops up in the future I will update here, but for now I’m happy with the commands @ringo gave to check the database.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.