Skip to content

Instantly share code, notes, and snippets.

@CezaryDanielNowak
Last active July 25, 2023 17:21
Show Gist options
  • Save CezaryDanielNowak/b7c656c1d15cec4c15bb55979b433627 to your computer and use it in GitHub Desktop.
Save CezaryDanielNowak/b7c656c1d15cec4c15bb55979b433627 to your computer and use it in GitHub Desktop.

LINUX HELPERS for HP T630 Terminal

In my case Linux Mint Xfce

Don't create SWAP drive. Create SWAP file instead and save your SSD.

# Check current swap file/partition
swapon -s

# create an big empty 10GB file (or whatever size you like)
dd if=/dev/zero of=/swapfile bs=1M count=10240
# set proper permissions
chmod 0600 /swapfile
# format the file as swap
mkswap /swapfile
# turn it on.
swapon /swapfile

# Disable other swap file
sudo swapoff /OLD_swapfile

Modify your power settings

  1. /etc/systemd/logind.conf or /etc/systemd/logind.conf.d/*.conf
  2. Advanced Power Management (APM) APM (Advanced Power Management) control is present in all Debian kernels, but disabled by default. To activate it, you add the apm=on option to the kernel parameters passed at boot time. With LILO, you would add the append="apm=on" directive to the block indicating which image to boot (in the /etc/lilo.conf file), and relaunch lilo. With GRUB2, you simply add apm=on to the GRUB_CMDLINE_LINUX= variable in /etc/default/grub, and run update-grub to regenerate the contents of the boot menu.
  3. /etc/laptop-mode/laptop-mode.conf
  4. /etc/tlp.conf

Ensure TRIM enabled for SSD

https://ubuntuhandbook.org/index.php/2013/12/enable-trim-ssd-better-performance/

Configure SSH access

sudo apt install openssh-server
sudo systemctl enable ssh

# Start ssh server
sudo systemctl start ssh

# Check if all good
sudo systemctl is-enabled ssh
sudo systemctl status ssh

# Optionally allow SSH in the Firewall
sudo ufw allow ssh && sudo ufw reload

Setup VNC Server to access machine remotely (no monitor needed)

### WIP. ### 
# Install TightVNC
sudo apt install tightvncserver

# Create normal user for the VNC access
sudo adduser vncclient
sudo passwd vncclient

# Let vncclient use sudo
usermod -aG sudo vncclient

# Set user and password
su - vncclient
vncpasswd 

# set passwords for the VNC
tightvncserver

# Password will be visible under a file
ls -l /home/vncpasswd/.vnc

# Configure VNC
nano ~/.vnc/config

# SET:
session=gnome
geometry=1920x1200
localhost
alwaysshared


nano ~/.vnc/xstartup

Remove garbage software

# List packages
apt list --installed

sudo apt-get remove --auto-remove thunderbird 
sudo apt-get remove --auto-remove libreoffice-*

# who uses modem nowdays?
sudo apt-get purge modemmanager

# Print server
sudo apt-get remove cups-*

# No audio on my machine
sudo apt remove pulseaudio

# No X for me
sudo apt-get remove xserver-*
sudo apt purge xfce4
sudo apt purge xfce4-*
sudo apt purge x11-*
sudo apt purge plymouth-*
sudo apt purge thunar-*
sudo apt purge xubuntu-*
sudo apt purge lightdm
sudo apt purge gdm
sudo apt remove gufw # GUI for the firewall

# Remove docker if not used
docker rmi $(docker images -a -q)
sudo apt-get purge -y docker-*
sudo groupdel docker
sudo apt purge containerd.io

sudo rm -rf /var/lib/docker /etc/docker

Mount drives to /Data (path compatible with CasaOS)

# check all drives
lsblk

# mount drives to /DATA
mkdir /DATA/PARTITION_200GB
sudo mount /dev/sdb2 /DATA/PARTITION_200GB/

# If that doesn't work after restart:
sudo crontab -e
# ADD:
@reboot mount /dev/sdb2 /DATA/PARTITION_200GB/
@reboot mount /dev/sda1 /DATA/WD_2TB/

Update samba settings to speedup file read/write

sudo nano /etc/samba/smb.conf
# add:
   read raw = yes
   write raw = yes
   use sendfile = true
   socket options = TCP_NODELAY IPTOS_LOWDELAY
   load printers = no
   getwd cache = true
   smb encrypt = disabled
   
# optionally try   
   aio read size = 16384
   aio write size = 16384
   aio write behind = true
   
   
# Restart samba
sudo service smbd restart
sudo service nmbd restart

Disable "Giga Lite" mode limiting samba to 60MB/s (500Mbps)

First check if EEE is enabled:

ethtool --show-eee <TAB>
# Disable EEE using ethtool won't stay after a reboot
ethtool --set-eee <TAB> eee off

# Make it work after restart:
sudo crontab -e
# ADD (WIP):
@reboot ethtool --set-eee <WHATEVER> eee off | at now + 1 minute

# Try other settings
sudo ethtool -s enp1s0 autoneg on speed 1000 duplex full

Other way would be to set it in GRUB:

sudo nano /etc/default/grub
# SET
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash igb.EEE=0"
GRUB_TERMINAL=console # not

# RUN
sudo update-grub

Other handy tools

# monitor network usage
sudo apt install iftop 

# monitor CPU/Memory
sudo apt install htop 

# list all sysctl variables
sudo sysctl -a > /DATA/sysctl-all.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment