Arch Flossing


I’ve been using Arch for just over a year now on 2 computers. It is simple, performant, and, with a smidgeon of care, stable. Further, it rewards some learning and attentiont to detail, both of which I enjoy.

My first installation was a bit careless; I installed more than what I needed (e.g. the full xfce4 group). And, having been a year and switched between some packages for certain tasks (e.g. from ruby to python for blogging), some additional excess has accumulated between the cracks.

The time has come to floss!

The items that I will address are:

  • orphaned dependencies
  • explicitly installed packages which are no longer used
  • package files
    • ruby gems that I don’t use any more
    • orphaned configuration files
    • any other files from packages
  • misc garbage in my /home directory
  • and things that can be automated with systemd timers
    • list installed packages
    • pacman cache cleanup
    • mirrorlist update

As ever, the best resource for this is the archwiki. I’m not even sure why I’m putting my notes here! Maybe in time it will amount to something nearly original.

Remove Orphaned Packages

This one is straight forward. pacman -Qdt gives a list of packages that were installed as depencies but are no longer (cause of removal or changes to their parents) required by any other package.

It doesn’t show orphaned optional dependencies, so it may leave some extra packages kicking around. We can check the difference to pacman -Qdttq, which includes orphaned optional dependencies.

pacman -Qdt > qdt
pacman -Qdtt > qdtt
diff -y qdt qdtt
rm qdt*

                                  > alsa-plugins 1.0.29-2
cloog 0.18.1-3                          cloog 0.18.1-3
                                  > dialog 1:1.2_20150225-1
                                  > gtk-engines 2.21.0-2
                                  > gvfs 1.22.3-2
haskell-cprng-aes 0.6.1-6                   haskell-cprng-aes 0.6.1-6
icon-naming-utils 0.8.90-3                  icon-naming-utils 0.8.90-3
js 24.2.0-1                         js 24.2.0-1
                                  > libcanberra-pulse 0.30-5
net-tools 1.60.20130531git-1                    net-tools 1.60.20130531git-1
                                  > networkmanager 1.0.0-2
                                  > ppp 2.4.7-1
                                  > udisks 1.0.5-1
usbmuxd 1.1.0-2                         usbmuxd 1.1.0-2
x264 2:144.20150223-1                       x264 2:144.20150223-1

This time, I will just remove the orphaned strict dependencies. Can’t be bothered to digging into whether the others are still needed as optional depends of other packages.

# The extra q removes version numbers
sudo pacman -Rns $(pacman -Qdtq)

Remove Redundant Packages

I’ve looked at some relevant commands before.

Packages installed from sync dbs are given by.

pacman -Qen

All that stood out to me was texmaker, for which I now use emacs.

Packages not in sync dbs (most likely from AUR) are given by.

pacman -Qem

Turns out I had at some point installed pkg-scripts from the AUR, which are contributions of xyne to improving package management tasks like these. They are here and are well recommended for simplifying some of these tasks, provided you understand how they work!

For example, I also had gimp on my machine but never used it. Pacman -Rns gimp would remove it and all its dependencies, but they may be dependencies of other packages.

sudo pacman -Rn gimp
# checking dependencies...
# :: avahi optionally requires pygtk: avahi-bookmarks, avahi-discover
# :: imagemagick optionally requires openexr: for OpenEXR support

# gegl

sudo pacman -Rns gegl

Check Modified System Config Files

I manage my dotfiles with git and stow, so they are backed up and VC’d.

My system configs in /etc on the other hand are only backed up locally, and I’m not sure which ones I have modified or left as default.

pacman -Qii | awk '/^MODIFIED/'
# pacman -Qii | awk '/^MODIFIED/ {print $2}'

MODIFIED    /etc/fstab
MODIFIED    /etc/group
MODIFIED    /etc/hosts
MODIFIED    /etc/passwd
MODIFIED    /etc/resolv.conf
MODIFIED    /etc/shells
MODIFIED    /etc/locale.gen
MODIFIED    /boot/grub/grub.cfg
MODIFIED    /etc/default/grub
MODIFIED    /etc/minidlna.conf
MODIFIED    /etc/ssh/sshd_config
MODIFIED    /etc/pacman.conf
MODIFIED    /etc/pacman.d/mirrorlist
MODIFIED    /etc/pam.d/system-login
MODIFIED    /etc/ssmtp/ssmtp.conf

I don’t know how I’ll store these yet, but its a useful command for the repotoire.

Orphaned Package Files

There wasn’t a hideous number. I just cleaned up the gems dir in my home folder.

Home Dir

Finally I’ll just check the /home dir for junk.

sudo du -Phx /home --max-depth=2 | sort -h
12G /home/jotham
12G /home/
9.5G    /home/jotham/projects
6.5G    /home/jotham/projects/2014-12-20_datascibowl
2.7G    /home/jotham/projects/2014-08-23_ProyectoFuego
628M    /home/jotham/.theano
602M    /home/jotham/.theano/compiledir_Linux-3.18.6-1-ARCH-x86_64-with-glibc2.2.5--2.7.9-64
506M    /home/jotham/venvs
504M    /home/jotham/.gem
495M    /home/jotham/.gem/ruby
281M    /home/jotham/venvs/2014-12-20_datascibowl
228M    /home/jotham/.cache
213M    /home/jotham/builds
170M    /home/jotham/r
164M    /home/jotham/r/library
162M    /home/jotham/.cache/pip

I can get rid of the ruby gems (which were for my previous blog) and the data in those two projects to free up some space.

Package Maintenenace Automation

I’m leaving this for the next post.

Go Top
comments powered by Disqus