Autoclean in xbps

Need help customizing or patching a package? Maybe seeking advice on contributing to the void-packages official Github repo.
Post Reply
User avatar
staryvyr
Posts: 16
https://dekodeco.com.pl/producent-mebli-na-wymiar-w-warszawie-nowoczesne-kuchnie/
Joined: Mon Feb 12, 2024 7:39 am

Autoclean in xbps

Post by staryvyr »

Hi,

I am running Linux Void since a couple of months on serveral machines and my /var/cache/xbps folders are becoming more and more crowed.

Is there an option for XBPS to do an autoclean, that can be employed to do something similar like the autoclean option of APT? (i,.e. to remove the xbps from the cache folder for that a newer version is already installed and to keep the xbps files containing the currently installed version?

Bests,
staryvyr
User avatar
incident
Posts: 31
Joined: Tue Oct 24, 2023 7:29 am
Location: Germany

Re: Autoclean in xbps

Post by incident »

staryvyr wrote: Mon Feb 12, 2024 7:58 am Is there an option for XBPS to do an autoclean, that can be employed to do something similar like the autoclean option of APT?
// Cleaning package cache
# xbps-remove -yO

// Removing orphaned packages
# xbps-remove -yo

// Purging old kernels...
# vkpurge rm all
Found at this source.

Best regards.
User avatar
staryvyr
Posts: 16
Joined: Mon Feb 12, 2024 7:39 am

Re: Autoclean in xbps

Post by staryvyr »

incident wrote: Mon Feb 12, 2024 8:26 am
// Cleaning package cache
# xbps-remove -yO

// Removing orphaned packages
# xbps-remove -yo

// Purging old kernels...
# vkpurge rm all

Found at this source.

Best regards.
Thanks a lot!

But if I not want to clean the whole cache, is there any option to clean only these xbps-files that are assigned to older versions of an installed package -- i.e. I want to keep the xbps-files of of the current versions???
User avatar
colin
Posts: 110
Joined: Sun Jan 21, 2024 4:05 am
Location: Germany

Re: Autoclean in xbps

Post by colin »

hey staryvyr ,

you might take a look at the manual https://man.voidlinux.org/xbps-remove.1

the option -O removes obsolete packages ;)
User avatar
staryvyr
Posts: 16
Joined: Mon Feb 12, 2024 7:39 am

Re: Autoclean in xbps

Post by staryvyr »

Oh, I read at first something else in the man page, my fault. Thank you both again!
User avatar
incident
Posts: 31
Joined: Tue Oct 24, 2023 7:29 am
Location: Germany

Re: Autoclean in xbps

Post by incident »

staryvyr wrote: Mon Feb 12, 2024 9:07 am But if I not want to clean the whole cache, is there any option to clean only these xbps-files that are assigned to older versions of an installed package -- i.e. I want to keep the xbps-files of of the current versions???
xbps-remove -O removes packages from cache which have a newer version available in remote repositories. It doesn't remove uninstalled up to date packages because that's how cache is supposed to work.
and
xbps-remove -o uninstalls orphaned packages, it has nothing to do with the cache
That's what I found there.

Is that what you're looking for?
User avatar
incident
Posts: 31
Joined: Tue Oct 24, 2023 7:29 am
Location: Germany

Re: Autoclean in xbps

Post by incident »

Oh, @colin was faster! :D
User avatar
colin
Posts: 110
Joined: Sun Jan 21, 2024 4:05 am
Location: Germany

Re: Autoclean in xbps

Post by colin »

staryvyr wrote: Mon Feb 12, 2024 9:23 am Oh, I read at first something else in the man page, my fault. Thank you both again!

you may join the german section ... :D
User avatar
incident
Posts: 31
Joined: Tue Oct 24, 2023 7:29 am
Location: Germany

Re: Autoclean in xbps

Post by incident »

staryvyr wrote: Mon Feb 12, 2024 9:23 am Oh, I read at first something else in the man page, my fault. Thank you both again!
Me too :D ... so I started a web search :D ....
User avatar
staryvyr
Posts: 16
Joined: Mon Feb 12, 2024 7:39 am

Re: Autoclean in xbps

Post by staryvyr »

colin wrote: Mon Feb 12, 2024 9:27 am you may join the german section ... :D
I just was to stupid to read correcty :oops: which happens if I do it just "along the way" -- also in German.
So thank you, @incident and @colin!
pid1
Site Admin
Posts: 277
Joined: Sun Nov 21, 2021 2:50 am
Location: USA

Re: Autoclean in xbps

Post by pid1 »

xbps-remove -O, as recommended above, would be the ideal way to clean the XBPS cache of old, no-longer installed, or outdated package files. Use caution as you may encounter a situation where you wish to install a previous version of a package after an undocumented change - especially when it comes to network or GUI related packages.

Additionally, you can consider using a tmpfs filesytem for /var/cache/xbps so all of the package files are stored solely in a volatile tmpfs - cleared on each reboot. I use this method on my desktops and servers, however let my laptop store the files normally for events where I need to revert to a package and WiFi internet is not available or a problem.

/etc/fstab file:

Code: Select all

tmpfs    /var/cache/xbps    tmpfs    mode=0755    0 0
Commands:

Code: Select all

rm -rf /var/cache/xbps
mkdir /var/cache/xbps
chmod 000 /var/cache/xbps
mount /var/cache/xbps
Now all package files will be downloaded to virtual memory (RAM/swap) and will be cleared upon reboot. This is not recommended on low memory systems.
Linux/BSD since 2001. Void Linux+KDE/Plasma since 2015. Windows? Not even in a virtual machine :D
User avatar
staryvyr
Posts: 16
Joined: Mon Feb 12, 2024 7:39 am

Re: Autoclean in xbps

Post by staryvyr »

Thanks @pid1 also for these suggestions that I am going to consider.
User avatar
Pullockaran
Posts: 9
Joined: Tue May 21, 2024 11:22 am
Location: Kochi, Bhaarath (India)

Re: Autoclean in xbps

Post by Pullockaran »

Namaskaram pid1, thank you very much for the script and the commands. Works perfectly for me. Wish I had chanced upon this earlier. Keeps Void really trim and fit, without an iota of bloat. After installing all the programmes I use, the space used by Void is 3.7GiB or (4,002,107,324 bytes) as measured by Thunar. Namaskaram.
Post Reply