But, honestly, Arch is completely different than other distros… much better in my humble experience.
Plus, I have been on EndeavourOS/Arch for less than 1 month! +2 months on another Arch based distro, (Previously I was on OpenSuse, most of the time then some DEB based…
So, I am an absolute noob…
It’s all terribly unnecessary and just adds more potential for something to go wrong.
Just run
yay
every couple of days. That’s really all you need to do normally. When something needs fixing, then you may need some of those other commands but in normal use, you really don’t.
You can’t possibly be that low on storage space to warrant cleaning your cache on every update (and if you are, it’s best to setup a soystemd timer to do it for you). Your mirrorlists cannot possibly be that terrible that you need to rank your mirrors on every update (and if you do, it’s better to handle that with a pacman hook)… “Vacuuming” your system log is also unnecessary, unless your root partition is getting low on space.
And you can’t possibly create that many orphan packages that you need to delete them on every update. Also, removing orphans after updating is just stupid, the time to do that is before the update, because the whole point of it is to make updating faster. But… it should never be done automatically: pacman -Rns $(pacman -Qdtq) may remove more than you want and create problems.
This whole clean.sh script is just another example of making your life more complicated than it needs to be. I’m positive it will just create more problems for you than it will solve.
You can run the whole script with sudo ie. sudo clean.sh or make the script detect if it is root and call sudo if necessary then rerun itself. echo doesn’t look safe to me.
Just to learn more (and not to create another thread)
Since I started with Suse 7 in 2000, I knew Linux did not have that problem of windoze of leaving junk, orphans, and trash behind - that makes windoze more and more irresponsive as time passes (this was my understanding then)
So, what happened? Where/Why all this orphans/cache… in Arch (or Linux)?
Did I miss something or misunderstand something (as usual) way back in 2000? Or things in Linux have changed? or is it Arch specific?
Just to understand more, do cache, orphans,… etc (if not ever cleaned) affect:
EOS performance?
EOS update/upgrade time
do they really take disk space?
Is it okay to just never do any of the commands in “clean.sh”?
No, performance is not affected in any way by having many packages installed. Or having old packages in cache. The only time this can be a problem is if you completely run out of space, which you’ll probably notice before it happens and then act accordingly to prevent it.
Yes, because you are updating orphan packages as well.
Yes, they take up disk space like any other installed package.
An orphan package is just a package that was installed as a dependency for another package, and then stopped being needed (either because the dependant package was removed, or changed dependencies). Orphan packages are still fully functional packages installed on your system. They are not junk.
It’s just that they are no longer a dependency for something else, so in that sense they can be removed. But they can still be optional dependencies (which you may want to keep) or they can be useful to you on their own.
When removing orphan packages, you should understand what they do and know whether you want to remove them or not. You should manually go through the list of them and decide on each one whether to keep it or remove it.
To clean the package cache you could enable a service that does it periodically. Try paccache-service-manager for this.
To keep your system up to date, run yay periodically, e.g. once a day or once a week.
If mirrors start causing problems, re-rank the Arch mirrors (many alternatives, e.g. rate-mirrors, reflector, reflector-simple). Also re-ranking the EndeavousOS mirrors may be needed (eos-rankmirrors) in case they cause issues.
Yeah, I can see. It may be a bad idea to write automation scripts that remove an unknown number of packages while in a state of confusion. Just saying…
Like I said, an orphan package is a package that was installed as a dependency for another package but stopped being a dependency (so in the sense of that other packege needing it, it is not longer needed). But that doesn’t mean you don’t need it for something else.
Sure I understand!
But for a noob like me I do not have enough technical knowledge to decide!
So, my rule of thumb applies. That is “just don’t change anything, just go with the defaults” to be on the safe side.
You don’t need (a lot of) technical knowledge to decide whether you want a package or not.
pacman -Qi package_name
Look at the description, required by, optional for, replaces, install reason and other fields. This will tell you all you need to know to decide whether to keep the package or not.
Also, look at the package size. If you are unsure whether to keep it or remove it, and it’s a tiny package, just keep it. Do you really benefit from freeing half a megabyte of storage? I doubt it…
For bash user
Edit $HOME/.bashrc
OR
For zsh user
Edit $HOME/.zshrc
OR
(For fish user)
(Edit $HOME/.config/fish/fish.config)
#Pacman Shortcuts
alias install="sudo pacman -S"
alias update="sudo pacman -Syyu"
alias search="sudo pacman -Ss"
alias search-local="sudo pacman -Qs"
alias pkg-info="sudo pacman -Qi"
alias local-install="sudo pacman -U"
alias clear-cache="sudo pacman -Scc"
alias unlock="sudo rm /var/lib/pacman/db.lck"
alias remove="sudo pacman -R"
alias autoremove="sudo pacman -Rns"