Pavel Popov
Chief troubleshooting officer, software ninjaneer and digital migrant 🥷

First Boot of Armbian on Rock Pi 4B

Setting up Armbian on a Rock Pi 4B can be a straightforward process if you follow the right steps. In this blog post, I’ll guide you through the initial setup, from logging in for the first time to installing essential software. Let’s dive in!

Logging in as Root

The first time you log in, use the username root and the password 1234. Follow the on-screen instructions to create a new user, select your timezone, choose a shell, and set the locale.

Updating Packages

Before doing anything else, it’s crucial to update your packages. Open a terminal and run:

apt update && apt upgrade -y

This ensures you have the latest software and security updates.

Installing Software for ROCK Pi 23W PoE HAT

To fully utilize the ROCK Pi 23W PoE HAT, you’ll need to install some additional software. Here’s how:

  1. Install necessary packages to build the mraa library:

    apt update && \
      apt -y install git build-essential swig4.0 python3-dev libnode-dev cmake libjson-c-dev
    
  2. Download the “user overlay” from Radxa:

    mkdir -p /boot/overlay-user
    cd /boot/overlay-user
    curl -sL https://rock.sh/rockpi-poe-dtbo -o rockpi-poe.dtbo
    
  3. Update /boot/armbianEnv.txt:

    Add the following line to enable the overlay:

    user_overlays=rockpi-poe
    
  4. Compile and install mraa packages:

    cd ~
    git clone https://github.com/eclipse/mraa
    mkdir mraa/build
    cd mraa/build
    cmake .. \
      -DPYTHON3_INCLUDE_DIR=$(python3 -c "import sysconfig; print(sysconfig.get_path('include'))") \
      -DPYTHON3_LIBRARY=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
    make -j7 # Adjust based on available cores+1
    make install
    ldconfig
    
  5. Install the PoE package from Radxa:

    cd /tmp
    wget https://cos.setq.me/rockpi/deb/rockpi-poe-0.13.deb
    dpkg -i rockpi-poe-0.13.deb
    systemctl enable rockpi-poe.service
    
  6. Reboot the device:

    reboot
    

    After the reboot, the fan should spin rapidly and then slow down, indicating that it is working correctly.

  7. Check the service status:

    Run the following command to ensure the service is active:

    systemctl status rockpi-poe.service
    

    You should see an output similar to this:

    ● rockpi-poe.service - Rockpi PoE-FAN
         Loaded: loaded (/lib/systemd/system/rockpi-poe.service; enabled; vendor preset: enabled)
         Active: active (running) since Sat 2024-06-22 21:24:47 +08; 3min 8s ago
       Main PID: 11117 (python3)
          Tasks: 1 (limit: 4447)
         Memory: 4.6M
            CPU: 182ms
         CGroup: /system.slice/rockpi-poe.service
                 └─11117 /usr/bin/python3 /usr/bin/rockpi-poe.py start
    

Enable PCIe Gen2 mode to get max speed

By default, the PCIe on the Rock Pi 4B runs in Gen1 mode to ensure maximum compatibility. However, if you’ve confirmed that your NVMe drive is working well, you can enable PCIe Gen2 mode to significantly boost its speed, achieving read/write speeds of over 1000MB/s.

To enable PCIe gen2 mode, add the following lines to /boot/armbianEnv.txt:

overlays=rk3399-pcie-gen2

After saving the changes, reboot your Rock Pi 4B. This will apply the new configuration and you should see a noticeable increase in NVMe performance.

Changing the Hostname

Customizing your device’s hostname can make it easier to identify on your network. To change the hostname, use the following command:

hostnamectl set-hostname new-host-name

Replace new-host-name with your desired hostname.

Set a Static IP

Setting a static IP in Armbian is straightforward. Follow these simple steps:

  1. Open /etc/network/interfaces file and modify the configuration:

    • For a wired connection (eth0):

      auto eth0
      iface eth0 inet static
          address 192.168.1.100
          netmask 255.255.255.0
          gateway 192.168.1.1
          dns-nameservers 8.8.8.8 8.8.4.4
      
    • For a wireless connection (wlan0):

      auto wlan0
      iface wlan0 inet static
          address 192.168.1.100
          netmask 255.255.255.0
          gateway 192.168.1.1
          wpa-ssid "YourSSID"
          wpa-psk "YourPassword"
          dns-nameservers 8.8.8.8 8.8.4.4
      
  2. Restart networking:

    systemctl restart networking
    
  3. Verify the configuration:

    ip addr show eth0
    

(Replace eth0 with your interface name if different.)

Copying SSH Key to Server

For secure, password-less login, copy your SSH key to the server:

ssh-copy-id -i ~/.ssh/mykey user@host

Replace ~/.ssh/mykey with the path to your SSH key and user@host with your server’s username and address.

Installing Tailscale

Tailscale is a useful tool for creating secure networks. Here’s how to install and set it up:

  1. Install Tailscale:

    curl -fsSL https://tailscale.com/install.sh | sh
    
  2. Start Tailscale:

    tailscale up
    

    If you encounter the error failed to connect to local tailscaled, reboot the system and try starting Tailscale again.

By following these steps, you’ll have your Rock Pi 4B running Armbian smoothly and efficiently. Happy hacking!