Manjaro Difference between revisions of "System Maintenance"

Difference between revisions of "System Maintenance"

From Manjaro
imported>Fhdk
(remove link to old archive)
 
(38 intermediate revisions by 11 users not shown)
Line 1: Line 1:
== General Recommendation ==
<languages/>
__TOC__


=== Quote from Arch Wiki ===
<translate>
<blockquote>
=Overview= <!--T:1-->
==== Partial updates/upgrades are unsupported ====


Arch Linux [Manjaro] is a rolling release distribution. That means when new library versions are pushed to the repos, all developers and packagers, rebuild all packages against the libraries. For example, if two packages depend on the same library, upgrading only one package might also upgrade library (as a dependency), which might then break the other package which depends on an older version of the library.
<!--T:2-->
This article contains tips and best practices for keeping your system in optimal condition.


That is why partial upgrades are '''not supported'''. do not use <code> pacman -Sy [package] </code> or any equivalent such as <code> pacman -Sy </code> followed by <code> pacman -S [package] </code>. '''Always''' upgrade (with <code> pacman -Syu </code>) before installing a package. Be very careful when using <code> IgnorePkg </code> and <code> IgnoreGroup </code> for the same reason. If the system has locally installed packages (such as AUR packages), users will need to rebuild them when their dependices recieve a soname bump.


If a partial upgrade scenario has been created, and binaries are broken because they cannot find the libraries they are linked against, do not "fix" the problem simply by symlinking. Libraries receive soname bumps when they are not backwards compatible. A simple <code> pacman -Syu </code> to a properly synced mirror will fix the problem as long as pacman is not broken.
=Home Cache= <!--T:3-->


The bash script checkupdates, included with the pacman package, provides a safe way to check for upgrades to installed packages without running a system update at the same time.
<!--T:4-->
The hidden {{ic|.cache}} folder in your home directory is used by many parts of your system. This includes downloads, thumbnails, desktop resources, and more.<br />
While it is generally safe to remove everything in your {{ic|~/.cache}} folder, it may be more advisable to inspect its contents and selectively remove items instead.<br />


