Arch Linux: My Basic Maintenance

Thought I would share this video, pretty good video imho. Does anyone have any other commands they would add to Ermanno’s basic maintenance?

Arch Linux: My Basic Maintenance

Arch Wiki Maintenance

1 Like

There is no need to yay -Syu, when only yay does the same thing. It seems that nobody read the yay manual. Or people just like typing -Syu…

7 Likes

What he said.

Also, at the end of the video, he mentions updating the mirrors using reflector… There is typically no need to do that on Arch, unless you notice your package download speed suddenly gets low.

But when you do it, just in case, run sudo pacman -Syyu (with two y) immediately afterwards, so that the local package database is properly synced with new mirrors.

2 Likes

1 Bleachbit can screw your system up - use with care.
2 Deleting the cache can cause some programs to lose functionality, rofi uses it to build a recent history, browsers can store login cookies.

I lost the will to live after that :rofl:

I have a script that I just converted to use aura, that does my maintenance:

#!/bin/zsh

s_colour="blue"

CURR=`date +%Y%m%d`
PREV=$(<~/.updates/runonce)

#╔══════════════════╗
#β•‘ Updating Mirrors β•‘
#β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
boxp "Updating Mirrors" 1 $s_colour

#╔════════════════════════════════════╗
#β•‘ Finding fastest Arch mirror....... β•‘
#β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
boxp "Finding fastest Arch mirror......." 1 $s_colour 

if [[ "$CURR" > "$PREV" ]]; then
   	sudo reflector --verbose --latest 40 --sort rate --save /etc/pacman.d/mirrorlist &> /dev/null
	echo "Ranking repos completed."
else
	boxp "Mirrors have already been updated today!" 0 green
fi


file="$HOME/.up.txt"
date=~/.updates/$(date +%Y-%m-%dT%H:%M)
sudo aura  -Syy
checkupdates > ~/.up.txt
minimumsize=1
actualsize=$(wc -c <"$file")

#╔═════════════╗
#β•‘ Repos & AUR β•‘
#β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•
boxp "Repos & AUR" 1 $s_colour

sudo aura -Syu --noconfirm
sudo aura -Auax --noconfirm

if [ $actualsize -ge $minimumsize ]; then
    cp $file $date
    sudo gopreload-batch-refresh.sh
else
    echo size is under $minimumsize bytes
fi

#╔════════════════╗
#β•‘ Clearing Cache β•‘
#β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
boxp "Clearing Cache" 1 $s_colour
#sudo aura -Cc 3 --noconfirm
sudo aura -Cc 3 -u --noconfirm
#zsudo paccache -ruk0

#╔═══════════════════════════════╗
#β•‘ Clear saved states - leave 5. β•‘
#β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
boxp "Clear saved states - leave 5." 1 $s_colour
sudo aura -Bc 5 --noconfirm

#╔═════════╗
#β•‘ Orphans β•‘
#β•šβ•β•β•β•β•β•β•β•β•β•
boxp "Orphans" 1 $s_colour 
sudo aura -Oj --noconfirm

#╔══════════╗
#β•‘ Dotfiles β•‘
#β•šβ•β•β•β•β•β•β•β•β•β•β•
boxp "Dotfiles" 1 $s_colour 
FILE=/usr/bin/yadm
if [[ "$CURR" > "$PREV" ]]; then
	if test -f "$FILE"; then
   		~/scripts/yadm-add.sh
   		yadm commit -am "`date`" && yadm push -u origin master
	fi
else
	boxp "Dotfiles have already been backed up today." 0 cyan
fi

#╔═════════╗
#β•‘ Summary β•‘
#β•šβ•β•β•β•β•β•β•β•β•β•
if test -f "$date"; then
	boxp "Summary" 1 red
	bat $date --pager=never
fi

#╔══════════╗
#β•‘ updatedb β•‘
#β•šβ•β•β•β•β•β•β•β•β•β•β•
boxp "Running updatedb (fork)" 1 $s_colour
sudo updatedb&

#╔══════════╗
#β•‘ Finished β•‘
#β•šβ•β•β•β•β•β•β•β•β•β•β•
date +%Y%m%d > ~/.updates/runonce
boxp "Finished" 1 $s_colour
3 Likes

Here is an Arch clean-up on isle 5 bookmark I keep handy;

How to clean Arch Linux

But honestly, I use Stacer which also supports Arch. I mostly only use the β€˜system cleaner’ function and I have never had an issue in all the years I have used it. Flush away gigs worth of uneeded cache :poop:.

5 Likes

Nice, thanks for the links.

