www.alxm.org

Linux Mint Notes

These are my reference notes for configuring my Linux Mint computer.

Contents

Use RAM for /tmp#

Add this line to /etc/fstab to use a RAM-backed file system instead of local storage for /tmp:

1
2
# <device> <mount point> <type> <options> <dump> <pass>
tmpfs /tmp tmpfs defaults,nodev,noexec,nosuid,mode=1777,size=4096M 0 0

This is what the options do:

Check if /tmp is RAM-backed after reboot:

1
2
$ mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,relatime,size=4194304k,inode64)

Issues Installing GOG Linux Games due to noexec#

Mounting /tmp with noexec is a security best practice, but some software might expect being able to execute files in /tmp. I hit this problem when installing some Linux games from GOG, which all failed with an error like this:

1
2
$ ./game-installer.sh
./game-installer.sh: 1: eval: ./startmojo.sh: Permission denied

A workaround is to run the MojoSetup installer with the --keep flag, which makes it write and execute temporary files in the current directory instead of in /tmp: ./game-installer.sh --keep.


Disable Swap#

My computer doesn't have a lot of RAM, but I don't run anything too intense either. Since I don't need swap, I would rather that drive space be put to better use by the SSD's wear leveling system.

The Linux Mint 18 installer lets you choose not to use a swap partition, but Linux Mint 19 always uses a swap file located at /swapfile. Note how this is a special file instead of a separate partition. Here are the steps I used to turn it off:

1
$ sudo swapoff -a
1
2
/swapfile none swap sw 0 0
/dev/mapper/cryptswap1 none swap sw 0 0
1
cryptswap1 /swapfile /dev/urandom swap, ...
1
2
$ sudo rm /swapfile
$ reboot

At first I only ran swapoff without editing the table files in /etc. This caused some issues that added 30 seconds to the kernel boot time according to systemd-analyze! The boot time is back to normal after editing the table files.


Configure Redshift Manually#

Redshift is great for eye comfort in the evening (I use it all day). Sadly, the internet location server it uses to determine dawn and dusk times has been retired in 2024, which makes Redshift crash at launch on Linux Mint 20 and 21.

Luckily, you can set the dawn and dusk times manually in $HOME/.config/redshift.conf, and then redshift and redshift-gtk will work again:

1
2
3
4
5
6
[redshift]
temp-day=6500
temp-night=3600
dawn-time=06:00-06:30
dusk-time=18:00-18:30
fade=1

Fix Oversized Icons in the Cinnamon Panel#

When I upgraded to Cinnamon 4.4.8, some of the panel icons like WiFi and Sound were larger than the rest. Here is a way to fix them:

Before:

After:


Battery Care with TLP#

I use TLP to set battery charge thresholds to help keep my laptop battery in good shape for longer. After some online research, it looks like starting to charge when below 75% and stopping at 80% is the sweet spot for battery health.

1
$ sudo apt install tlp tlp-rdw tp-smapi-dkms
1
$ sudo tlp setcharge 75 80
1
2
START_CHARGE_THRESH_BAT0=75
STOP_CHARGE_THRESH_BAT0=80

Use tlp-stat to confirm the configured thresholds:

1
2
3
4
5
$ sudo tlp-stat -b
...
/sys/class/power_supply/BAT0/charge_control_start_threshold =     75 [%]
/sys/class/power_supply/BAT0/charge_control_end_threshold   =     80 [%]
...

Show the Time and Checked-out Git Branch on the Shell Prompt#

I customized my Bash prompt to show the current time at the start of every line, and if inside a Git repo also the name of the current branch. This goes at the end of ~/.bashrc (to override any previously set PS1, the env var for the prompt's format string),

1
2
3
4
5
6
git_branch() {
    branch_name=$(git symbolic-ref --short HEAD 2>/dev/null)
    [ $? -eq 0 ] && echo "[$branch_name]"
}

export PS1='\t \u@\h \w$(git_branch) \$ '

The shell prompt should look something like this now:

1
2
3
4
18:44:05 alex@laptop ~ $
18:44:06 alex@laptop ~ $ mkdir MyProject && cd MyProject
18:44:14 alex@laptop ~/MyProject $ git init
18:44:20 alex@laptop ~/MyProject[master] $

Convenient Single-Letter Git Command Aliases#

I also keep a few short shell aliases for the Git commands I use the most day to day. All of them are for read-only actions though... Muscle memory for repetitive things is nice, until that one time at 1am...

1
2
3
4
5
6
alias b="git branch -a -vv"
alias d="git diff"
alias ds="git diff --staged"
alias h="git show"
alias l="git log --graph --decorate=full --pretty=medium"
alias s="git status"