literate-dotfiles/maintenance.org

92 lines
1.9 KiB
Org Mode

#+TITLE:System maintenance
#+SETUPFILE: ./setup/org-setup-file.org
https://wiki.archlinux.org/title/System_maintenance
* Update
** System packages
To check packages to update:
#+begin_src bash
paru -Qu
#+end_src
And then to perform the update:
#+begin_src bash
paru
#+end_src
** NPM
First update =npm= itself
#+begin_src bash
sudo npm install npm@latest -g
#+end_src
Then, we can list outdated packages:
#+begin_src bash
npm outdated -g --depth=0
#+end_src
And finally perform the update:
#+begin_src bash
sudo npm update -g
#+end_src
** PIP
First upgrade =pip= itself:
#+begin_src bash
/usr/bin/python3 -m pip install --upgrade pip
#+end_src
Then list outdated packages:
#+begin_src bash
pip3 list --outdated
#+end_src
And update everything with:
#+begin_src bash
pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
#+end_src
** Emacs and Vim
Update Doom emacs with:
#+begin_src bash
doom up
#+end_src
And Vim packages with:
#+begin_src bash
nvim -c PlugUpgrade -c PlugUpdate
#+end_src
* Check problems in the system
First check for failed services:
#+begin_src bash
systemctl --failed
#+end_src
Same for user services:
#+begin_src bash
systemctl --user --failed
#+end_src
Look for errors in the logs:
#+begin_src bash
sudo journalctl -p 3 -b
#+end_src
* Check orphan and dropped packages
Run the following to list all orphan packages:
#+begin_src bash
pacman -Qtdq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pacman -Qil {} | less)'
#+end_src
Then, either remove the unused packages or set the package to "explicitly installed" with:
#+begin_src bash
sudo pacman -D --asexplicit package_name
#+end_src
Use the =ancient-packages= ([[https://aur.archlinux.org/packages/ancient-packages/][link]]) command to list dropped packages (packages may longer in the remote repositories, but still on the local system):
#+begin_src bash
ancient-packages
#+end_src