uyuni-project / uyuni

Source code for Uyuni
https://www.uyuni-project.org/
GNU General Public License v2.0
434 stars 181 forks source link

Delete package #8788

Open akupreev opened 5 months ago

akupreev commented 5 months ago

Information for package Uyuni-Server-release:

Repository : uyuni-server-stable Name : Uyuni-Server-release Version : 2024.05-230900.217.1.uyuni3 Arch : x86_64 Vendor : obs://build.opensuse.org/systemsmanagement:Uyuni Support Level : Level 3 Installed Size : 1.4 KiB Installed : Yes Status : out-of-date (version 2024.02-230900.213.1.uyuni3 installed) Source package : Uyuni-Server-release-2024.05-230900.217.1.uyuni3.src Summary : Uyuni Server

Hello colleagues, I have a task to remove several packages from the directory /var/spacewalk/packages as we do not use them, and also they trigger the antivirus scan. Can you please advise on the correct way to delete them? I tried deleting them via the Web UI (Software –> Manage –> Package Management), then ran "spacewalk-data-fsck -r -S -C -0" on the server, but they did not disappear from the /var/spacewalk/packages directory.

digdilem commented 5 months ago

(Unofficial answer from another user)

The issue is that there's entries in both database and ondisk for each file. It's quite intensive to regularly compare both when you have a several repos.

If those few files now only exists on the filesystem, and isn't used, then removing it should be safe. If they reappear because they're in a synced repo, that's a different problem and harder to solve.

--

On the wider issue of removing old files from mirrored repos, this is how we do it. There may be a better way.

This (very old) script was written to solve this problen for Spacewalk, before it was forked into Uyuni. We still use it with Uyuni to periodically sync the database and file system and stop them growing excessively. We call it once a month with this for general hygiene

./spacewalk-remove-old-packages.py -c credfile -w
./spacewalk-remove-old-packages.py -c credfile -A
spacecmd package\removeorphans
/usr/bin/spacewalk-data-fsck -r -S -C -O

https://github.com/angrox/spacewalk-api-scripts/blob/master/spacewalk-remove-old-packages/spacewalk-remove-old-packages.py

akupreev commented 4 months ago

@digdilem Hello, my friend. Thank you very much for the information, but I rather need to make some kind of exception for the packets so that they are not synchronized from the channel.