www.alxm.org

Linux Mint Notes

This is a collection of notes I keep for myself about setting up Linux Mint on my computer.

Contents

System#

Laptop Battery Care with TLP#

I use TLP to set battery charge thresholds to keep my laptop battery in good shape for longer. After some research, it looks like charging if 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
6
7
8
9
$ sudo tlp-stat -b
...
Parameter value ranges:
* START_CHARGE_THRESH_BAT0/1:  0(off)..96(default)..99
* STOP_CHARGE_THRESH_BAT0/1:   1..100(default)
...
/sys/class/power_supply/BAT0/charge_control_start_threshold = 75 [%]
/sys/class/power_supply/BAT0/charge_control_end_threshold   = 80 [%]
...

Use RAM for /tmp#

Add this 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,size=4194304k,inode64)

I had trouble installing Linux games from GOG because of the noexec option. Setup failed with errors like eval: ./startmojo.sh: Permission denied. The solution is to run the installer with the --keep flag, which makes MojoSetup write and execute its temporary files in the current directory instead of /tmp.

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 space, I would rather it 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 and later always use 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 ran swapoff without editing the table files in /etc, and that caused errors that added 30 seconds to the kernel boot time according to systemd-analyze! The boot time returned to normal after I updated those files.

Show the GRUB Menu at Boot#

Open the /etc/default/grub file and edit these lines:

1
2
3
4
- GRUB_TIMEOUT_STYLE=hidden
- GRUB_TIMEOUT=0
+ #GRUB_TIMEOUT_STYLE=hidden
+ GRUB_TIMEOUT=5

Afterwards, run sudo update-grub to update the configuration with the new settings.


Desktop#

Custom ~/Desktop Folder#

I don't use Desktop icons and don't want the empty ~/Desktop directory to show up under $HOME. You can't permanently delete this folder, but you can hide it by editing its path in ~/.config/user-dirs.dirs:

1
2
- XDG_DESKTOP_DIR="$HOME/Desktop"
+ XDG_DESKTOP_DIR="$HOME/.Desktop"

Now you can delete ~/Desktop and it won't be restored anymore.

Add this line to ~/.bashrc to make the trailing / part of the TAB-complete name for symbolic link directories, to match the behavior for regular directories:

1
bind 'set mark-symlinked-directories on'

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 Cinnamon Panels#

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:


Development#

Enabling i386 Architecture Support#

The old Linux toolchains I use to cross-compile my GP2X games and Pandora games are 32-bit ELF binaries. Modern 64-bit Linux distributions don't include support for the i386 architecture out of the box, but you can add it manually and download architecture-specific packages:

In the default state, arm-open2x-linux-gcc is not recognized as an executable:

1
2
3
4
5
6
7
8
$ dpkg --print-architecture
amd64

$ dpkg --print-foreign-architectures
# No output

$ ldd /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-gcc
    not a dynamic executable

Let's enable i386 support and install the 32-bit libc:

1
2
$ sudo dpkg --add-architecture i386
$ sudo apt install libc6:i386

Now the loader can find the executable's runtime dependencies and we can run it:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$ dpkg --print-foreign-architectures
i386

$ ldd /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-gcc
    linux-gate.so.1 (0xe8ae8000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xe8891000)
    /lib/ld-linux.so.2 (0xe8aea000)

$ /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-gcc
arm-open2x-linux-gcc: no input files