Manjaro Difference between revisions of "System Maintenance"

Difference between revisions of "System Maintenance"

From Manjaro
m (Link changed to archived forum URL)
Tags: Mobile web edit Mobile edit
Line 123: Line 123:
* The [[Pacman_Overview|Pacman wiki article]]
* The [[Pacman_Overview|Pacman wiki article]]
* The [[Pamac|Pamac wiki article]]
* The [[Pamac|Pamac wiki article]]
* A forum post on [https://forum.manjaro.org/t/pacsave-pacnew-how-to-manage-those-reasonably/50968/5 managing pacsave and pacnew files]
* A forum post on the archived forums on [https://archived.forum.manjaro.org/t/pacsave-pacnew-how-to-manage-those-reasonably/50968 managing pacsave and pacnew files]


<br />
<br />


[[Category:Contents Page]]
[[Category:Contents Page]]

Revision as of 09:49, 25 May 2021


Overview

This article contains tips and best practices for keeping your system in optimal condition.


Home Cache

The hidden .cache folder in your home directory is used by many parts of your system. This includes downloads, thumbnails, desktop resources, and more.
While it is generally safe to remove everything in your ~/.cache folder, it may be more advisable to inspect its contents and selectively remove items instead.

To generate a sorted list of contents and sizes:

user $ du -sh ~/.cache/* COPY TO CLIPBOARD


To automatically purge all .cache files that have not been accessed in 100 days:

user $ find ~/.cache/ -type f -atime +100 -delete COPY TO CLIPBOARD


Journal and Logs

Log files & the systemd journal do the same thing in different ways. They keep a record of everything that happens on your system.
For more information and tips on automated maintenance please see the dedicated page Limit the size of .log files & the journal

Systemd Journal

The journal keeps logs of system activity. This can be important for troubleshooting, but sometimes the log size can grow rather large.

To report the current size:

user $ journalctl --disk-usage COPY TO CLIPBOARD


To remove all but the most recent entries by size or time:

user $ journalctl --vacuum-size=50M COPY TO CLIPBOARD


user $ journalctl --vacuum-time=2weeks COPY TO CLIPBOARD


To set a maximum size for the journal you can uncomment and edit the following line in /etc/systemd/journald.conf:

SystemMaxUse=50M

System logs at /var/log/*

While most things use the newer systemd journal (journalctl), there is still some software that uses the older /var/log/ directory.
For more information and some tips on maintaining it, please see the relevant section of this page.


Packages and Updates

Keeping your System Updated

On a rolling release distribution it is essential to keep your system fully updated. Manjaro provides a few ways to keep your system updated.

  • You can use the GUI tool Pamac directly or via the update notifier
  • You can use the GUI tool Octopi directly or via the update notifier
  • You can use the Pamac CLI
  • You can use the Pacman CLI

Avoiding Partial Updates

Warning
Partial updates are not supported under any circumstances

It is of critical importance to ensure you don't end up in a state where your system is partially upgraded.
It is not uncommon for systems in partially updated state to end up in a critical failure state.
Here are some important rules to help you avoid this dangerous situation.

  • Always ensure your system is fully up-to-date before installing software.
  • Don't downgrade packages, this will always result in a partial update scenario.
  • Avoid using pacman -Sy or pacman -Syy. Instead update your database and packages at the same time with pacman -Syu or in case of change in mirrorlist pacman -Syyu
  • Don't add packages to pacman's or pamac's ignore list.
  • If you just want to check to see what updates are available use the command checkupdates. It provides a safe way to check for upgrades to installed packages without running a system update at the same time.
  • When switching branches or switching mirrors always use pamac update --force-refresh or pacman -Syyu to ensure that the databases for your new mirrors are being used.

Removing Orphans

As packages are added, built and removed it is not uncommon to have unneeded dependencies, also called orphans, building up over time. While orphans are not harmful, they take up space on the disk and consume network bandwidth as they are continually updated. Luckily, there are a couple of easy ways to view and remove orphans.

To use pamac follow this guide.

To use pacman follow this guide.

Package Cache

By default both pamac and pacman keep a cache of downloaded packages on the system. This can be helpful if you need to copy or downgrade a package.
But the cache can grow to include dozens of each package resulting in gigabytes of space.

To use pamac follow this guide.

To use pacman follow this guide.

Pacnew and Pacsave files

A .pacnew file may be created during a package upgrade to avoid overwriting a file which already exists. A .pacsave file may be created during a package removal, or by a package installation of a package that was removed. These files require manual intervention from the user and it is good practice to handle them regularly. The program pacdiff can help manage this process. For example, here is what it looks like when the /etc/default/grub grub file has changed:

sudo DIFFPROG=diff pacdiff|result=
==> pacnew file found for /etc/default/grub
:: (V)iew, (S)kip, (R)emove pacnew, (O)verwrite with pacnew, (Q)uit: [v/s/r/o/q]
  • V shows the differences between the two files
  • S skips to the next change and allows you to deal with it later or manually
  • R keeps your existing file and delete the new file
  • O overwrites the existing file with the new file
  • Q quits the process without making further changes

Unfortunately, there is no perfect road map for how to deal with these files. If you keep the original config file, and the syntax has changed, the program may stop working or fail to use the existing config. If you remove the original file and use the new file without any changes, all your configuration settings can be overwritten. Sometimes, you need to combine pieces from the new and old files to make everything to work. In these situations it is better to integrate the files manually.

For more detailed information, please see review the Arch Wiki linked below.


Time and Date

Msm-time-date.png

Keeping the system time accurate may seem unimportant but certain network related services may malfunction if the time is out of sync.

The easiest way to ensure the time is being properly synchronized is the GUI tool included in Manjaro Settings Manager which is pictured to the left. Simply check the box next to "Set time and date automatically".

An alternative is to use systemd via the systemd-timesyncd service. This can be easily enabled with one of these commands:

user $ timedatectl set-ntp true COPY TO CLIPBOARD


user $ sudo systemctl enable --now systemd-timesyncd COPY TO CLIPBOARD


See Also


Cookies help us deliver our services. By using our services, you agree to our use of cookies.