Create a home NAS, gaming and video streaming client using Armbian / Radxa 5B+ (rx3588)

NOTE Unfortunately all link are broken because message: Sorry, new users can only put 2 links in a post. See Create a home NAS, gaming and video streaming client using Armbian / Radxa 5B+ (rx3588) in my gist for wokring link.
I have removed my personal experience here, beacuse It doesn’t add to the discussion.

Create a home NAS, gaming and video streaming client using Armbian / Radxa 5B+ (rx3588)

First steps

Install and update the OS
  1. Install Armbian OS
    In my case I used the [onboard eMMC via USB](https:// docs.radxa .com/en/rock5/rock5b/low-level-dev/maskrom/windows) and the [latest Armbian image for Rock 5b](https:// www.armbian .com/rock-5b-plus/).
  2. Update the system
    sudo apt-get update
    sudo apt-get upgrade
    
Adjust the fan control

Initially I thought the FAN was not working. Then, I realized it was starting at 60+ deg.
This is a problem for me, because I also have 2 NVMe SSD drives on the bottom and the board becomes hot, fast. So, I have change the FAN control:

By looking in my Armbian device tree (dtc -I fs -O dts /sys/firmware/devicetree/base) I see the values are:

  • soc-thermal -> trips -> 60°C - 85°C - 115°C
  • cooling-levels -> 0 64 128 192 255 (converted from hex)
temperature Fan
0 - 60 0
60 - 85 64 (25%)
85 - 115 128 (50%)
115+ 192 (75%)

I have created new cooling-levels values: 19% - 50% - 100% - 100% = 48 - 128 - 255 = 0x30 0x80 0xff 0xff 0xff

temperature Fan
0 - 60 48 (19%)
60 - 85 128 (50%)
85+ 255 (100%)
  1. Create pwm-fan.dts file:
    /dts-v1/;
    /plugin/;
    / {
        fragment@0 {
            target = <&fan0>;
     	       __overlay__ {
     		         cooling-levels = <0x30 0x80 0xff 0xff 0xff>;
     	       };
          };
    };
    
  2. Apply the overlay:
    sudo armbian-add-overlay pwm-fan.dts
    
  3. Reboot
  • NOTE: I plan to also use FAN controlled by the GPIO pins and will post my update here.
Adjust the UI (install packages and extensions)
  1. Install packages
    # GNOME extensions & manager
    # GNOME software that I will use (Startup Apps Manager, Gnome Software)
    sudo apt install \
       gnome-shell-extensions gnome-shell-extension-manager \
       gnome-startup-applications \
       gnome-software
    
  2. Show the minimize and maximize buttons in the windows
    gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"
    
  3. Instal the desktop icons extension Gtk4 Desktop Icons NG from the Extensions Manager. I will need this because I will use the Desktop as application launcher.
    Then I change the extension settings:
    • Make Size of the icons = Large
    • Action to open items = Single click (so it’s easier to open with controller, see [Enable game controller support](#enable-game-controller-support ))
  4. Install the extension Caffeine and set it to never suspend.
Remove apps I will not use

As I will not use this board as regular PC I don’t need some of this app.
It may be different for you:

  • midnight commander: sudo apt purge mc mc-data
  • Meld (a diff tool, vscode can do it): sudo apt purge meld
  • HexChat (some kind of ICQ? Really?): sudo apt purge hexchat hexchat-common
  • FileZilla (a good FTP app, but I will not need it): sudo apt purge filezilla filezilla-common
  • regexxer (search files by Regex, not needed): sudo apt purge regexxer
  • Remmina (remote desktop client): sudo apt purge remmina remmina-common
  • Emacs (text editor/terminal): sudo apt purge emacs emacs-gtk emacs-el
  • Firefox (it won’t even start for me): sudo apt purge firefox
  • LibreOffice: sudo apt purge libreoffice libreoffice-gtk3 libreoffice-common
  • Thunderbird (mail client) sudo apt purge thunderbird

NAS

Create RAID 1 from 2 NVMe drives

I have 2x1GB NVMe PCIe 3.0 drives that like to setup as RAID 1 to store my phone photos and family albums.

  1. Install ZFS:
    Open armbian-config and install: System -> Storage -> ZFS filesystem
  2. Identify your drives
    lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT
    
  3. Create RAID array
    sudo zpool create nas mirror /dev/nvme0n1 /dev/nvme1n1
    
  4. Open Files (Nautilus) go to /nas and bookmark it so it’s always visible
  5. Add the /nas drive to the Desktop icons as well as other folders you may need
Setup firewall
# install ufw firewall
sudo apt-get install ufw
# enable it
sudo ufw enable
# allow samba access over TCP and UDP only for my local network 192.168.0.0 to 192.168.0.255
sudo ufw allow proto udp to any port 137 from 192.168.0.0/24
sudo ufw allow proto udp to any port 138 from 192.168.0.0/24
sudo ufw allow proto tcp to any port 139 from 192.168.0.0/24
sudo ufw allow proto tcp to any port 445 from 192.168.0.0/24
Add user to access the NAS drive from outside
  1. Create media directory to hold the sync files
    sudo mkdir /nas/media
    
  2. Create a group (storage) and user (syncuser) to access the /nas/media folder
    sudo useradd --system syncuser
    sudo groupadd storage
    sudo usermod -aG storage syncuser
    sudo usermod -aG storage my_user # add myself
    # set the user and group as owners of the folder
    sudo chown -R syncuser:storage /nas/media/
    # set owner rwx access
    sudo chmod 775 /nas/media
    
  3. Check group and access
    # check group users
    sudo getent group storage
    # check folder access
    ls -l /nas/
    
Share the NAS in Samba
  1. Install samba
    sudo apt install samba
    
  2. Edit file /etc/samba/smb.conf and add:
    [media]
      path = /nas/media
      writeable = yes
      browseable = yes
      create mask = 0775
      force create mode = 0775
      directory mask = 0775
      force directory mode = 0775
      force user = syncuser
    
  3. add samba password for syncuser
    sudo smbpasswd -a syncuser
    
  4. restart samba
    sudo systemctl restart smbd
    
Sync from Android phones

Network access Galaxy phones

  1. Open My Files
  2. Go to Network storage
  3. Add Network drive (SMBv2/SMBv3)
  4. Enter syncuser/password

Auto sync photos

  1. Check your ip ip addr
  2. Install FolderSync in Adroid
  3. In FolderSync go to Accounts -> Add account -> SMB -> enter your IP, user=syncuser, password=yourpassword,SMB=SMB3,Enable DFS,Require encryption
  4. Create a folderPair left=your photos right the SMB account

Stream Games (Moonlight)

First install [Sunshine](https:// app.lizardbyte .dev/Sunshine/?lng=en) on your streaming PC

Install Moonlight
  1. Download Moonlight
    git clone https:// github .com/moonlight-stream/moonlight-qt.git
    cd moonlight-qt
    git submodule update --init --recursive
    
  2. Update the source to use the Rockchip rx3588 libs
    echo 'LIBS += -L/usr/lib -lavcodec -lavutil -lavformat -lswscale' >> app/app.pro
    echo 'LIBS += -L/usr/lib -lavcodec -lavutil -lavformat -lswscale' >> moonlight-qt.pro
    
  3. Install build dependencies
    sudo apt-get install libegl1-mesa-dev libgl1-mesa-dev libopus-dev libsdl2-dev libsdl2-ttf-dev libssl-dev \
     libavcodec-dev libavformat-dev libswscale-dev libva-dev libvdpau-dev libxkbcommon-dev wayland-protocols \
     libdrm-dev qt6-base-dev qt6-declarative-dev libqt6svg6-dev qml6-module-qtquick-controls qml6-module-qtquick-templates \
     qml6-module-qtquick-layouts qml6-module-qtqml-workerscript qml6-module-qtquick-window qml6-module-qtquick
    
  4. Build it
    qmake6 moonlight-qt.pro
    make release -j$(nproc)
    
  5. Make it visible by GNOME
    # create a folder in the /usr/lib for moonlight
    sudo mkdir /usr/lib/moonlight/
    # copy the app and icons to the new folder
    sudo cp app/moonlight* /usr/lib/moonlight
    # make a symbolic links for the app and icon
    sudo ln -s /usr/lib/moonlight/moonlight /usr/bin/moonlight
    sudo ln -s /usr/lib/moonlight/moonlight_wix.png /usr/share/pixmaps/moonlight.png
    # update gnome
    sudo desktop-file-install --dir=/usr/share/applications app/deploy/linux/com.moonlight_stream.Moonlight.desktop
    
  6. Now the moonlight app is in the GNOME apps and the ~/moonlight-qt folder can be removed
  7. Add Moonlight app to the desktop icons
    cp /usr/share/applications/com.moonlight_stream.Moonlight.desktop ~/Desktop/Moonlight.desktop
    # make it trusted
    gio set ~/Desktop/Moonlight.desktop metadata::trusted true
    # make it executable
    chmod a+x ~/Desktop/Moonlight.desktop
    
  8. Open Moonlight. It should be hardware accelarated with the Rockchip hardware. I made the following option changes:
    1. Set resolution to Native / 30FPS (it’s based on preference and network connection
    2. GUI Dysplay = Fullscreen (for open in fullscreen mode)

Make GNOME TV friendly

Enable game controller support (AntiMicroX)

I have old XBox 360 USB controller that works really well for controling GNOME:

  1. First install [FlatHub](https:// flathub .org/setup/Debian) if you don’t have it:
    sudo apt install flatpak
    sudo apt install gnome-software-plugin-flatpak
    flatpak remote-add --if-not-exists flathub https:// dl.flathub .org/repo/flathub.flatpakrepo
    
    I recommend to restart
  2. Install the [AntiMicroX](https:// github .com/AntiMicroX/antimicrox) controller app
    flatpak install flathub io.github.antimicrox.antimicrox
    
  3. AntiMiroX fix for Wayland problem “access to unpiut file”:
    cd /usr/lib/udev/rules.d/
    sudo wget https:// raw.githubusercontent .com/AntiMicroX/antimicrox/master/other/60-antimicrox-uinput.rules
    cd ~/
    
    • You may need to reboot
  4. Open AntiMiroX and configure your controller. I use old XBox 360 USB Controller that I set:
    • Pad is bound to Keyboard UP,LEFT,DOWN,RIGHT
    • Left Joistick is Mouse UP,LEFT,DOWN,RIGHT
    • B is ESC
    • A is ENTER
    • X is TAB
    • Y is CAPSLOCK
    • XBox center (Guide) button is Super L
    • Hold the Back btn for 2 sec is ALT + F4
    • RB is Menu
  5. Name the profile and save it in Home folder
  6. Make it start as Hidden at the login.
    • Open Startup Applications app and add:
      • Name: Controller Support
      • Command: flatpak run io.github.antimicrox.antimicrox --hidden
      • Comment: Start AntiMiroX for game controller support
Enable HDMI CEC

Lets install the CEC tools and test communication is working:

  • install v4l-utils
    sudo apt install v4l-utils
    
  • Check devices cec-ctl --list-devices
    /dev/cec0 # - HDMI 1
    /dev/cec1 # - HDMI 2
    # ...
    
  • Register as playback cec-ctl -d1 --playback -o Rock5B+ see the address
  • Test CEC communication
    sudo cec-ctl -d1 \ # device /dev/cec1
      -t0 \ # to address 0.0.0.0 (the TV itself)
      --playback -o Rock5B+ \ # register as playback device with name
      -T -M # monitor and trace (log debug info)
      --active-source phys-addr=3.0.0.0 \ # auto set the HDMI-CEC input in the TV
      --report-power-status pwr-state=on # autoreport the powers tatus of the Rock to on (Samsuns TV required it)
    
  • I have writthen a python deamon that start the cec-ctl as a sub-process and track for stdout for keys [Python CEC Control](https:// github .com/rosenkolev/python-cec-control).
    This is not great as a solution and will try another approach but the existing [cecdeamon](https:// github .com/simons-public/cecdaemon) don’t work.
    I also tried using libcec directly and it’s not working as well.
Add Shutdown/Reboot action to Desktop
[Desktop Entry]
Name=Shutdown
Comment=Shutdown
Exec=sudo shutdown -r now
Icon=/usr/share/icons/ubuntu-mono-light/actions/24/system-shutdown-panel.svg
Terminal=false
Type=Application

Multimedia

Jellyfin

Install Jellyfin

IMPORTANT Don’t follow [the Rockchip VPU tutorial](https:// jellyfin
.org/docs/general/administration/hardware-acceleration/rockchip)

  1. Just run the install script.
    curl -s https:// repo.jellyfin .org/install-debuntu.sh | sudo bash
    
  2. Enable harware accelaration.
    • Open WEB UI -> Profile -> Administration -> Dashboard -> Playback -> Transcoding -> Hardware Acceleration = Rockchip MPP
    • Check all ckeckboxes
  3. Validate acceleration works by:
    • run sudo watch -n 1 cat /sys/kernel/debug/rkrga/load
    • Play some content on reduced qulity and look at the terminal
Make Jellyfin TV Friendly
  1. Enable TV Mode: WEB UI -> Profile -> Display -> Display Mode = TV
  2. Add a launch button on the Desktop to start the Jellyfin Web UI as and application in fullscreen (kiosk mode) with
    • Create Jellyfin.desktop file:
      [Desktop Entry]
      Name=Jellyfin
      Comment=Jellyfin
      Exec=/usr/bin/chromium --kiosk --disable-session-crashed-bubble --disable-infobars --disable-features=TabRestore --load-extension=~/jellyfin_close_ext http:// localhost:8096
      Icon=/usr/share/jellyfin/web/touchicon512.png
      Terminal=false
      Type=Application
      Categories=Media;
      
    • Make it trusted and executable:
      gio set ~/Desktop/Jellyfin.desktop metadata::trusted true
      chmod a+x ~/Desktop/Jellyfin.desktop
      
  3. Create a Chromium extension to add an Exit button (needed to exit kiosk by TV remote)
    If you don’t need it remove --load-extension=~/jellyfin_close_ext flag above!
    1. Create a folder jellyfin_close_ext

    2. Create a file manifest.json:

      {
      "manifest_version": 3,
      "version": "1.0",
      "name": "jellyfin-close-button",
      "description": "Jellyfin close button",
      "permissions": ["scripting", "activeTab"],
      "host_permissions": ["*://localhost:8096/*"],
      "content_scripts": [
        {
          "matches": ["http:// localhost:8096/web/"],
          "js": ["content-script.js"]
        }
      ]
      }
      
    3. Create a file content-script.js:

      (function() {
        setTimeout(function () {
        const btn = document.querySelector('button[title=SyncPlay]');
        const icon = btn.querySelector('.material-icons');
        icon.classList.remove('groups');
        icon.classList.add('close');
        btn.addEventListener('click', function(event){
            event.preventDefault();
            event.stopPropagation();
            window.close();
        }, false);
        }, 1500);
      })();d
      

      NOTE That I am replacing the groups button in the UI.

Let’s just refer to conclusion:

This always was just choice to make. Raspberry pi is really expensive for their specs, but sure - have better support and compatibility. At that price You can have something on intel n100 (including radxa x4) and have even more common hardware.
On the other hand radxa docs have improved significantly and it’s easier to get something to work. The problem is to stay updated because there is no such active kernel development as in raspberry.

Choose whatever is best for You. At this time there is nothing else with specs like rk3588 and that low power consumption. With X86 You will get great choice of specs, but it will need much more power. Pi is expensive and for me it’s not able to serve as good NAS, to less i/o.

If You know how maskroom works then it’s just easy to enter it. How You would like to fix docs to be more clear?

I feel I need to explain more.

First, Let me say the board itself is great. The build quality is good and there are no 2.5
Gbit boards with 2 NVMe interfaces I can find.

So my frustration is not related to the Radxa people. It’s more my wrong expectations I guess.

I don’t know what Maskrom is and I have very limited experience with Linux overall. I only owned 1 other SBC (Raspberry PI 4b) and was able to install Home Assistant OS and stream my home cameras with verry little effort, like 2-3 hours. So,
I expected this is the case for all SBC. I was really surprised that Rockchip required special drivers and applications don’t have hardware acceleration out of the box with it.

I just didn’t expect the amount of issues I had to resolve to make it work. And I still haven’t made it work completely. It’s may by just my ignorance, I don’t know.

Save yourself trouble and install Joshua Riek’s Ubuntu, then run your home assistant in a VM. Or install dietpi. But this is mostly for server user and the home assistant is the “core” version (unless, of course, you run it as a VM).