Arch Linux post install setup
February 11, 2022
Archived
This post will no longer be updated as of 02-11-2022 but will remain available for historical purposes.
Overview
I typically go through the same post-install steps each time I setup a new system. Of course, there will be slight variations, but this post will capture how I normally configure things on a clean install. This is based off an install as described in my previous post.
BTRFS scrubbing
One of the main features of BTRFS is the data integrity. It is simple to setup a scheduled scrub of your BTRFS disk(s). For now, I’m only using BTRFS on my root volume, so I can enable the built-in timer with # systemctl enable [email protected]
to schedule monthly scrubbing. It also has to be started with # systemctl start [email protected]
. There is no need to do this for home as well since they are both on the same volume. I’ll provide some monitoring scripts in an upcoming post about setting up and monitoring a BTRFS RAID array.
BTRFS snapshots
Snapper, along with snap-pac, is what I use to take automatic snapshots every time Pacman is used. I find this helpful as it allows me to easily restore my system if something goes wrong during an upgrade or package install. I’m not going to cover the details of restoring the system in this post, but I will describe how to set it up. Snapper can be installed with # pacman -S snapper
, and you can create a configuration for the root volume with # snapper -c root create-config /
. The configuration file we just created is located at /etc/snapper/configs/root
. By default, Snapper is configured to create hourly snapshots and retain them based on settings in the configuration file. I’m going to edit my root configuration file and set it to only keep hourly snapshots for the past 24 hours and daily snapshots for the past 7 days. I don’t use this as a backup, but it gives me a buffer in case I mess up a file and need to go back and grab a previous version that I was working with recently. I’m also going to add my user to the ALLOW_USERS section of the configuration file. To trigger all of this to start, you’ll have to enable and start both snapper-timeline.timer and snapper-cleanup.timer. I recommend waiting to do that until you’ve relocated the snapshots subvolume in the following paragraphs.
Snapper automatically creates a snapshots subvolume nested inside your root subvolume and mounted at /.snapshots
. This can cause issues when trying to restore your root volume since the snapshots are stored on a nested subvolume. To fix this, delete the subvolume with # btrfs subvolume delete /.snapshots
and remake the snapshots folder with # mkdir /.snaphots
. The new snapshots subvolume is listed in my install post and is a sibling of the root subvolume.
We’ll now add the snapshots subvolume to /etc/fstab
. Just duplicate the line for mounting the root subvolume and change the mount point, subvolid, and subvol. Now use # mount -a
to mount it. Now your snapshots will be stored outside of the root subvolume, and you can restore the root volume if you ever need to without losing your snapshots. The Snapper page on the Arch Linux wiki has all the details for how to manually create, view, and delete snapshots. To automatically create the pre/post snapshots when running Pacman, we’ll use snap-pac. It can be installed with # pacman -S snap-pac
. By default, it will create pre/post snapshots of only the configuration named root, but you can check out the manual page $ man snap-pac
for available configuration options. If you’d like to have a graphical interface to see your snapshots, there is a snapper gui you can install from the AUR. It is snapper-gui-git. If you want to see the root snapshots, be sure to run it as # snapper-gui
or add your user to the ALLOW_USERS section of the configuration file as mentioned above.
Mount @workspace and @vms subvolume
When I initially setup my system, I created a @workspace subvolume to be used for storing anything I didn’t want included in my regular snapshots of the root and home subvolumes as well as a @vms subvolume to use for virtual machines. To mount these, we’ll need to create the ~/Workspace
and ~/VMs
directories. Next, for virtual machines, it’s a good idea to disable copy-on-write (COW). To do that we’ll need to use $ chattr +C ~/VMs
. The directory needs to be empty when running this, and it will disable COW for new files added to the directory. Lastly, update /etc/fstab
to mount the @workspace and @vms subvolumes. Use the same mounting options as the @ and @home subvolumes.
Additional software
The Gnome desktop has some basic software installed by default if you include some packages from the gnome-extra group. There are several additional pieces of software that I typically install/configure when setting up a new system. This is not an all inclusive list. Each of these items can simply be installed with Pacman. Be sure to look at the optional packages listed during install to see if you need/want to install any of them.
- chromium
- digiKam: I know this is a KDE application, but it’s one of the best feature filled photo managers available.
- discord
- Firefox
- FreeCAD
- GIMP
- gnome-themes-extra
- HandBrake: Good companion to MakeMKV
- KiCad
- LibreOffice: Install package is libreoffice-fresh
- mlocate: Be sure to enable and start updatedb.timer and add
PRUNENAMES = ".snapshots"
to/etc/updatedb.conf
- moserial: Serial terminal for Gnome
- prusa-slicer: The Prusa Mini+ is an excellent 3D printer
- rclone: Command line tool for encrypted backup to cloud storage
- Thunderbird
- Tilix: Nice tiling terminal emulator based on Gnome terminal
- Transmission-gtk: A good block list is available here
- ufw: Enable/Start ufw.service then set default to reject all incoming and add rules as needed
- VirtualBox: Just follow the wiki instructions. I use this to keep an updated Windows VM around
- VLC
For AUR packages, I use the AUR helper Yay. Be sure to enable the development setting with yay -Y --devel --save
if you want *-git packages included in the update commands. The items I typically install are GitHub Desktop (github-desktop-bin), Visual Studio Code (visual-studio-code-bin), and the Brave browser (brave-bin). The GitHub Desktop app is not officially made for Linux. It is an Electron app, so it has unofficially been compiled to work on Linux. There are several extensions that I use for VS Code, and I have listed them out in a previous post.
I currently use OneDrive to sync some documents to my Linux box. The best sync client I have found on Linux is Insync. This is a paid application, but it works very well. I have yet to find a better alternative. It can be installed from the AUR as insync. For nautilus integration, be sure to also install insync-nautilus.
Zsh shell and Oh My Zsh
I prefer using the Zsh shell over the Bash shell. Fortunately, that is easy to switch. Simply install the Zsh shell with # pacman -S zsh
. Use $ chsh -l
to list the available shells, then use chsh -s
to set a new shell. In my case, that new shell is /usr/bin/zsh
. Oh My Zsh is an excellent framework that can be used with the Zsh shell. The install script can be found on the project’s website. There are many themes and plugins that can be used to extend Oh My Zsh. A plugin that I am particularly fond of is Zsh syntax highlighting. One of my favorite themes is Powerlevel10k.
Local mail delivery and external emailing ability
On my server box, I setup Postfix for local mail delivery only. This allows me to check for messages that various server applications may send to “root”. I also setup Mutt to be able to view the local mailbox and easily send email from the terminal. This allows the scripts I create for different tasks to be able to alert me if something goes wrong. For Postfix, simply install the program with # pacman -S postfix
and follow the instructions on the Arch wiki to set an alias and configure for local mail delivery only. Don’t forget to enable/start it. The mailbox is created when the first email is sent, so run $ sendmail username
, type your message, press enter, then ctrl+d. Now your mailbox file should be created at /var/mail/username
and have a new message.
Mutt can be installed with # pacman -S mutt
. I’ve provided my ~/.muttrc
file below for reference. It is setup to allow sending email with my Gmail account. Obviously, I’ve left out my email address and password, but you can see where that information would go in the config file. Since this has your email password (even though it is an app specific password), make sure this file is readable only by your user.
# Basic setup for ~/.muttrc
set record="~/Mail/sent"
set postponed="~/Mail/postponed"
# Cancel a message when subject is blank
set abort_nosubject=yes
# set from to ensure mutt doesn't put [email protected]
set from="[email protected]"
set use_from=yes
set envelope_from=yes
# set realname
set realname="John Hinson"
# Setup smtp for sending with email provider
set my_pass="password"
set my_user="[email protected]"
set smtp_pass=$my_pass
set smtp_url=smtps://$my_user@smtp.gmail.com
set ssl_force_tls = yes
Now it’s time to test everything out. The following commands are a few different ways to test sending emails with or without an attachment.
echo "This is a test message from mutt." | mutt -s "Test from mutt" [email protected]
mutt -s "Test from mutt" [email protected] < /tmp/message.txt
mutt -s "Test from mutt" [email protected] < /tmp/message.txt -a /tmp/file.webp
Look and feel
I don’t prefer to go over-the-top with visual customization, but I do like to deviate a little from the stock setup. My current go-to theme is orchis. It can be installed in the AUR as orchis-theme-git. I usually combine that with Papirus icons. This is actually in the community repository, so it can be installed with pacman (papirus-icon-theme). All of these can be enabled using Gnome Tweaks. If you have a lot of menu tray icons, you may also be interested in Hardcode-Tray. For extensions, I currently only use Hot Edge and AppIndicator and KStatusNotifierItem Support. In Gnome Tweaks, I typically disable the Activities hot corner add title bar buttons.
Misc items
Here are a few things that I couldn’t find a specific place for in this post but are still important to my setup
- If you like to use the GUI that Gnome provides for log files but get errors about access restrictions, be sure to add your user to the systemd-journal group. This can be done with
# usermod -aG systemd-journal username
. - There are a few Pacman options I prefer to enable in
/etc/pacman.conf
. The options are UseSysLog, Color, and VerbosePkgLists. - I prefer to use nvm to manage my Node.js installations. I typically have to manually add the export line to my
~/.zshrc
file.
Conclusion
As you can tell, this is a somewhat random collection of settings. I know everyone’s system is setup differently, but maybe providing some details on my system will be helpful to someone or spark some ideas. If nothing else, it serves as an excellent reference for me.