meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:prepare:prepare [2016/02/14 11:28]
niziak
linux:prepare:prepare [2023/07/30 08:53] (current)
niziak
Line 3: Line 3:
 ===== Basic ===== ===== Basic =====
  
-=== Disable console beep === +==== default EDITOR ====
-To disable console annoying beep: +
- * System wide by removing PC Speaker module:+
 <code bash> <code bash>
-rmmod pcspkr +sudo update-alternatives --list editor 
-sudo echo "​blacklist pcspkr"​ > /​etc/​modprobe.d/​pcspkr-blacklist.conf+sudo update-alternatives --config editor
 </​code>​ </​code>​
  
-=== Usefull software ​=== +==== set umask ====
-<code bash>​sudo apt-get install wireshark cups</​code>​ +
-<code bash>​sudo usermod -G lp,​lpadmin,​dialout,​sudo,​audio,​video,​netdev,​vboxusers,​wireshark,​kismet,​i2c user_login</​code>​+
  
 +In file: ''​~/​.profile''​
 +  * ''​umask 002''​ (default), RW for user, RW for group and R for others - create dirs as 775 and files as 664
 +  * ''​umask 022''​ (default for root), 755 and 644
 +  * ''​umask 077''​ only RW for user, not other access
 +  * ''​umask 007''​ RW for user, RW for group
  
-=== parallel packers === +**NOTE!:** Problem appears with non default user umask and ''​sudo''​ command usage. 
-<code bash>sudo apt-get install pigz pbzip2 pxz lbzip2</​code>​+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 force using parallel packers system-wide+To prevent this
-<code bash> +<file | /etc/sudoers
-ln -s /usr/bin/lbzip2 /​usr/​local/​bin/​bzip2 +Defaults ​       umask_override 
-ln -s /​usr/​bin/​lbzip2 /​usr/​local/​bin/​bunzip2 +Defaults ​       umask=0022
-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 +
-</code+
-or use bash aliases: +
-<file | .bashrc>​ +
-alias gzip='​pigz'​ +
-alias gunziip='​unpigz'​ +
-alias bzip2='​pbzip2'​ +
-alias bunzip2='​pbunzip2'​ +
-alias xz='​pxz'​+
 </​file>​ </​file>​
  
-=== add i386 architecture ===+ 
 +==== add i386 architecture ​====
  
 <code bash> <code bash>
Line 47: Line 37:
 </​code>​ </​code>​
  
-=== etckeeper ​===+==== NTP: allow time corrections bigger than 1h ==== 
 +  - Disable systemd time service: ''​systemctl disable --now systemd-timesyncd''​ 
 +  - Install ''​ntpdate''​ and ''​ntp''​ 
 +  - Edit ''/​etc/​default/​ntp''​ and add ''​-g''​ argument.  
 +  - Switch RTC to UTC time:
 <code bash> <code bash>
-apt-get install git  +timedatectl set-local-rtc 0 
-git config ​--global user.name "my name" +ntpd -gxn 
-git config --global user.email myemail@address.pl +hwclock ​--systohc
-apt-get install git-cola etckeeper kdiff3+
 </​code>​ </​code>​
  
-=== Disable PC speaker ===+ 
 + 
 + 
 +==== Disable PC speaker ​====
 <code bash> <code bash>
 echo "​blacklist pcspkr"​ > /​etc/​modprobe.d/​nobeep.conf echo "​blacklist pcspkr"​ > /​etc/​modprobe.d/​nobeep.conf
 </​code>​ </​code>​
  
-=== resolv.conf ===+==== resolv.conf ​====
 <code bash>​apt-get install resolvconf</​code>​ <code bash>​apt-get install resolvconf</​code>​
  
Line 71: Line 67:
 === Polish & locales === === Polish & locales ===
 <code bash> <code bash>
 +dpkg-reconfigure keyboard-configuration
 apt-get install console-data apt-get install console-data
 dpkg-reconfigure console-data dpkg-reconfigure console-data