1 Like

Thanks for reminding me I noticed with the kernel updates at least that EOS downloads the kernel components far faster than Manjaro or Garuda.

Arch, EndeavourOS and Garuda all use the same mirrors, so if you configure them the same way, you should have the same speeds (at least when it comes to packages from the Arch repos). Manjaro uses its own mirrors, and they seem to be much less reliable and much slower. Also, Manjaro has this super annoying Pamac timer that messes up your mirror configuration once a week. If you’re using Manjaro, my advice is to disable that.

5 Likes

Hmmm - amazing how easily β€˜hand holding’ can become more like handcuffs! :grin:

6 Likes

Looks interesting - but missing a piece? where’s boxp() ? Or is that a zsh thing… (or do I need to create it - I have several like items in my old code toolbox (β€˜C’, Basic, Modula-2 :grin:)

Sorry, it is a quick python script:

#!/usr/bin/env python

import sys

def boxprint(Mess, nStyle, Color):

    """
    Mess - Text string to print
    nStyle - Box style (int)
    Color - uppercase string e.g. "RED"
    """
    Colours = {'PURPLE': '\033[1;32;35m', 'CYAN': '\033[1;32;36m', 'DARKCYAN': '\033[0;32;36m',
               'BLUE': '\033[1;34;40m', 'GREEN': '\033[1;32;40m', 'YELLOW': '\033[1;32;33m',
               'RED': '\033[1;32;31m', 'BOLD': '\033[1;37;40m', 'UNDERLINE': '\033[2;37;40m',
               'END': '\033[0;37;48m'}

    print(Colours.get(Color), end='', flush=True)
    sp = " "

    #Catch errors:
    if nStyle <= 0:
        nStyle = 0

    if nStyle > 6:
        nStyle = 6

    #Set box style:
    if nStyle == 0:
        bx = ["", "", "", "", "", ""]

    if nStyle == 1:
        bx = ["β•”", "═", "β•—", "β•‘", "β•š", "╝"]

    if nStyle == 2:
        bx = ["*", "*", "*", "*", "*", "*"]

    if nStyle == 3:
        bx = ["β”Œ", "─", "┐", "β”‚", "β””", "β”˜"]

    if nStyle == 4:
        bx = ["β•“", "─", "β•–", "β•‘", "β•™", "β•œ"]

    if nStyle == 5:
        bx = ["β•’", "═", "β••", "β”‚", "β•˜", "β•›"]

    if nStyle == 6:
        bx = ["#", "#", "#", "#", "#", "#"]

    Mess= sp + Mess + sp
    if nStyle > 0:
        print(Colours.get(Color) + bx[0] + bx[1] * len(Mess) + bx[2] + Colours.get('END'))

    print(Colours.get(Color) + bx[3] + Mess + bx[3] +Colours.get('END'))

    if nStyle > 0:
        print(Colours.get(Color) + bx[4]+ bx[1] * len(Mess) + bx[5] + Colours.get('END'))

    print(Colours.get('END'), end='', flush=True)

try:
    clp1 = sys.argv[1].upper()
except:
    clp1 = " "

if clp1 == " ":
    print("usage: boxp \"string\" Style Colour")
    print('e.g. boxp \"This is a message\" 1 blue')
    sys.exit()

mess = sys.argv[1]
style = int(sys.argv[2])
colour = sys.argv[3].upper()

boxprint(mess, style, colour)

I couldn’t find anything that drew simple boxes, weird ones yes :rofl:


                    .-"""-.
                   / .===. \
                   \/ 6 6 \/
                   ( \___/ )
      _________ooo__\_____/______________
     /                                   \
    |   joan stark   spunk1111@juno.com   |
    |     VISIT MY ASCII ART GALLERY:     |
    | http://www.geocities.com/SoHo/7373/ |
     \_______________________ooo_________/  jgs
                    |  |  |
                    |_ | _|
                    |  |  |
                    |__|__|
                    /-'Y'-\
                   (__/ \__)

See what I mean!!!

Then their is the simple arch way it called a terminal, Yay -Sc to clean cache
yay -Scc the delete the total cache these command also allow you to clear the yay cache as well if you want.

3 Likes

My system maintenance:

  • update multiple times throughout the day with no regard for arch announcements
  • ignore pacnew files till something goes wrong
  • likewise basically never reboot after updates unless i notice quirky behaviors
  • don’t touch my pacman cache directory for years at a time and wonder where all my disk space has gone
  • run yay and keep hitting enter until a package installs with no regard for the promps

:smirk:

2 Likes