Showing posts with label ssd. Show all posts
Showing posts with label ssd. Show all posts

Friday, October 1, 2021

Setting up a PiHole on an old Netbook

I used to run my Pi-Hole setup on a Raspberry Pi 3B+.  However I am about to pass the Pi to a family member, therefore I need something to run Pi-Hole on.


I have an old Netbook sitting around which I would like to make it useful again.  Unfortunately its processor is so old and is 32 bit only.  Many Linux distros are now being 64bit only so the options for running a modern OS on the this old computer seems getting slimmer and slimmer till I came around a web article said Debian is still distributing its 32bit version.

I get a copy of the 32bit version of the last Debian (Bullseye) from 

 


 

 http://debian.osuosl.org/debian-cdimage/11.0.0-live/i386/iso-hybrid/

 

After installed Debian, I install Pi-Hole as I would on my Pi using the instructions on the Pi-Hole website.

 https://github.com/pi-hole/pi-hole/#one-step-automated-install

 

Now, here are few things I have done to my install that I didn't do my my Pi before.


1) Disable the power saving features.  This is required to prevent the computer from falling into sleep expectively!

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



ref: https://www.unixtutorial.org/disable-sleep-on-ubuntu-server/

 

2) Add kernel parameter reboot=bios to fixed my reboot issue. My Netbook hangs at the stage just before the machine will reboot.   The reboot parameter fixes my problem, e.g.

sudo nano -e /etc/default/grub



Then run update-grub2 to apply the change.


ref: https://www.suse.com/support/kb/doc/?id=000017792

Situation

During a shutdown or reboot the system will shutdown appropriately but at the point where it should power off or begin the reboot it will hang.  The power must be manually turned off or cycled to boot the system back up.

Resolution

The kernel has a "reboot" parameter that will generally fix the problem.  Each of the options can be tested on bootup of the system by adding the parameter to the "Boot Options" in the GRUB menu.  Here is a list of all the options:

warm =  Don’t set the cold reboot flag
cold = Set the cold reboot flag
bios = Reboot by jumping through the BIOS (only for X86_32)
smp = Reboot by executing reset on BSP or other CPU (only for X86_32)
triple = Force a triple fault (init)
kbd = Use the keyboard controller. cold reset (this is the default)
acpi = Use the RESET_REG in the FADT
efi = Use efi reset_system runtime service
pci = Use the so-called “PCI reset register”, CF9
force = Avoid anything that could hang.

3) Edit the fstab to reduce the wear and tear to the SSD caused by EXT4 journal system.  See my another post at:

https://xpwithubuntu.blogspot.com/2020/05/linux-and-ssd.html

 

Hope you find this useful too.





 

 

 

 

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