Line 90: Line 87:
  
  
-For logitech devices there are additional packets:+Remember to set [[sw:​libreoffice#​paper_format]] 
 + 
 +==== set cfq/​deadline scheduler ==== 
 + 
 +<file | /​etc/​udev/​rules.d/​60-schedulers.rules>​ 
 +ACTION=="​add|change",​ KERNEL=="​sd[a-z]",​ ATTR{queue/​rotational}=="​1",​ ATTR{queue/​scheduler}="​cfq"​ 
 +ACTION=="​add|change",​ KERNEL=="​sd[a-z]",​ ATTR{queue/​rotational}=="​0",​ ATTR{queue/​scheduler}="​deadline" ​  
 +</​file>​ 
 + 
 +<code bash>cat /​sys/​block/​sd*/​queue/​scheduler</​code>​ 
 + 
 +=== single queue schedulers === 
 +There are 2 queues, one for read & one for write operations. 
 +  * **none** is just a First In First Out standard queue of I/O operations. 
 +  * **cfq** (Completely Fair Scheduling) is similar to the Round Robin algorithm and basically allots a fixed execution time for each I/O operation (they are implemented as a circular queue) 
 +  * **deadline** is like a priority queue with an aging concept. Basically it adds a deadline for each I/O operation & implements a priority queue 
 + 
 +=== 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. 
 + 
 +[[https://​www.thomas-krenn.com/​en/​wiki/​Linux_Multi-Queue_Block_IO_Queueing_Mechanism_(blk-mq)|Linux Multi-Queue Block IO Queueing Mechanism]] 
 + 
 +<file | /​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"​ 
 +</​file>​
 <code bash> <code bash>
-sudo apt-get install lomoco solaar+sudo udevadm control ​--reload 
 +sudo udevadm trigger 
 +cat /​sys/​block/​sd*/​queue/​scheduler
 </​code>​ </​code>​
-[[https://​wiki.archlinux.org/​index.php/​Logitech_Marble_Mouse]] 
  
 +==== Disable console beep ====
  
-=== NTPallow time corrections bigger than 1h === +To disable console annoying beep
-  - Edit /​etc/​default/​ntp and add "​-s"​ argument. + * System wide by removing PC Speaker module:
-  - Ordered List ItemInstall ntpdate and ntp +
-  - Ordered List ItemSwitch RTC to UTC time:+
 <code bash> <code bash>
-timedatectl set-local-rtc +rmmod pcspkr 
-ntpd -qg +sudo echo "​blacklist pcspkr"​ > /​etc/​modprobe.d/​pcspkr-blacklist.conf 
-hwclock ​--systohc+</​code>​ 
 + 
 + 
 + 
 + 
 + 
 +===== Usefull software ===== 
 +<code bash>​sudo apt-get install wireshark cups</​code>​ 
 +<code bash>​sudo usermod -G lp,​lpadmin,​dialout,​sudo,​audio,​video,​netdev,​vboxusers,​wireshark,​kismet,​i2c user_login</​code>​ 
 + 
 + 
 +==== parallel packers ==== 
 +<code bash>​sudo apt-get install pigz pbzip2 pxz lbzip2</​code>​ 
 + 
 +To force using parallel packers system-wide:​ 
 +<code bash> 
 +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 
 +</​code>​ 
 +or use bash aliases: 
 +<file | .bashrc>​ 
 +alias gzip='​pigz'​ 
 +alias gunziip='​unpigz'​ 
 +alias bzip2='​pbzip2'​ 
 +alias bunzip2='​pbunzip2'​ 
 +alias xz='​pxz'​ 
 +</​file>​ 
 + 
 +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 ==== 
 +<code bash> 
 +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
 </​code>​ </​code>​
  
  
 +==== mandb ====
  
 +Disable mandb updates after apt:
 +<code bash>​echo "set man-db/​auto-update false" | debconf-communicate;​ dpkg-reconfigure man-db</​code>​