User Tools

Site Tools


rockpro64

RockPro64 Debian Stretch Minimal by mrfixit2001

mrfixit2001 GitHub Debian Builds Release Page


sudo apt update
sudo apt upgrade

PATH variables

Commands that reside in /usr/sbin or /usr/local/sbin cannot be run directly from terminal or will give the error command not found. This is due to PATH variables not set properly. Therefore we need to fix the PATH variables system wide. To do so we will edit the file /etc/environment:

sudo nano /etc/environment

Then paste the following (or edit if line exists):

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

For immediate results, we run:

source /etc/environment && export PATH
Alternate

We can also change the PATH variables system wide by editing /etc/profile or adding a script in /etc/profile.d as all scripts are executed ending in .sh whenever a bash shell is entered.

We can add a new file such as env.sh inside /etc/profile.d:

sudo nano /etc/profile.d/env.sh

Paste the following to export the PATH variable system wide:

export PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
Reference

Hostname & Hosts

We will change the hostname to properly reflect the name of our beautiful device. Edit the file /etc/hostname and change it to something like rp64:

sudo nano /etc/hostname

Edit the file /etc/hosts to reflect the changed hostname. Change the line 127.0.1.1:

sudo nano /etc/hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
127.0.1.1       rp64

Reboot the device for changes to take effect:

sudo reboot
Alternate

You can also change the hostname using hostnamectl that comes with systemd based systems.

hostnamectl set-hostname rp64
hostnamectl
Reference

Users & Groups

Add User

We will change the default user and group for the rockpro64 for personality and security reasons. To add new user we will first switch to root user:

sudo su - root

Add new user (follow the instructions and set password):

adduser username

Use the usermod command to add the new user to the sudo group:

usermod -aG sudo username

NOTE: -G is for assigning secondary group(s), while -g is for assigning a primary group.

To add a user to multiple groups we can do:

usermod -aG sudo,adm,audio,video,plugdev,input,ssh username

NOTE: -G is for assigning secondary group(s), while -g is for assigning a primary group.

To check a user's groups:

groups username

To list all the groups on the system:

getent group

To add a new group:

groupadd groupname

To check a user's id:

id username

Password

You can change a user's password like this:

passwd username

To delete a password for a user:

passwd -d username

To not require password every time with sudo command:

sudo visudo

At the bottom of the file, type:

[...]
username ALL=(ALL) NOPASSWD: ALL

Delete User

First make sure that you are logged in as root.

If using SSH to login, you can allow SSH server to allow root login:

sudo nano /etc/ssh/sshd_config

Change #PermitRootLogin prohibit-password to PermitRootLogin yes:

[...]
PermitRootLogin yes
[...]

Restart SSH server:

sudo systemctl restart ssh

We will now delete the default user and group for rockpro64:

userdel -r username

NOTE: -r removes the home directory and mail spool.

REMEMBER to change ssh config to not allow root login for security reasons:

sudo sed -i 's/PermitRootLogin yes/#PermitRootLogin prohibit-password/' /etc/ssh/sshd_config && sudo systemctl restart ssh

Disable root

The simplest method to disable root user login is to change its shell from /bin/bash (or any other shell that permits user login) to /usr/sbin/nologin, in the /etc/passwd file:

sudo nano /etc/passwd

Change the first line to:

root:x:0:0:root:/root:/usr/sbin/nologin
[...]

You can also disable SSH root login like we did above:

sudo sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config && sudo systemctl restart ssh
References

Date & Time

First let's reconfigure the timezone by:

sudo dpkg-reconfigure tzdata

Next we should keep the time synced from the internet via ntp:

sudo apt install ntp

To check if the date and time is properly configured:

date


Default Shell

Let's change the default shell from dash to bash:

sudo dpkg-reconfigure dash

Choose NO.


List Utils

Some of the packages that allow us to list devices such as pci or usb are not installed by default in this build. Therefore we must install them like this:

sudo apt install pciutils usbutils lsscsi util-linux

List PCI devices

lspci -v

OR

lspci -vv

OR

lspci -m

List USB devices

lsusb

OR

lsusb -v

List SCSI devices

lsscsi

OR

lsscsi -v

List Block devices

lsblk

OR

lsblk -m
References

Benchmarks

HDD benchmark

Install hdparm from debian packages:

sudo apt install hdparm

You can list a hard disk properties of /dev/sda by:

sudo hdparm -I /dev/sda

Now let's do a hard disk benchmark of disk /dev/sda:

sudo hdparm -t /dev/sda

Above command uses data retrieved from the HDD buffer. To go around this to retrieve files directly from the disk itself we will use the command option –direct to benchmark the actual transmission rate of the disk:

sudo hdparm -t --direct /dev/sda
Results

Benchmarked on March 15, 2019

sudo hdparm -I /dev/sda
Model Number:       WDC WD20NMVW-59AV3S3
Serial Number:      WD-WXQ1EA44CP27
Firmware Revision:  01.01A01
Transport:          Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
sudo hdparm -t /dev/sda
-
Timing buffered disk reads: 254 MB in  3.00 seconds =  84.55 MB/sec
Timing buffered disk reads: 304 MB in  3.02 seconds = 100.82 MB/sec
Timing buffered disk reads: 332 MB in  3.01 seconds = 110.34 MB/sec
-
sudo hdparm -t --direct /dev/sda
-
Timing O_DIRECT disk reads: 280 MB in  3.00 seconds =  93.21 MB/sec
Timing O_DIRECT disk reads: 334 MB in  3.01 seconds = 110.85 MB/sec
Timing O_DIRECT disk reads: 334 MB in  3.01 seconds = 110.86 MB/sec


sudo hdparm -I /dev/mmcblk1
HDIO_DRIVE_CMD(identify) failed: Invalid argument
sudo hdparm -t /dev/mmcblk1
-
Timing buffered disk reads: 280 MB in  3.00 seconds =  93.26 MB/sec
Timing buffered disk reads: 278 MB in  3.00 seconds =  92.59 MB/sec
Timing buffered disk reads: 278 MB in  3.01 seconds =  92.34 MB/sec
-
sudo hdparm -t --direct /dev/mmcblk1
-
Timing O_DIRECT disk reads: 308 MB in  3.00 seconds = 102.51 MB/sec
Timing O_DIRECT disk reads: 282 MB in  3.01 seconds =  93.62 MB/sec
Timing O_DIRECT disk reads: 286 MB in  3.00 seconds =  95.18 MB/sec
References

Network benchmark

We will use a tool called iperf to measure network throughput. iperf requires a server and a client to send and receive files to test the network bandwidth.

Debian stretch does not have the latest iperf version 3.x.x package therefore we will download them from their official website:

cd /tmp
wget https://iperf.fr/download/ubuntu/libiperf0_3.1.3-1_armhf.deb https://iperf.fr/download/ubuntu/iperf3_3.1.3-1_armhf.deb
sudo dpkg -i libiperf0_3.1.3-1_armhf.deb iperf3_3.1.3-1_armhf.deb
rm libiperf0_3.1.3-1_armhf.deb iperf3_3.1.3-1_armhf.deb

To check the iperf version installed:

iperf3 -v

Before we can test, we will need to install iperf3 on another machine (Windows/Linux). For Linux, you can follow the steps above. For Windows you can download the files here.

On the server machine, run the iperf3 server:

iperf3 -s

OR, if on Windows machine:

./iperf3.exe -s

Now, to test from the client machine, run:

iperf3 -c server_ip

To reverse the sending/receiving of packets, run:

iperf3 -c server_ip -R
Results

Benchmarked on March 15, 2019

