Saturday, March 20, 2021

Tunings for Ubuntu

 Here are few things I would do for my Ubuntu installation (21.10).


1) Mount the main disk with noatime, e.g.

ref: https://opensource.com/article/20/6/linux-noatime

if it is a SSD drive, I also add nodatacow and autodefrag to the options too.


2) Changed the vm.dirty_background_byte and vm.dirty_bytes to "fix" USB drive write issues.

sudo touch  /etc/sysctl.d/90-dirty.conf

sudo nano -e /etc/sysctl.d/90-dirty.conf

Add these 2 lines to the file and reboot for it to take effect.

vm.dirty_background_bytes=16777216

vm.dirty_bytes=50331648

ref: https://forum.manjaro.org/t/copying-progress-bar-hangs-at-100-when-copying-to-thumb-drive/37108 and https://www.suse.com/support/kb/doc/?id=000017857

 

3) Disable USB autospenspend


Add usbcore.autosuspend=-1 to the GRUB_CMDLINE_LINUX_DEFAULT option in /etc/default/grub, e.g.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1"

note: don't forget to run update-grub2 to apply the changes.

4) Depending on the favor of Ubuntu you are using, the GUI for User and Groups editing may be limited. You can fix this by bring back the GNOME User and Groups editor by installing the gnome-system-tools.

sudo apt-get install gnome-system-tools

 

5) If you are like me who have a machine on an old school VGA KVM, and need to force a custom resolution for display output, then adding video=VGA-1:1920x1080@60 to the GRUB_CMDLINE_LINUX_DEFAULT may be the easiest solution, e.g.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=VAG-1:1920x1080@60 usbcore.autosuspend=-1"

To find out the supporting resolutions of your company, use xrandr, e.g.

6) Make a Linux machine understands Windows host names.  It is often nicer to refer another machine in your network by its name rather than its IP.  For instance, instead of ping 192.168.1.100, it is easier to ping machine_a.  By default, your machine cannot resolve the host name machine_a to 192.168.1.100.  To make this happens, you need to modify your /etc/nsswitch.conf and add wins mdns4 to your line line begins with host: similar to below:

 hosts: files mdns4_minimal [NOTFOUND=return] dns wins mdns4

 In addition, you also need to have  winbind and libnss-winbind packages installed, e.g.

sudo apt install winbind libnss-winbind

note: you may need to restart your machine after the change to get things working.

ref: https://www.techrepublic.com/article/how-to-enable-linux-machines-to-resolve-windows-hostnames/


7) If you are using Ubuntu, you may also want to reduce the GRUB wait time from 30 seconds to something lower.


GRUB_TIMEOUT=10

GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT



As it seems, setting changing the GRUB_TIMEOUT isn't enough, you also need to set the GRUB_RECORDFAIL_TIMEOUT value in Ubuntu.


ref: https://superuser.com/questions/971704/changing-grub-timeout-value-doesn-t-seem-to-work

ref: https://help.ubuntu.com/community/Grub2#Last_Boot_Failed_or_Boot_into_Recovery_Mode


8) If you don't need suspend and/hibernation in Linux, you can disable them with this command.

$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target


 

No comments: