Table of Contents

Linux/Prepare

Basic

default EDITOR

sudo update-alternatives --list editor
sudo update-alternatives --config editor

set umask

In file: ~/.profile

NOTE!: Problem appears with non default user umask and sudo command usage. After sudo umask is still set to the user umask, which is correct. But can lead to some unpredicted behavior i.e. installing system-wide packages - new file will be created with incorrect umasks (user umask).

To prevent this:

/etc/sudoers
Defaults        umask_override
Defaults        umask=0022

add i386 architecture

dpkg --add-architecture i386
apt-get update
apt-get install gpm tcpdump bmon tinc ppp pptpd mc links2 gparted hdparm smartmontools smart-notifier valgrind openssh-server
apt-get install wireshark mtr

NTP: allow time corrections bigger than 1h

  1. Disable systemd time service: systemctl disable –now systemd-timesyncd
  2. Install ntpdate and ntp
  3. Edit /etc/default/ntp and add -g argument.
  4. Switch RTC to UTC time:
timedatectl set-local-rtc 0
ntpd -gxn
hwclock --systohc

Disable PC speaker

echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf

resolv.conf

apt-get install resolvconf

Add own nameserver into /etc/resolvconf/resolv.conf.d/base

nameserver 8.8.8.8

and execute

sudo resolvconf -u

Polish & locales

dpkg-reconfigure keyboard-configuration
apt-get install console-data
dpkg-reconfigure console-data
dpkg-reconfigure locales

add

In Debian, locales are handled in /etc/default/locale. File /etc/environment is deprecated.

grep pam_env.so /etc/pam.d/*
...
/etc/pam.d/login:session       required   pam_env.so readenv=1
/etc/pam.d/login:session       required   pam_env.so readenv=1 envfile=/etc/default/locale
...

Remember to set paper_format

set cfq/deadline scheduler

/etc/udev/rules.d/60-schedulers.rules
#ACTION=="add|change", KERNEL=="sd*[!0-9]|sr*", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="cfq"
ACTION=="add|change", KERNEL=="sd*[!0-9]|sr*", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"
# ACTION=="add|change", KERNEL=="sd*[!0-9]|sr*|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"  
ACTION=="add|change", KERNEL=="sd*[!0-9]|sr*|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber"
ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]*", ATTR{queue/scheduler}="kyber"
cat /sys/block/sd*/queue/scheduler

single queue schedulers

There are 2 queues, one for read & one for write operations.

block multi-queue schedulers

Supported in kernel >=4.12. It is disabled by default. To use multi-queue schedulers compile kernel with CONFIG_SCSI_MQ_DEFAULT=y or pass parameter scsi_mod.use_blk_mq=1 in boot loader.

Linux Multi-Queue Block IO Queueing Mechanism

/etc/udev/rules.d/60-schedulers.rules
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"
sudo udevadm control --reload
sudo udevadm trigger
cat /sys/block/sd*/queue/scheduler

Disable console beep

To disable console annoying beep: * System wide by removing PC Speaker module:

rmmod pcspkr
sudo echo "blacklist pcspkr" > /etc/modprobe.d/pcspkr-blacklist.conf

Usefull software

sudo apt-get install wireshark cups
sudo usermod -G lp,lpadmin,dialout,sudo,audio,video,netdev,vboxusers,wireshark,kismet,i2c user_login

parallel packers

sudo apt-get install pigz pbzip2 pxz lbzip2

To force using parallel packers system-wide:

ln -s /usr/bin/lbzip2 /usr/local/bin/bzip2
ln -s /usr/bin/lbzip2 /usr/local/bin/bunzip2
ln -s /usr/bin/lbzip2 /usr/local/bin/bzcat
ln -s /usr/bin/pigz /usr/local/bin/gzip
ln -s /usr/bin/pigz /usr/local/bin/gunzip
ln -s /usr/bin/pigz /usr/local/bin/zcat
ln -s /usr/bin/pixz /usr/local/bin/xz

or use bash aliases:

.bashrc
alias gzip='pigz'
alias gunziip='unpigz'
alias bzip2='pbzip2'
alias bunzip2='pbunzip2'
alias xz='pxz'

some benchmarks (i7-3770K), BTRFS FS +NoCOW attrib

command user time size comments
pbzip2 -1 4m12 694M
pbzip2 -5 4m59 683M
pbzip2 -9 6m25 679M default
pigz -0 0m32 3,5G no compression
pigz -1 0m52 727M
pigz -2 0m48 723M
pigz -6 1m18 698M default
pxz -0 3m30 660M
pxz -3 5m00 636M
pxz -6 11m19 571M default

etckeeper

apt-get install git 
git config --global user.name "my name"
git config --global user.email myemail@address.pl
apt-get install git-cola etckeeper kdiff3

mandb

Disable mandb updates after apt:

echo "set man-db/auto-update false" | debconf-communicate; dpkg-reconfigure man-db