惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Last Week in AI
Last Week in AI
Project Zero
Project Zero
L
LINUX DO - 最新话题
C
Cisco Blogs
P
Privacy International News Feed
S
Schneier on Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Security @ Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
Webroot Blog
Webroot Blog
K
Kaspersky official blog
Help Net Security
Help Net Security
博客园_首页
Security Archives - TechRepublic
Security Archives - TechRepublic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
雷峰网
雷峰网
The Last Watchdog
The Last Watchdog
WordPress大学
WordPress大学
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
A
Arctic Wolf
I
Intezer
V
V2EX
博客园 - 【当耐特】
Latest news
Latest news
T
Tenable Blog
Google Online Security Blog
Google Online Security Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
Cyberwarzone
Cyberwarzone
量子位
G
GRAHAM CLULEY
T
Troy Hunt's Blog
博客园 - Franky
Simon Willison's Weblog
Simon Willison's Weblog
博客园 - 三生石上(FineUI控件)
TaoSecurity Blog
TaoSecurity Blog
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
Jina AI
Jina AI
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Scott Helme
Scott Helme

Fernando Cejas

Rust cross-platform… The Android part… Rust cross-platform… The Android part… An over-engineered Home Lab with Docker and Kubernetes. An over-engineered Home Lab with Docker and Kubernetes. Arch Linux System Maintainance. Cooking Effective Code Reviews. Cooking Effective Code Reviews. Writing First-Class Features: BDD and Gherkin. Writing First-Class Features: BDD and Gherkin. Learn Linux… Install Arch with Full Disk Encryption. Learn Linux… Install Arch with Full Disk Encryption. Learn out of mistakes: Postmortems to the rescue! Learn out of mistakes: Postmortems to the rescue! Learn out of mistakes: Postmortems to the rescue! Technical Debt… GURU LEVEL UNLOCKED! Technical Debt… GURU LEVEL UNLOCKED! Technical Debt… GURU LEVEL UNLOCKED!
Arch Linux System Maintainance.
Fernando Cejas · 2022-03-30 · via Fernando Cejas

Arch Linux System Maintainance.

In this guide we will walk through the most important practices regarding system maintainance for Linux home computers. Most of them are Arch Linux (and variants) specific but we can get ideas on how other distros can use and apply the same principles.

“No matter what you’re going through, there’s a light at the end of the tunnel.”

Introduction

System maintainance (and software maintainance in general) is an ongoing process that requires attention and responsibility.

So in this blog post I will summarize the key actions we can take in order to keep our arch linux installation healthy, optmized and fully working.

BTW, If you are NOT using Arch yet, I have a guide explaining how to install it from scracth and also a tiny wiki with information about daily tasks, process and guides.

DISCLAIMER: There is NO better place to everything related to Arch than the Arch Linux Wiki, but in this ocassion, I would like to save us some time, and summarize and pin point the most basic/important stuff.

System update/upgrade

It is very important to have the latest version of the system up and running (including users apps and packages). I gotta say that sometimes things get broken due to the nature of the rolling release model, but since each installation is different, we are responsible for checking Arch Linux latest news in the Arch Linux website..

Once done, we can proceed to perform a system update/upgrade by running:

or if you are using any AUR helper (in my case yay):

Troubleshooting

  • In case of package as marginal trust:
error: <package>: signature from "Someone <mail.of.someone>" is marginal trust
 ...
Do you want to delete it? [Y/n] 

Then update the keyrings as following and run again the full system upgrade command:

$ sudo pacman -Sy archlinux-keyring

Clean pacman cache

The package manager is our source of truth when it comes to what we use in our system but its cache grows exponentially since it keeps ALL versions that we are installing/upgrading. This is of course usefull when it comes to system stability and rolling things back (by using pacman -U /var/cache/pacman/pkg/name-version.pkg.tar.gz) but it requires maintenance.

Let’s perform a bunch of checks before:

$ sudo ls /var/cache/pacman/pkg/ | wc -l  //cached packages
$ du -sh /var/cache/pacman/pkg/           //space used

We can use paccache for this purpose, so let’s install it first (if we do not already have it):

$ sudo pacman -Sy pacman-contrib

Now we can easily clean everything up and keep the latest 3 versions (default behavior):

Remove orphan packages

Orphans are no more than unneeded dependencies that are a result of a package which was uninstalled. They waste storage space so they required attention too.

Let’s list all the orphans in our system:

To remove all orphans let’s run:

$ sudo pacman -Qtdq | sudo pacman -Rns -

Troubleshooting

  • In case of error: argument '-' specified with empty stdin:

We do not have to worry, that means there are no orphans in our system. :)

Remove unwanted packages

Let’s list all the installed packages first in order to check whether we have software we are no longer using:

$ pacman -Qei | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h

We can also list the ones installed from the AUR:

$ pacman -Qim | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h

If we want to unistall all unneeded packages and their unused dependencies and configuration files:

$ sudo pacman -Rns $(pacman -Qdtq)

In case we want to individually uninstall packages, we use this command instead:

$ sudo pacman -Rns <package-name>

Clean /home directory cache

Our cache takes a lot of space as long as we use our system, so it is a good idea to check it out and clean it up accordingly. With the following command we can check its size:

$ sudo du -sh ~/.cache
$ 32G  /home/fernando/.cache

If we want to clear it up, we just remove its content:

System logs clean-up

System logs are always important to fix issues and to know what is going on within our Linux distro but again, they need a bit of maintenance.

Let’s first perform a system check to see how much space is being consumed by our logs:

$ journalctl --disk-usage

In order to remove logs we use the same command by limiting it by time (check the man for size limit and other alternatives):

$ sudo journalctl --vacuum-time=7d

If we want to permantely set this up by size, we can uncomment SystemMaxUse in /etc/systemd/journald.conf configuration file, to limit the disk usage used by these files by, for example: SystemMaxUse=500M in my case.

Conclusion

That is it… at the least the minimum and basic things…. Just know, that not all the mentioned steps are mandatory and should be done in one shot one after the other, but we want to make sure we care about the healthiness of our system by from time to time giving it a bit of love.

References