Linux Mint Notes
These are notes for myself about configuring my Linux Mint computer.
System#
Laptop Battery Care with TLP#
I use TLP to set battery charge thresholds to help keep my laptop battery in good shape for longer. After doing some online research, it looks like starting to charge when below 75%
and stopping at 80%
is the sweet spot for battery health.
- Install TLP and the ThinkPad support package:
1 |
|
- Send the charge thresholds to the battery controller:
1 |
|
- Also write the thresholds to
/etc/tlp.conf
so that they get loaded and set at boot time, in case they were not persisted in the battery by the previoussetcharge
command:
1 2 |
|
Use tlp-stat
to confirm the configured thresholds:
1 2 3 4 5 6 7 8 9 |
|
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 |
|
This is what the options do:
nodev,noexec,nosuid
are security precautions to reduce the system attack surface: do not allow special device files, deny file execution, and ignore the SUID bit in file permissions.- The SUID bit allows a regular user to execute a root-owned file with root privileges, but there is no legitimate need for that in
/tmp
. nosuid
is redundant ifnoexec
is also set, but it's a good idea to keep it there in case you decide to removenoexec
later.
- The SUID bit allows a regular user to execute a root-owned file with root privileges, but there is no legitimate need for that in
mode=1777
gives everyone full rwx permissions on/tmp
.- The
1
in1777
is the sticky bit, which prevents regular users from being able to delete other users' files, despite otherwise having the permissions to do so in/tmp
.
- The
size=4096M
sets the maximum size of/tmp
; if not specified it defaults to half the RAM size.
Check if /tmp
is RAM-backed after reboot:
1 2 |
|
I had trouble installing Linux games from GOG because of the
noexec
option. Setup failed with errors likeeval: ./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 in/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:
- Turn swap off:
1 |
|
- Comment out these lines from the file systems table in
/etc/fstab
:
1 2 |
|
- Comment out this line from the encrypted block devices table in
/etc/crypttab
:
1 |
|
- Delete the swap file and reboot:
1 2 |
|
At first I ran
swapoff
without editing the files in/etc
, and that caused issues that added 30 seconds to the kernel boot time according tosystemd-analyze
! The boot time returned to normal after I edited the two files.
Desktop#
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 |
|
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:
- Right-click panel, select Panel settings
- Under the Panel appearance section select the Left/Center/Right Zone
- Edit the Symbolic icon size (px) value as appropriate
- Standard color icons have an auto-scale option, but symbolic icons are limited to absolute values.
Before:
After:
Git#
Show the Time and Git Branch on the Shell Prompt#
I have my Bash prompt show the current time, and if inside a Git repo also the name of the checked-out branch. This goes at the end of ~/.bashrc
, to override any previously set PS1
(the environment variable for the shell prompt's format string),
1 2 3 4 5 6 |
|
The shell prompt should look something like this now:
1 2 3 4 |
|
Convenient Single-Letter Aliases#
I 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 can be dangerous when you're tired...
1 2 3 4 5 6 |
|
Colored Text in the Terminal#
Add to ~/.gitconfig
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Push to Multiple URLs#
Git remotes can be configured to push to multiple URLs, which is great for having backups and keeping things distributed. You can add extra addresses with git remote set-url --add --push origin git@host2:project.git
or edit the project's .git/config
directly:
1 2 3 4 5 6 |
|