==== Act on alerts during an upgrade ====
<!--T:5-->
When upgrading the system, be sure to pay attention to the alert notices provided by pacman. If any additional actions are required by the user, be sure to take care of them right away. If a pacman alert is confusing, search the forums and the recent news posts for more detailed instructions.
To generate a sorted list of contents and sizes:
{{UserCmd|command=du -sh ~/.cache/* | sort -h}}


==== Deal promptly with new configuration files ====
<!--T:6-->
When pacman is invoked, <code> .pacnew </code> and <code> .pacsave </code> files can be created. Pacman provides notice when this happens and users must deal with these files promptly. Users are referred to the Pacman/Pacnew and Pacsave wiki page for detailed instructions.
To automatically purge all {{ic|.cache}} files that have not been accessed in 100 days:
{{UserCmd|command=find ~/.cache/ -type f -atime +100 -delete}}


Also, think about other configuration files you may have copied or created. If a package had an example configuration that you copied to your home directory, check to see if a new one has been created.
=Journal and Logs= <!--T:7-->
</blockquote>


== Manjaro Recommandation ==
<!--T:8-->
In addition to the above mentioned points, Archlinux has only one branch, '''Manjaro has three'''.
Log files & the systemd journal do the same thing in different ways. They keep a record of everything that happens on your system.<br />
For more information and tips on automated maintenance please see the dedicated page [[Limit the size of .log files %26 the journal]]


'''Always''' follow these '''Manjaro''' recommendations:
==Systemd Journal== <!--T:9-->


* '''No temporary branch changes'''. Do not mix in packages from other branches.
<!--T:10-->
* '''After changes''' to branch and mirror list do a full system update
The journal keeps logs of system activity. This can be important for troubleshooting, but sometimes the log size can grow rather large.  
    sudo pacman -Syyu
* '''Before installing''' new packages do a full system update
    sudo pacman -Syu [some-package-name]
* '''Do not downgrade''' using the pacman downgrade switch (-Suu).


== Additional information ==
<!--T:11-->
To report the current size:
{{UserCmd|command=journalctl --disk-usage}}


'''Arch Linux Wiki'''
<!--T:12-->
To remove all but the most recent entries by size or time:
{{UserCmd|command=journalctl --vacuum-size=50M}}
{{UserCmd|command=journalctl --vacuum-time=2weeks}}


* [https://wiki.archlinux.org/index.php/System_maintenance#Partial_upgrades_are_unsupported System Maintenance]
<!--T:13-->
* [https://wiki.archlinux.org/index.php/Pacman/Pacnew_and_Pacsave Pacman/Pacnew and Pacsave]
To set a maximum size for the journal you can uncomment and edit the following line in {{ic|/etc/systemd/journald.conf}}:
SystemMaxUse=50M
 
==System logs at /var/log/*== <!--T:14-->
 
<!--T:15-->
While most things use the newer systemd journal (journalctl), there is still some software that uses the older /var/log/ directory.<br />
For more information and some tips on maintaining it, please see the relevant section of [[Limit the size of .log files & the journal#Managing /var/log/* files|this page]].
 
 
=Packages and Updates= <!--T:16-->
 
==Keeping your System Updated== <!--T:17-->
 
<!--T:18-->
On a rolling release distribution it is essential to keep your system fully updated.  Manjaro provides a few ways to keep your system updated.
 
<!--T:19-->
* 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#Updating_the_System|Pamac CLI]]
* You can use the [[Pacman_Overview#Installing_Updates|Pacman CLI]]
 
==Avoiding Partial Updates== <!--T:20-->
 
<!--T:21-->
{{BoxDanger|danger|Partial updates are not supported under any circumstances}}
 
<!--T:22-->
It is of critical importance to ensure you don't end up in a state where your system is partially upgraded.<br />
It is not uncommon for systems in partially updated state to end up in a critical failure state.<br />
Here are some rules to help you avoid this undesired situation.
 
<!--T:23-->
* Don’t update the local package database (metadata) without also updating the system
* You may install a single package using {{ic|pacman -S <pkgname>}} but this may yield a 404 error if your metadata is not current
* Don't use {{ic|pacman -Sy}}, {{ic|pacman -Syy}}, {{ic|pacman -Syuw}} as this will update the metadata but not sync the packages to your system
* Always sync metadata and packages together {{ic|pacman -Syu}}
* 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 {{ic|checkupdates}}.  This provides a safe way to check for upgrades to installed packages without pulling metadata at the same time
* When [[Switching_Branches|switching branches]] or [[Pacman-mirrors|switching mirrors]] always sync your systems metadata and packages using {{ic|pamac update}} or {{ic|pacman -Syu}}
* If you get 404 in connection with a branch switch you may force sync metadata by doubling the '''y''' argument {{ic|pacman -Syyu}}
 
==Removing Orphans== <!--T:24-->
 
<!--T:25-->
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.
 
<!--T:26-->
To use pamac follow [[Pamac#Dealing_with_Orphaned_Packages|this guide]]. 
 
<!--T:27-->
To use pacman follow [[Pacman_Overview#Viewing_and_Removing_Orphans|this guide]].
 
==Package Cache== <!--T:28-->
 
<!--T:29-->
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.<br />
But the cache can grow to include dozens of each package resulting in gigabytes of space.
 
<!--T:30-->
To use pamac follow [[Pamac#Cleaning_the_Cache|this guide]]. 
 
<!--T:31-->
To use pacman follow [[Pacman_Overview#Cleaning_the_Cache|this guide]].
 
==Pacnew and Pacsave files== <!--T:32-->
 
<!--T:33-->
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 {{ic|pacdiff}} can help manage this process. For example, here is what it looks like when the {{ic|/etc/default/grub}} grub file has changed:
DIFFPROG=meld pacdiff -s
==> 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]
 
<!--T:34-->
* {{ic|V}} shows the differences between the two files
* {{ic|S}} skips to the next change and allows you to deal with it later or manually
* {{ic|R}} keeps your existing file and delete the new file
* {{ic|O}} overwrites the existing file with the new file
* {{ic|Q}} quits the process without making further changes
 
<!--T:35-->
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.
 
<!--T:36-->
For more detailed information, please see review the Arch Wiki [[#See_Also|linked below]].
 
 
=Time and Date= <!--T:37-->
[[File:Msm-time-date.png|thumb|left|350px]]
 
<!--T:38-->
Keeping the system time accurate may seem unimportant but certain network related services may malfunction if the time is out of sync.
 
<!--T:39-->
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".
 
<!--T:40-->
An alternative is to use systemd via the systemd-timesyncd service. This can be easily enabled with one of these commands:
{{UserCmd|command=timedatectl set-ntp true}}
 
<!--T:41-->
{{UserCmd|command=sudo systemctl enable --now systemd-timesyncd}}
 
<!--T:42-->
<div style="clear: both"></div>
 
=See Also= <!--T:43-->
* The Arch Wiki guide on [https://wiki.archlinux.org/index.php/System_maintenance System Maintenance]
* The Arch Wiki guide on [https://wiki.archlinux.org/index.php/Pacman/Pacnew_and_Pacsave Pacnew and Pacsave] files
* The [[Pacman_Overview|Pacman wiki article]]
* The [[Pamac|Pamac wiki article]]
</translate>
<br />
 
[[Category:Contents Page{{#translation:}}]]

Latest revision as of 13:43, 28 June 2024

Other languages:
English • ‎español • ‎français • ‎русский

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

danger
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 rules to help you avoid this undesired situation.

  • Don’t update the local package database (metadata) without also updating the system
  • You may install a single package using pacman -S <pkgname> but this may yield a 404 error if your metadata is not current
  • Don't use pacman -Sy, pacman -Syy, pacman -Syuw as this will update the metadata but not sync the packages to your system
  • Always sync metadata and packages together pacman -Syu
  • 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. This provides a safe way to check for upgrades to installed packages without pulling metadata at the same time
  • When switching branches or switching mirrors always sync your systems metadata and packages using pamac update or pacman -Syu
  • If you get 404 in connection with a branch switch you may force sync metadata by doubling the y argument pacman -Syyu

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:

DIFFPROG=meld pacdiff -s
==> 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.