iperf3 -c 192.168.0.11
-
Connecting to host 192.168.0.11, port 5201
[  4] local 192.168.0.64 port 36240 connected to 192.168.0.11 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  80.5 MBytes   676 Mbits/sec    8    214 KBytes
[  4]   1.00-2.00   sec  81.5 MBytes   684 Mbits/sec   15    215 KBytes
[  4]   2.00-3.00   sec  78.2 MBytes   656 Mbits/sec   14    211 KBytes
[  4]   3.00-4.00   sec  81.6 MBytes   685 Mbits/sec    0    212 KBytes
[  4]   4.00-5.00   sec  62.1 MBytes   521 Mbits/sec    0    212 KBytes
[  4]   5.00-6.00   sec  73.8 MBytes   619 Mbits/sec    0    212 KBytes
[  4]   6.00-7.00   sec  84.4 MBytes   708 Mbits/sec    0    212 KBytes
[  4]   7.00-8.00   sec  86.5 MBytes   725 Mbits/sec    0    212 KBytes
[  4]   8.00-9.00   sec  82.8 MBytes   696 Mbits/sec    0    212 KBytes
[  4]   9.00-10.00  sec  81.4 MBytes   683 Mbits/sec   13   91.2 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   793 MBytes   665 Mbits/sec   50             sender
[  4]   0.00-10.00  sec   792 MBytes   665 Mbits/sec                  receiver

iperf Done.
iperf3 -c 192.168.0.11 -R
-
Connecting to host 192.168.0.11, port 5201
Reverse mode, remote host 192.168.0.11 is sending
[  4] local 192.168.0.64 port 36244 connected to 192.168.0.11 port 5201
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec  81.9 MBytes   687 Mbits/sec
[  4]   1.00-2.00   sec  76.5 MBytes   642 Mbits/sec
[  4]   2.00-3.00   sec  81.3 MBytes   682 Mbits/sec
[  4]   3.00-4.00   sec  84.5 MBytes   709 Mbits/sec
[  4]   4.00-5.00   sec  81.8 MBytes   686 Mbits/sec
[  4]   5.00-6.00   sec  87.4 MBytes   733 Mbits/sec
[  4]   6.00-7.00   sec  88.4 MBytes   742 Mbits/sec
[  4]   7.00-8.00   sec  86.8 MBytes   728 Mbits/sec
[  4]   8.00-9.00   sec  83.5 MBytes   701 Mbits/sec
[  4]   9.00-10.00  sec  81.5 MBytes   684 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-10.00  sec   834 MBytes   699 Mbits/sec                  sender
[  4]   0.00-10.00  sec   834 MBytes   699 Mbits/sec                  receiver

iperf Done.
References

CPU benchmarks

Sysbench

Install sysbench:

sudo apt install sysbench

To run cpu test:

sysbench --test=cpu run

OR

sysbench --test=cpu --cpu-max-prime=20000 run

To run memory test:

sysbench --test=memory run
Results

Benchmarked on March 15, 2019

sysbench --test=cpu run
-
sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1

Doing CPU performance benchmark

Threads started!
Done.

Maximum prime number checked in CPU test: 10000


Test execution summary:
    total time:                          74.2394s
    total number of events:              10000
    total time taken by event execution: 74.2350
    per-request statistics:
         min:                                  7.40ms
         avg:                                  7.42ms
         max:                                  7.48ms
         approx.  95 percentile:               7.46ms

Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   74.2350/0.00
References
Phoronix Test Suite

Install prerequisites:

sudo apt install php-cli php-xml php-zip

Download phoronix-test-suite:

cd /tmp
wget http://phoronix-test-suite.com/releases/repo/pts.debian/files/phoronix-test-suite_8.6.1_all.deb
sudo dpkg -i phoronix-test-suite_8.6.1_all.deb
rm phoronix-test-suite_8.6.1_all.deb

List available test suites:

phoronix-test-suite list-available-suites

Install test suites:

phoronix-test-suite install test_suite_name

Estimate test suite run time:

phoronix-test-suite estimate-run-time test_suite_name

Run the test suite:

phoronix-test-suite run test_suite_name
References
rockpro64.txt · Last modified: 2019/03/15 18:25 by pi