Manjaro Обслуживание системы

Обслуживание системы

From Manjaro
Revision as of 05:47, 9 January 2023 by Krotesk (talk | contribs) (Created page with "Очень важно убедиться, что вы не окажетесь в состоянии, когда ваша система обновлена частично.<br...")
Other languages:
English • ‎français • ‎русский

Обзор

В этой статье содержатся советы и лучшие практики для поддержания системы в оптимальном состоянии.


Кэш Home

Скрытый каталог .cache в вашем домашнем каталоге используется многими частями системы. Сюда входят загрузки, эскизы, ресурсы рабочего стола и многое другое.
Хотя в целом безопасно удалять все содержимое папки <code~/.cache>, может оказаться более целесообразным просмотреть ее содержимое и удалить элементы выборочно.

Чтобы создать отсортированный список содержимого с размерами:

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


Чтобы автоматически очистить все файлы внутри .cache, к которым не было обращений в течение 100 дней:

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


Журналы и логи

Файлы журналов и журнал systemd делают одно и то же, но по-разному. Они ведут запись всего, что происходит в вашей системе.
Дополнительную информацию и советы по автоматизированному обслуживанию можно найти на странице Ограничение размера файлов .log и журнала

Журнал Systemd

В журнале хранятся записи об активности системы. Это может быть важно для поиска и устранения неисправностей, но иногда размер журнала может стать довольно большим.

Чтобы узнать текущий размер:

user $ journalctl --disk-usage COPY TO CLIPBOARD


Чтобы удалить все записи, кроме самых последних, по размеру или времени:

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


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


Чтобы установить максимальный размер журнала - Вы можете раскомментировать и отредактировать следующую строку в /etc/systemd/journald.conf:

SystemMaxUse=50M

Системные логи в /var/log/*

Хотя большинство вещей используют более новый журнал systemd (journalctl), все еще есть некоторые программы, использующие более старый каталог /var/log/.
Для получения дополнительной информации и некоторых советов по его обслуживанию, пожалуйста, смотрите соответствующий раздел этой страницы.


Пакеты и обновления

Поддержание системы в актуальном состоянии

При использовании дистрибутива rolling release очень важно поддерживать систему в полностью обновленном состоянии. Manjaro предоставляет несколько способов обновления системы.

  • Вы можете использовать GUI-инструмент Pamac напрямую или через нотификатор обновлений.
  • Вы можете использовать GUI-инструмент Octopi напрямую или через нотификатор обновлений
  • Вы можете использовать Pamac CLI
  • Вы можете использовать Pacman CLI.

Отказ от частичных обновлений

Warning
Частичные обновления не поддерживаются ни при каких обстоятельствах

Очень важно убедиться, что вы не окажетесь в состоянии, когда ваша система обновлена частично.
Нередко системы в состоянии частичного обновления оказываются в состоянии критического отказа.
Вот несколько важных правил, которые помогут Вам избежать этой опасной ситуации.

  • 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.

Удаление сирот

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.

Кэш пакетов

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 и Pacsave

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.


Время и дата

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


Смотрите также


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