Advertisement
IssouLinux

Optimization guide for Linux

Jan 11th, 2022 (edited)
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 27.41 KB | None | 0 0
  1. *************Optimize your Linux system step by step*********************
  2. *************************************************************************
  3.  
  4.  
  5. #############################################################
  6. Easily choose kernel, recovery mode and get into BIOS update:
  7. ##############################################################
  8.  
  9.     sudo nano /etc/default/grub
  10. Lines must be like these ones:
  11. GRUB_DEFAULT=0
  12. GRUB_TIMEOUT_STYLE=menu
  13. GRUB_TIMEOUT=3
  14. GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
  15. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
  16. GRUB_CMDLINE_LINUX=""
  17.  
  18. sudo update-grub
  19.  
  20. **************************************
  21. OPTIMIZE LAPTOP BATTERY LIFE:
  22. **************************************
  23.  
  24.  
  25. First, install tlp:
  26.     sudo apt install tlp -y
  27.  
  28. After installing TLP on your Linux machine, make sure it is enabled on startup and start the service:
  29. Make an autostart with these commands:
  30.     sudo systemctl enable tlp.service && sudo systemctl enable tlp.service
  31.  
  32. To view the current TLP configurion, system information, active power saving settings and battery data, run:
  33.     sudo tlp-stat
  34.  
  35. ***Disable USB auto suspend***
  36.  
  37. When TLP is started with default configuration, some USB devices will be automatically suspended to save power when your Laptop is running on battery. To disable USB autosuspend, edit /etc/tlp.conf file:
  38.     sudo nano /etc/tlp.conf
  39.  
  40. Find the following line and set its value as 0.
  41.     USB_AUTOSUSPEND=0
  42.  
  43. You can also exclude specific devices from USB autosuspend (separate with spaces). First, use lsusb command to get the ids. Then, mention the device ids with space-separated like below
  44.     USB_BLACKLIST="8078:0014 065d:8023"
  45.  
  46.  
  47. If you're using Thinkpad, you will install any one of the following packages. If you don't know exactly which package to install, run tlp-stat -b command as sudo or root user. It will guide you which package to install.
  48.  
  49.     acpi-call-dkms - External kernel module providing battery recalibration for newer ThinkPads (X220/T420 and later).
  50.     tp-smapi-dkms - External kernel module providing battery charge thresholds, recalibration and specific tlp-stat -b output for older ThinkPads.
  51.  
  52. After installing TLP on your Linux machine, make sure it is enabled on startup and start the service using commands:
  53.     sudo systemctl enable tlp.service
  54.     sudo systemctl start tlp.service
  55.  
  56.  
  57.  ***Increase battery life by disabling the Bluetooth driver***
  58.  
  59. If you rarely use Bluetooth, you can probably increase the battery life of your laptop a lot by disabling the Bluetooth driver (instead of simply disabling the Bluetooth feature). Like this:
  60.     echo "blacklist btusb" | sudo tee /etc/modprobe.d/blacklist-bluetooth.conf
  61. Reboot your computer.
  62.  
  63. ***How to undo (re-enabling Bluetooth support):***
  64. a/ Temporary re-enabling Bluetooth can be done with this terminal command:
  65.     sudo modprobe -v btusb
  66. This will instantly re-enable Bluetooth, but it won't survive a reboot.
  67.  
  68. b/ Permanent re-enabling of Bluetooth can be achieved by the following terminal command which removes the Bluetooth module from the blacklist:
  69.    sudo rm -v /etc/modprobe.d/blacklist-bluetooth.conf
  70. Then reboot your computer. Bluetooth should be available again permanently.
  71.  
  72. GUI client for tlp (provides applet indicator and more functions:
  73. sudo add-apt-repository ppa:slimbook/slimbook
  74. sudo apt update
  75. sudo apt install slimbookbattery
  76.  
  77. If you want to have an applet to choose the governance mode (powersave or performance):
  78. sudo apt install indicator-cpufreq
  79.  
  80.  
  81.  
  82.  
  83. ****************************
  84. TRICKS TO PRESERVE YOUR SSD:
  85. ****************************
  86.  
  87. ***Reduce swappiness (set swappiness to 5)***
  88.    sudo bash -c 'echo "vm.swappiness=5" >> /etc/sysctl.conf'
  89. Reboot or type:
  90.    sudo sysctl -p
  91. Check:
  92.    sysctl vm.swappiness
  93.  
  94. On a computer with less than 8GB ram, you should use zram:
  95.    sudo apt install zram-config
  96. Check if it works: cat /proc/swaps
  97.  
  98. ***Mount /tmp as /tmpfs***
  99.  
  100. The Linux temporary file directory (/tmp) is very busy with applications and the system continually writing small files to it, sometimes quickly created and deleted. This directory is emptied at each reboot, but it remains on disk, which causes a lot of writing.
  101.  
  102. It is possible to put it in RAM with tmpfs.
  103. Add these lines at the bottom of /etc/fstab:
  104.    tmpfs /tmp tmpfs defaults,relatime,mode=1777,nosuid,size=4196M 0 0
  105.    tmpfs /var/tmp tmpfs defaults,relatime,mode=1777,nosuid,size=4196M 0 0
  106. Reboot.
  107.  
  108. Here we have created a /tmp of 4 GB, which is more than enough. Don't hesitate to put such a large value, even on a machine with little RAM: tmpfs only consumes memory when storing data.
  109. You can put other directories in tmpfs in the same way, but remember that as soon as the machine reboots or shuts down, you will lose the files placed in these directories.
  110.  
  111. ***
  112.  
  113.  The ext4 file system has a parameter called commit. This is the maximum time that passes between the moment an application requests to write data to disk and the moment ext4 will actually write it to disk. By default, this value is set to 5 seconds. ext4 will therefore wait at most 5 seconds before writing data to disk.
  114.   ext4 has a relative intelligence: For example if a file is created and then deleted in these 5 seconds, it will not write anything to disk (it is useless, since the file is deleted). By setting the commit time to 60 seconds, you can avoid disk writes.
  115.  
  116. Note that setting the commit to 60 seconds means that if your computer crashes, you risk losing the last 60 seconds of disk writes (instead of the default 5 seconds). It's up to you to see if your disk operations are critical at this point.
  117.  
  118. In the mount options of your partitions (/etc/fstab), simply add the option commit=60:
  119.    UUID=4a5773ef-7833-4741-c53f-8de2dd3d7527 /               ext4    errors=remount-ro,commit=60 0       1
  120.  
  121.  
  122. ***Set the automatic TRIM job to daily***
  123. 6. The cleaning action TRIM is recommended for the good performance of your SSD in the long run. Otherwise it might become slow after some time.
  124.  
  125. That's even true for new SSD's: although new SSD's nowadays usually have some form of garbage collection integrated into their firmware, it's always better to execute a regular TRIM as well.
  126.  
  127. Note: very old SSD's from before 2010 usually don't support TRIM.
  128.  
  129. In Linux Mint and Ubuntu automatic TRIM is enabled by default, when you install them on an SSD. Namely by a weekly "job". But in many (most?) cases, once a week isn't frequent enough: waiting an entire week before recoverable disk space becomes usable again, is simply too long.
  130.  
  131. You can switch your system to automatic daily trimming as follows:
  132.  
  133. a. Copy/paste the following command line into the terminal, in order to create a new folder:
  134.     sudo mkdir -v /etc/systemd/system/fstrim.timer.d
  135. then:
  136.     sudo nano /etc/systemd/system/fstrim.timer.d/override.conf
  137. Copy/paste this:
  138.  
  139. [Timer]
  140. OnCalendar=
  141. OnCalendar=daily
  142.  
  143. Note: the double entry for OnCalendar is no mistake but intentional!
  144.  
  145. Save the modified file and reboot your computer.
  146.  
  147. Confirm that you've successfully edited trim's configuration by executing this terminal command:
  148.     systemctl cat fstrim.timer
  149.  
  150. Your output should look approximately like this:
  151.     # /lib/systemd/system/fstrim.timer
  152.     [Unit]
  153.     Description=Discard unused blocks once a week
  154.     Documentation=man:fstrim
  155.     ConditionVirtualization=!container
  156.  
  157.     [Timer]
  158.     OnCalendar=weekly
  159.     AccuracySec=1h
  160.     Persistent=true
  161.  
  162.     [Install]
  163.     WantedBy=timers.target
  164.  
  165.     # /etc/systemd/system/fstrim.timer.d/override.conf
  166.     [Timer]
  167.     OnCalendar=
  168.     OnCalendar=daily
  169.  
  170. Let's take a look at this output. The first part shows the default setting (weekly), the second part shows the overriding setting that you've applied. That overriding setting contains two elements: first the existing OnCalendar setting (weekly) is being deleted, and then a new OnCalendar setting is being applied (daily).
  171.  
  172. If you ever want to check whether fstrim has actually happened, and when it happened, you can use this terminal command:
  173.     journalctl | grep fstrim.service
  174.  
  175. ***Gain 30% Linux Disk Performance***
  176. By setting "noatime,nodiratime", you disable the "access time stamp", that the operating system puts on a file whenever it's being read by the operating system. For an SSD "noatime,nodiratime" might be better, because it reduces the disk writes somewhat.
  177. Simply add “noatime,nodiratime” to your filesystem mount options in /etc/fstab to prevent atime from being updated on file and directory accesses:
  178.         sudo nano /etc/fstab
  179.         /dev/mapper/vgmint-root /               ext4    errors=remount-ro,commit=60,noatime,nodiratime 0       1
  180. Reboot.
  181.  
  182. ***Disable Java in Libre Office***
  183. The performance of Libre Office might be enhanced greatly, when you disable Java in it. This will disable a few features, but usually you won't even miss those.
  184.     Toolbar Libre Office Writer - Tools - Options...
  185.     LibreOffice - Advanced - Java Options:
  186. remove the tick for: Use a Java runtime environment
  187.  
  188.  
  189. ***VirtualBox***
  190. In order to guarantee the integrity of virtual disks, when a guest OS (in a VM) performs a disk write, VirtualBox forces the disk write in the host system (by doing a sync).
  191. One can reduce this forced write and have VirtualBox use the host system's disk cache. Not only does this greatly improve performance, but it also allows ext4 to possibly group disk writes.
  192. In the settings of your virtual machine, go to Storage and on each controller (IDE, SATA...) check the box "Use host I/O cache".
  193.  
  194.  
  195.  
  196. ***************************************
  197. Limit the disk write actions of Firefox
  198. ***************************************
  199.  
  200. You can limit the disk write actions of Firefox, by putting the Firefox network cache into the RAM and by disabling sessionstore. Like this:
  201.  
  202. ***Putting the Firefox network cache into the RAM***
  203. By moving the Firefox network cache from your hard disk to the RAM, you diminish the amount of disk writes. This'll probably make your Firefox noticeably faster as well. The price you pay is small: it'll only "cost" you 1 GB of your RAM.
  204.  
  205. Note: don't do this when your computer has only 2 GB of RAM or less! Because with very little RAM, even 512 MB can't be missed.
  206.  
  207. Proceed like this:
  208.  
  209. a. Type in the URL bar of Firefox:
  210.    about:config
  211. Press Enter.
  212.  
  213. b. Now you're being presented with a warning. Ignore it and click on the button "I accept the risk!".
  214.  
  215. c. Copy/paste the following into the filter bar (search bar):
  216.     browser.cache.disk.enable
  217.  
  218. Toggle its value to false by double-clicking it: this will disable "cache to disk" entirely.
  219.  
  220. d. Now you're going to make sure that "cache to RAM" is enabled (it is by default, but it may have been changed earlier). Copy/paste the following into the filter bar (search bar):
  221.    browser.cache.memory.enable
  222.  
  223. This should already be set to true; if not, toggle it to true by double-clicking it.
  224.  
  225. e. Then you're going to determine how much memory can be used as RAM cache. Copy/paste this into the filter bar (search bar):
  226.     browser.cache.memory.capacity
  227. That entry should exist already (if not, create it now).
  228.  
  229. The current integer value will probably be -1, which automates the maximum size of the RAM cache dependent on the available amount of RAM. So far so good, but this automation usually creates a cache that's far too small....
  230.  
  231. So set it to 524288 (KB, which equals a maximum of 512 MB). That's usually enough for all amounts of RAM. But if you have RAM to spare, I recommend 1048576, which equals a maximum of 1 GB.
  232.  
  233. f. Close Firefox and launch it again. You're done! Check it like this:
  234.  
  235. Type in the URL bar:
  236.    about:cache
  237. Press Enter.
  238.  
  239. By the way: you'll then also see a mention of an "appcache" which might still be present on the disk, but there's absolutely no need to move that (much less frequently used) cache to the RAM as well.
  240.  
  241. Note: This is a user preference. Repeat this hack in each user account.
  242.  
  243. ***Limit sessionstore***
  244. 9.2. Firefox has a session restore feature, which remembers what pages were opened if Firefox experiences an unexpected shutdown (read: crashes). This feature is neat, but causes many disk writes. Too many for an SSD. Limit it like this:
  245.  
  246. a. Type in the URL bar of Firefox:
  247.  
  248.    about:config
  249.  
  250. Press Enter.
  251.  
  252. b. Now you're being presented with a warning. Ignore it and click on the button "I accept the risk!".
  253.  
  254. c. Type the following keyword into the filter bar: sessionstore
  255.  
  256. d. Double-click on the item called browser.sessionstore.interval. The default interval is 15000, which means 15 seconds. Make it becomes 2 minutes: 120000 and click the OK button.
  257.  
  258. e. Close Firefox and launch it again.
  259.  
  260. Note (1): Leave the other cache and sessionstore settings as they are: usually, the less invasive a hack is, the better. Because this reduces the risk of unexpected unwanted side effects.
  261.  
  262. Note (2): This is a user preference. Repeat this hack in each user account.
  263.  
  264. ***Optimize the Places database***
  265. In your Firefox profile there's an sqlite database called Places, which after a while starts resembling a swollen Swiss cheese with holes. That might slow your Firefox down.
  266.  
  267. You can speed your Firefox up a bit, by optimizing (vacuuming) that database: you can namely deflate that swollen Swiss cheese into a compact smaller cheese. As follows:
  268.  
  269. Type the following in the URL bar of Firefox:
  270.    about:support
  271. Press Enter.
  272. Almost at the bottom of the page you get to see then, there's a header called Places Database. Click there on the button called Verify Integrity.
  273. You're done! Repeat this on a monthly basis, so that your Firefox won't lose speed again because of a swollen database.
  274.  
  275.  
  276. *******************
  277. Optimize the cache
  278. *******************
  279.  
  280.     about:config
  281.     browser.cache.use_new_backend
  282. Click on the "+" symbol
  283. Value "True" should be showed. That's all!
  284.  
  285. This optimised cache is by default not activated because it can cause tabs to crash in certain cases. This depends on the configuration and is random. If this happens, simply redo the procedure and deactivate this cache.
  286.  
  287. ****************************
  288. List of must-install addons:
  289. ****************************
  290. Modules complémentaires (about:support)
  291. -----------------------
  292.  
  293. Nom: Anti-Adblock Blocker
  294. Type: extension
  295. Version: 0.0.7
  296. Activé: true
  297. ID: {7616a0b7-d0b6-4a0d-ad65-c9b35d96bad4}
  298.  
  299. Nom: Bing
  300. Type: extension
  301. Version: 1.3
  302. Activé: true
  303. ID: bing@search.mozilla.org
  304.  
  305. Nom: Buster: Captcha Solver for Humans
  306. Type: extension
  307. Version: 1.3.2
  308. Activé: true
  309. ID: {e58d3966-3d76-4cd9-8552-1582fbc800c1}
  310.  
  311. Nom: Bypass Paywalls Clean
  312. Type: extension
  313. Version: 2.8.6.0
  314. Activé: true
  315. ID: {d133e097-46d9-4ecc-9903-fa6a722a6e0e}
  316.  
  317. Nom: ClearURLs
  318. Type: extension
  319. Version: 1.25.0
  320. Activé: true
  321. ID: {74145f27-f039-47ce-a470-a662b129930a}
  322.  
  323. Nom: Dark Reader
  324. Type: extension
  325. Version: 4.9.59
  326. Activé: true
  327. ID: addon@darkreader.org
  328.  
  329. Nom: Default Zoom
  330. Type: extension
  331. Version: 1.1.3
  332. Activé: true
  333. ID: default-zoom@jamielinux.com
  334.  
  335. Nom: Disable WebRTC
  336. Type: extension
  337. Version: 1.0.23
  338. Activé: true
  339. ID: jid1-5Fs7iTLscUaZBgwr@jetpack
  340.  
  341. Nom: DuckDuckGo
  342. Type: extension
  343. Version: 1.1
  344. Activé: true
  345. ID: ddg@search.mozilla.org
  346.  
  347. Nom: eBay
  348. Type: extension
  349. Version: 1.3
  350. Activé: true
  351. ID: ebay@search.mozilla.org
  352.  
  353. Nom: Expire History By Days
  354. Type: extension
  355. Version: 1.3.1
  356. Activé: true
  357. ID: expire-history-by-days@bonardo.net
  358.  
  359. Nom: Get Image Info
  360. Type: extension
  361. Version: 1.5.0
  362. Activé: true
  363. ID: @getimageinfo
  364.  
  365. Nom: Google
  366. Type: extension
  367. Version: 1.2
  368. Activé: true
  369. ID: google@search.mozilla.org
  370.  
  371. Nom: HTTPS partout
  372. Type: extension
  373. Version: 2021.7.13
  374. Activé: true
  375. ID: https-everywhere@eff.org
  376.  
  377. Nom: I don't care about cookies
  378. Type: extension
  379. Version: 3.4.3
  380. Activé: true
  381. ID: jid1-KKzOGWgsW3Ao4Q@jetpack
  382.  
  383. Nom: LocalCDN
  384. Type: extension
  385. Version: 2.6.38
  386. Activé: true
  387. ID: {b86e4813-687a-43e6-ab65-0bde4ab75758}
  388.  
  389. Nom: Qwant
  390. Type: extension
  391. Version: 1.2
  392. Activé: true
  393. ID: qwant@search.mozilla.org
  394.  
  395. Nom: Return YouTube Dislike
  396. Type: extension
  397. Version: 3.0.0.6
  398. Activé: true
  399. ID: {762f9885-5a13-4abd-9c77-433dcd38b8fd}
  400.  
  401. Nom: Reverso - Traduction, dictionnaire
  402. Type: extension
  403. Version: 2.2.205
  404. Activé: true
  405. ID: context@reverso.net
  406.  
  407. Nom: Search by Image
  408. Type: extension
  409. Version: 5.3.0
  410. Activé: true
  411. ID: {2e5ff8c8-32fe-46d0-9fc8-6b8986621f3c}
  412.  
  413. Nom: SponsorBlock pour YouTube - Supprime les publicités intégrées
  414. Type: extension
  415. Version: 5.1.1
  416. Activé: true
  417. ID: sponsorBlocker@ajay.app
  418.  
  419. Nom: SteamDB
  420. Type: extension
  421. Version: 3.6.1
  422. Activé: true
  423. ID: firefox-extension@steamdb.info
  424.  
  425. Nom: Tampermonkey
  426. Type: extension
  427. Version: 4.18.0
  428. Activé: true
  429. ID: firefox@tampermonkey.net
  430.  
  431. Nom: To DeepL
  432. Type: extension
  433. Version: 0.7.0
  434. Activé: true
  435. ID: {db420ff1-427a-4cda-b5e7-7d395b9f16e1}
  436.  
  437. Nom: TrackMeNot
  438. Type: extension
  439. Version: 0.10.46
  440. Activé: true
  441. ID: trackmenot@mrl.nyu.edu
  442.  
  443. Nom: uBlock Origin
  444. Type: extension
  445. Version: 1.44.4
  446. Activé: true
  447. ID: uBlock0@raymondhill.net
  448.  
  449. Nom: Universal Bypass
  450. Type: extension
  451. Version: 13.15.2.1
  452. Activé: true
  453. ID: {529b261b-df0b-4e3b-bf42-07b462da0ee8}
  454.  
  455. Nom: Wayback Machine
  456. Type: extension
  457. Version: 3.1
  458. Activé: true
  459. ID: wayback_machine@mozilla.org
  460.  
  461. Nom: Wikipédia (fr)
  462. Type: extension
  463. Version: 1.1
  464. Activé: true
  465. ID: wikipedia@search.mozilla.org
  466.  
  467. Nom: Windscribe - Free Proxy and Ad Blocker
  468. Type: extension
  469. Version: 3.4.7
  470. Activé: true
  471. ID: @windscribeff
  472.  
  473. Nom: Youtube Audio
  474. Type: extension
  475. Version: 0.0.2.5
  476. Activé: true
  477. ID: {580efa7d-66f9-474d-857a-8e2afc6b1181}
  478.  
  479. Nom: English (CA) Language Pack
  480. Type: locale
  481. Version: 106.0.2buildid20221025.065831
  482. Activé: true
  483. ID: langpack-en-CA@firefox.mozilla.org
  484.  
  485. Nom: English (GB) Language Pack
  486. Type: locale
  487. Version: 106.0.2buildid20221025.065831
  488. Activé: true
  489. ID: langpack-en-GB@firefox.mozilla.org
  490.  
  491. Nom: Français Language Pack
  492. Type: locale
  493. Version: 106.0.2buildid20221025.065831
  494. Activé: true
  495. ID: langpack-fr@firefox.mozilla.org
  496.  
  497. *********************************************************
  498. How to Enable DNS-over-HTTPS and Encrypted SNI in Firefox
  499. *********************************************************
  500. -What is DNS-over-HTTPS (DoH)? DoH encrypts DNS traffic with HTTPS (port 443) and HTTP/2 and requires authentication of the requested server.
  501. -What is Encrypted SNI? The Server Name Indication (SNI) shares the hostname for outgoing TLS connections in plain-text. Encrypting SNI is another way to secure your web activity from man-in-the-middle (MITM) attacks. Encrypted SNI is enabled by default with the Cloudflare DNS resolver.
  502.  
  503. Enable DNS-over-HTTPS (DoH):
  504.     Open your Firefox Preferences page
  505.     Under Network Settings, select Settings
  506.     Check Enable DNS over HTTPS
  507.     Select OK
  508.  
  509. Enable encrypted SNI:
  510.     In your browser, navigate to about:config;
  511.     Type network.security.esni.enabled
  512.     Select the toggle button to the right of false to true
  513.  
  514. *****************************************
  515. Limiting the disk write actions of Chrome
  516. *****************************************
  517.  
  518. 10. The disk write actions of Google Chrome can be limited as follows.
  519.  
  520. a. Click on the three dots (vertical line) in the upper right of the Chrome window - Settings.
  521.  
  522. b. Section Privacy and security - Cookies and site data
  523. Preload pages for faster browsing and searching: disable it.
  524.  
  525. c. Close Chrome and launch it again.
  526.  
  527. This way, you've disabled the "preload" feature, which can cause a lot of extra network traffic and also a lot of writes.
  528.  
  529.  
  530. *****************************************************
  531. Speed up your wireless internet (some WiFi chipsets)
  532. *****************************************************
  533.  
  534. The easiest way to speed up your wireless internet connection by disabling power management for the WiFi chipset.Type in the terminal:
  535.    iwconfig
  536. You can then not only see the name for your wireless chipset (for example: wlp2s0), but also whether Power Management is on for it. When it's off, or when no mention is made of Power Management at all, you don't need to do anything.
  537. When Power Management is on, proceed as follows:
  538.    sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
  539. Change 3 into 2.
  540. Save and reboot.
  541. Then check in the terminal, by the command iwconfig, whether Power Management for the wireless chipset is off now.  If so, you're done!
  542.  
  543. Is your WiFi not working properly? You may have forgotten to set the frequencies for the "France" region (as a result, channels 11/12/13 are not accessible).
  544.  
  545.     Check the value: iw reg get. If you don't see Country: FR then it's not set correctly.
  546.  Change the REGDOMAIN parameter in the /etc/default/crda file. Set it to:  REGDOMAIN=FR
  547. If the crda file doesn't exist, just create it in /etc/default
  548.  
  549.  
  550. *************************************
  551. Speed up your Intel wireless chipset
  552. *************************************
  553.  
  554. If you have a (reasonably) modern wireless chipset from Intel, it'll run on the iwlwifi driver. If so, you might be able to increase its speed noticeably, by turning on Tx AMPDU for it.
  555.   The purpose of AMPDU is to improve data transmission by aggregating or grouping together several sets of data. Thus it sharply reduces the amount of transmission overhead.
  556.   It used to be "on" by default in the iwlwifi driver. But several years ago, it was turned off because of stability issues on a few wifi chipsets. This problem affects, however, only a minority of chipsets...
  557.  
  558. For turning it on, proceed like this:
  559. a. First check whether your chipset runs on the iwlwifi driver:
  560.     lsmod | grep iwlwifi
  561.  
  562. Does the terminal output contain the word iwlwifi (in red letters)? If so, proceed with the next step:
  563.  
  564. b. Use copy/paste to transfer the following line (it's one line!) to the terminal. Don't type it; it's too easy to make typing errors:
  565.    echo "options iwlwifi 11n_disable=8" | sudo tee /etc/modprobe.d/iwlwifi-speed.conf
  566.  
  567. Don't be confused by the name of the option: when it's set to 8, you don't actually disable anything but you enable something.
  568. c. Reboot your computer.
  569.  
  570. as your wifi become unstable? Then undo the iwlwifi hack as described below.
  571.  
  572. Problems? Then undo it like this
  573. Does the iwlwifi hack create stability issues for your wifi? Then undo it with the following terminal command:
  574.  sudo rm -v /etc/modprobe.d/iwlwifi-speed.conf
  575. Then reboot. All should be then, as it was before.
  576.  
  577. *****************************************
  578. Enable performance support for Intel CPUs
  579. *****************************************
  580.  
  581. Create a new config file:
  582.     sudo nano /etc/sysctl.d/99-i915.conf
  583. Copy-paste this line:
  584.     dev.i915.perf_stream_paranoid=0
  585. Save and reboot
  586.  
  587. **************************
  588.  Turn off the firewall log
  589. ***************************
  590.  
  591. Have you enabled the firewall ufw (which is recommended)? Then you'll probably never look at its logs, so it won't hurt to turn off all logging by the firewall. Especially because it can be rather spammy sometimes. Turning off its log can save some system resources and disk space, and can be done like this:
  592.     sudo ufw logging off
  593. Do you want to enable logging by the firewall again?
  594.     Do you want to enable logging by the firewall again?
  595.  
  596. **************************
  597. Enable High Quality Audio
  598. **************************
  599.  
  600. Edit /etc/pulse/daemon.conf, copy/paste these lines:
  601. default-sample-format = float32le
  602. default-sample-rate = 48000
  603. alternate-sample-rate = 44100
  604. default-sample-channels = 2
  605. default-channel-map = front-left,front-right
  606. default-fragments = 4
  607. default-fragment-size-msec = 25
  608. resample-method = soxr-vhq
  609. remixing-produce-lfe = no
  610. remixing-consume-lfe = no
  611. high-priority = yes
  612. nice-level = -11
  613. realtime-scheduling = yes
  614. realtime-priority = 9
  615. rlimit-rtprio = 9
  616. daemonize = no
  617.  
  618. Type this to make the modifications effective:
  619.     pulseaudio --kill && pulseaudio --start
  620.  
  621. How to determine default-sample-format:
  622.     lscpu | grep 'Byte Order'
  623. output: Little Endian
  624.  
  625. In my case it’s Little Endian hence I have selected float32le. If your output returns Big Endian then select float32be sampling format.
  626.  
  627. resample-method:
  628. The resampling algorithm to use. I have selected soxr-vhq. It is the point sampler, which offers better sound quality however it is CPU intensive.If you have an old slow CPU, you should better use speex-float-10:
  629. ; resample-method = speex-float-10
  630. Keep in mind the difference in CPU power required to re-sample audio mattered in 2005. Perhaps it meant something in 2010. It's mostly irrelevant on modern desktop machines.
  631.  
  632. More informations about the other options: https://medium.com/@gamunu/enable-high-quality-audio-on-linux-6f16f3fe7e1f
  633.    pulseaudio --kill && pulseaudio --start
  634.  
  635.  
  636. ########################################
  637. Boost your system with a custom kernel:
  638. ########################################
  639. https://xanmod.org or https://liquorix.net/ (try both)
  640.  
  641. Before rebooting, check performance with your current kernel:
  642.    sudo apt install glmark2
  643.    glmark2
  644. Save the ouput, reboot on the custom kernel and do the benchmark again, compare and choose the best.
  645.  
  646. ######################
  647. Clear systemd journal
  648. ######################
  649.    crontab -e
  650. * * * * 5 sudo journalctl --vacuum-time=7d
  651.  
  652. ###############################################
  653. DNS block-list to filter ads/tracking/malwares
  654. ###############################################
  655.    crontab -e
  656. * * * * 7 sudo curl https://sebsauvage.net/hosts/raw > /etc/hosts && sed -i 1i"127.0.0.1 Elitebook850G8" /etc/hosts
  657.  
  658. ##########################
  659. Set custom DNS permanently
  660. ##########################
  661. Edit /etc/dhcp/dhclient.conf by adding:
  662. supersede domain-name-servers <adresse du serveur DNS1>, <adresse du serveur DNS2>;
  663.  
  664. #For instance:
  665. supersede domain-name-servers 1.1.1.1, 9.9.9.9;
  666.  
  667.  
  668. #################################
  669. Optimize your graphic performance
  670. #################################
  671. Add the Kisak PPA:
  672.     sudo add-apt-repository ppa:kisak/kisak-mesa
  673.  
  674. It's strongly recommended to remove this PPA before upgrading to a newer Ubuntu release or using another mesa PPA.
  675.     sudo apt install ppa-purge
  676.     sudo ppa-purge ppa:kisak/kisak-mesa
  677.  
  678. Note: Using ppa-purge with Ubuntu derivatives needs to include -d <based_on_name> to work safely. For example, Linux Mint 20 is based on Ubuntu Focal, so that would make it:
  679.     sudo ppa-purge -d focal ppa:kisak/kisak-mesa
  680.  
  681. #############################################################
  682. Install Microsoft fonts (Verdana, Arial, Times New Roman,...)
  683. #############################################################
  684.  
  685. sudo apt install ubuntu-restricted-extras msttcorefonts
  686.  
  687. *****************************************************
  688. Useful tool to install: System Monitoring Center
  689. ****************************************************
  690. Option-1) Installing for current user account: pip install system-monitoring-center
  691. Option-2) Installing for system-wide: sudo pip install system-monitoring-center (This method can be used for preventing source code modifications.)
  692.  
  693. *********************
  694. Tame the inode cache
  695. *********************
  696.  
  697. Computers with at least 12 GB of memory (RAM), will probably benefit by shrinking the inode cache less aggressively.
  698. The price that you pay for this, is that certain system items will remain longer in the RAM memory, which decreases the amount of available RAM for general tasks. That's why this tweak is only useful for computers with at least 12 GB of memory (RAM).
  699. This is how you do it:
  700.  
  701. Edit etc/sysctl.conf
  702.  
  703. Scroll to the bottom of that text file and add your cache parameter to override the default, so copy/paste the following lines into that text file:
  704.  
  705. # Improve cache management
  706. vm.vfs_cache_pressure=50
  707.  
  708. Save and reboot your computer.
  709.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement