System Benchmarking

Using OpenBenchmarking.org and Phoronix Test Suite for system benchmarking and online result comparison.

  • Registering an account on OpenBenchmarking.org
  • Download and install the latest Phoronix Test Suite:
    wget https://github.com/phoronix-test-suite/phoronix-test-suite/archive/v9.6.0m3.tar.gz
    tar xvf v9.6.0m3.tar.gz
    cd phoronix-test-suite-9.6.0m3/
    sudo ./install-sh
    

    In case of Raspbian or Ubuntu running on Raspberry Pi, install also additional packages:

    sudo apt install php-cli php-xml php-curl php-zip
    
  • Pair your (future) benchmarks with your OpenBenchmarking.org account:
    phoronix-test-suite openbenchmarking-login
    
  • Useful commands to list available test suites, test profiles, search tests and estimate test runtime:
    phoronix-test-suite list-available-suites
    phoronix-test-suite list-available-tests
    phoronix-test-suite search mp3
    phoronix-test-suite estimate-run-time pts/video-encoding
    
  • Run a single or multiple benchmarks in interactive mode:
    phoronix-test-suite benchmark pts/smallpt
    phoronix-test-suite benchmark pts/encode-flac pts/encode-mp3 pts/vpxenc pts/x264 pts/x265
    
  • Run a benchmark in non-interactive mode against a previously uploaded test result. Useful for running the same test on a new system to compare the results:
    phoronix-test-suite batch-setup
    phoronix-test-suite batch-benchmark 2004190-V110-RPIENCO26
    
Posted in General | Leave a comment

Raspberry Pi DNS Caching

Enable DNS caching on Raspbian:

sudo apt install dnsmasq
sudo tee -a /etc/dnsmasq.conf > /dev/null <<'EOF'
listen-address=::1,127.0.0.1
cache-size=1000
no-negcache
EOF
sudo systemctl restart dnsmasq

Posted in General | Tagged | Leave a comment

Raspberry Pi Storage Benchmark

Benchmark Raspberry Pi (microCD card) storage and compare it with published results on https://storage.jamesachambers.com/

Posted in General | Tagged | Leave a comment

Raspberry Pi Headless

Setting up Raspberry Pi 4B in headless mode with static IP and disabled Bluetooth on Raspbian:

# Unmount mounted microSD card partitions, just in case
sudo umount /dev/mmcblk0p1
sudo umount /dev/mmcblk0p2
# Download the latest Raspbian and upload it to microSD card: https://www.raspberrypi.org/documentation/installation/installing-images/linux.md
wget https://downloads.raspberrypi.org/raspbian_lite_latest
unzip -p 2020-02-13-raspbian-buster-lite.zip | sudo dd of=/dev/mmcblk0 bs=4M conv=fsync status=progress
sync
sudo partprobe /dev/mmcblk0
sudo mkdir /tmp/rpi
sudo mount /dev/mmcblk0p1 /tmp/rpi
# Enable SSH at startup by creating "/boot/ssh" file: https://www.raspberrypi.org/documentation/remote-access/ssh/
sudo touch /tmp/rpi/ssh
# Disable Bluetooth: https://www.raspberrypi.org/documentation/configuration/uart.md
sudo tee -a /tmp/rpi/config.txt > /dev/null <<'EOF'
dtoverlay=disable-bt
EOF
# Optionally disable PWR (red) LED
sudo tee -a /tmp/rpi/config.txt > /dev/null <<'EOF'
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off
EOF
sudo umount /tmp/rpi
sudo mount /dev/mmcblk0p2 /tmp/rpi
# Set static IP for eth0: https://www.raspberrypi.org/documentation/configuration/tcpip/
sudo tee -a /tmp/rpi/etc/dhcpcd.conf > /dev/null <<'EOF'
interface eth0
static ip_address=192.168.1.254/24
static routers=192.168.1.1
static domain_name_servers=9.9.9.9
EOF
sudo umount /tmp/rpi
sudo rmdir /tmp/rpi
# Boot RPi from microSD card
ssh pi@192.168.1.254
#raspberry
passwd
# Disable Bluetooth service: https://www.raspberrypi.org/documentation/configuration/uart.md
sudo systemctl disable hciuart
# Configure additional parameters: https://www.raspberrypi.org/documentation/configuration/raspi-config.md
sudo raspi-config
# OS update: https://www.raspberrypi.org/documentation/raspbian/updating.md
sudo apt update
sudo apt full-upgrade
# Optional update to 5.4 kernel: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=269769
sudo BRANCH=next rpi-update
# Firmware update: https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md
sudo sed -ie 's/critical/stable/' /etc/default/rpi-eeprom-update
sudo rpi-eeprom-update
sudo rpi-eeprom-update -a
# Reboot to apply the changes
sudo reboot

And on Ubuntu Server, where Bluetooth is disabled by default:

# Unmount mounted microSD card partitions, just in case
sudo umount /dev/mmcblk0p1
sudo umount /dev/mmcblk0p2
# Download the latest Ubuntu Server and upload it to microSD card: https://ubuntu.com/download/raspberry-pi
wget http://cdimage.ubuntu.com/releases/19.10.1/release/ubuntu-19.10.1-preinstalled-server-arm64+raspi3.img.xz
xzcat ubuntu-19.10.1-preinstalled-server-arm64+raspi3.img.xz | sudo dd of=/dev/mmcblk0 bs=4M conv=fsync status=progress
sync
sudo partprobe /dev/mmcblk0
sudo mkdir /tmp/rpi
sudo mount /dev/mmcblk0p1 /tmp/rpi
# Configure static IPs: https://netplan.io/examples#using-dhcp-and-static-addressing and https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#3-wifi-or-ethernet
sudo tee /tmp/rpi/network-config > /dev/null <<'EOF'
version: 2
ethernets:
eth0:
# dhcp4: true
addresses: [192.168.1.254/24]
gateway4: 192.168.1.1
nameservers:
addresses: [9.9.9.9]
optional: true
wifis:
wlan0:
# dhcp4: true
addresses: [192.168.1.253/24]
gateway4: 192.168.1.1
nameservers:
addresses: [9.9.9.9]
optional: true
access-points:
YOUR_WIFI_NAME:
password: "YOUR_WIFI_PASSWORD"
EOF
sudo umount /tmp/rpi
sudo rm -rf /tmp/rpi
# Boot RPi from microSD card
ssh ubuntu@192.168.1.254
#ubuntu
# OS update
sudo apt update
sudo apt full-upgrade
# Reboot to apply the changes
sudo reboot

Posted in General | Tagged | Leave a comment

Fix Tearing and Flickering in Zoom Screen Sharing

Remove Intel driver and use the default modesetting driver instead. Optimally disable vertical sync for more smooth screen sharing experience.

# Remove "old" Intel driver in favor of the default modesetting driver
sudo pacman -R xf86-video-intel
# Disable vsync for Zoom for more smooth screen sharing experience
sudo rm /usr/bin/zoom
cat <<"EOF" > /tmp/zoom
#!/bin/sh
vblank_mode=0 /opt/zoom/ZoomLauncher "$@"
EOF
sudo install -m 0755 /tmp/zoom /usr/bin

Posted in General | 2 Comments

Client Ranking of Arch Linux Mirrors

sudo bash -c 't=$(mktemp); reflector --country Slovakia --country Czechia --country Poland --country Hungary --protocol https --sort rate --age 24 > "$t" && rankmirrors -v "$t" | tee /etc/pacman.d/mirrorlist; rm "$t"'

Posted in General | Tagged | Leave a comment

DNS over TLS using Quad9 in Windows

  1. Download and install Unbound
  2. As administrator edit C:\Program Files\Unbound\service.conf:
    server:
    	interface: 127.0.0.53
    
    	# Log into Windows Application log
    	verbosity: 0
    	use-syslog: yes
    
    	# Disable caching of negative DNS records
    	cache-max-negative-ttl: 0
    	neg-cache-size: 0
    
    	# Globally enable DNS over TLS
    	tls-win-cert: yes
    	tls-upstream: yes
    
    	# Forward all queries to Quad9
    	forward-zone:
    		name: "."
    		forward-addr: 9.9.9.9@853
    		forward-tls-upstream: yes
    
  3. As administrator restart unbound service:
    sc stop unbound
    sc start unbound
    
  4. Select the active network connection (Control Panel\Network and Internet\Network and Sharing Center) and in Properties -> Internet Protocol 4 (TCP/IPv4) -> Use the following DNS server addresses -> Preferred DNS server enter 127.0.0.53
Posted in General | Tagged , | Leave a comment

DNS over TLS using Quad9

Configure systemd-resolved to use Quad9 – 9.9.9.9 as the preferred DNS resolver with DNS over TLS enabled. Also disable caching of negative DNS responses:

cat <<'EOF' >> /etc/systemd/resolved.conf
DNS=9.9.9.9
FallbackDNS=149.112.112.112 2620:fe::fe 2620:fe::9
DNSOverTLS=opportunistic
Cache=no-negative
EOF

sudo systemctl restart systemd-resolved

To always prefer the default, TLS encrypted DNS server, disable obtaining DNS servers from DHCP on Ethernet and Wireless interfaces and also remove “~.” – the default route domain from the interfaces using the helper script:

#!/bin/sh
INTERFACE=$1
ACTION=$2
# DNS modification makes sense for active (up and vpn-up) interfaces only
[[ "${ACTION}" =~ up$ ]] || exit 0
# Disable DNS default route for all interfaces to prefer global DNS
resolvectl default-route "${INTERFACE}" no
DOMAINS=$(resolvectl domain "${INTERFACE}" | cut -d: -f2)
# Remove "~." route domain from all interfaces to prefer global DNS
[[ "${DOMAINS}" =~ ~\. ]] || exit 0
DOMAINS="${DOMAINS//~.}"
if [[ -z "${DOMAINS// }" ]]; then
resolvectl domain "${INTERFACE}" ''
else
# Noting (route) domains are separate arguments and should be passed without enclosing double quotes
resolvectl domain "${INTERFACE}" ${DOMAINS}
fi

Place the script into /etc/NetworkManager/dispatcher.d/, enable NetworkManager-dispatcher service and restart NetworkManager to rerun the script:

curl -o /etc/NetworkManager/dispatcher.d/prefer-global-dns.sh https://gist.githubusercontent.com/viliampucik/caffddb1731a86518e4f393f1ebd0c0e/raw/c2a677661a59d3bd135149fcb597cd19f5b5f035/prefer-global-dns.sh
systemctl -now enable NetworkManager-dispatcher
systemctl restart NetworkManager
Posted in Linux | Tagged , | Leave a comment

The Fastest Arch Linux Mirrors

Use reflector to get the fastest Arch Linux mirrors after the network is up and online or when pacman-mirrorlist package gets an upgrade:

yay -S reflector

cat <<'EOF' > /etc/systemd/system/reflector.service
[Unit]
Description=Pacman mirrorlist update
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
ExecStart=reflector --country Slovakia --country Czechia --protocol https --age 12 --sort rate --save /etc/pacman.d/mirrorlist

[Install]
RequiredBy=multi-user.target
EOF

cat <<'EOF' > /etc/pacman.d/hooks/mirrorupgrade.hook
[Trigger]
Operation = Upgrade
Type = Package
Target = pacman-mirrorlist

[Action]
Description = Updating pacman-mirrorlist with reflector and removing pacnew...
When = PostTransaction
Depends = reflector
Exec = /bin/sh -c "reflector --country Slovakia --country Czechia --protocol https --age 12 --sort rate --save /etc/pacman.d/mirrorlist; rm -f /etc/pacman.d/mirrorlist.pacnew"
EOF
Posted in Linux | Tagged | Leave a comment

Random MAC

Use “stable” random MAC address for each Ethernet and wireless connection that changes with every reboot.

cat <<'EOF' > /etc/NetworkManager/conf.d/00-macrandomize.conf
[device]
# "yes" is already the default for scanning
wifi.scan-rand-mac-address=yes

[connection]
wifi.cloned-mac-address=stable
ethernet.cloned-mac-address=stable
# Generate random MAC for each connection and device combination
# that changes with every reboot
connection.stable-id="${CONNECTION}-${BOOT}-${DEVICE}"
EOF

systemctl restart NetworkManager
Posted in Linux | Tagged , | Leave a comment