Setting up AML-S805X-AC (La Frite) as a desktop computer

La Frite

The goal of this article

Turn your AML-S805X-AC La Frite into a power saving tiny desktop computer based on Ubuntu Bionic Beaver 18.04 LTS.

Issues

  • Few RAM (1GB)
    Use 32 bit (armhf) image to save RAM. 64 bit based system needs much more RAM (like 20 ~ 40% more in real use cases) compared to 32 bit based system.
    — To be exact, La Frite’s 32 bit images are in fact “32 bit userspace on 64 bit kernel” setup. Requiring fewer memory anyway.
    — 512MB version of Frite is not suitable for desktop purpose.
  • Limited USB power supply
    — Apparently La Frite’s power supply to its USB ports is not so good (e.g. as recent Raspberry Pis).
    — Installing on USB 3.0 flash drives may make the system unstable because of higher peak current. Use a USB 2.0 microSD reader and an Application Performance Class 1 or better microSD card instead. Note that “USB 2.0 flash drives” on the market are generally far too slow.
  • Only 2 USB ports
    — Be aware of power consumption of USB hub itself. Self-powered hubs are ideal. For bus-powered hubs, cheaper and simpler one tend to use fewer power.

An A1 microSD and a tiny USB reader

Resources on “LoveRPi” Wiki will help in troubleshooting.

First boot

Download and flash the image

You can find the official images here:

Download the latest libre-computer-aml-s805x-ac-ubuntu-bionic-headless-mali-armhf image.

When it’s completed, extract zip and write img on a USB flash drive (microSD with USB reader) using Etcher or Gnome-disks or DD or anything you prefer.

You don’t need to expand partition manually. The system partition will be expanded and a swap partition will be added automatically on the first boot.

Plug it in and boot

Connect a HDMI cable, a LAN cable (or some USB WLAN adapters may also work with bundled drivers), USB HID devices, and the USB flash drive you’ve installed system. If everything is ready, plug in a microUSB power source connected to a decent 2.5A+ adapter to boot.

If the system not booting up correctly, it’s likely because of out of power. Remove some USB devices and try again.

Prepare the system

(Optional) Create a new user

# adduser your-new-user
# usermod -aG $(groups libre| sed -e "s/libre : libre //" -e "s/ /,/g") your-new-user

Install basic software

# apt install bash-completion xinit fonts-droid-fallback xfce4 xfce4-whiskermenu-plugin xfce4-power-manager-plugins xfce4-pulseaudio-plugin xfce4-systemload-plugin gnome-system-monitor wicd bluetooth firefox
# shutdown -r now

I love Xfce since it is not only light weight but also fully featured. On the other hand, it is true that this setup is excessive in some cases. If you are looking for a even lighter desktop, there are many other options such as LXDE, Enlightenment, Openbox additional settingsadditional settingsor JWM.

If you find xscreensaver is not for you, try installing suckless-tools to deploy slock, the “simplest” screenlock works with /usr/bin/xflock4 by default. Just uninstall xscreensaver and it will switch to slock. You can use xautolock to perform auto lock. I prefer physlock, simple and relatively friendly screenlock able to lock ttys as well. In this case you need to modify xflock4.

If you are planning to use advanced networking features such as VPN, Bluetooth PAN/DUN or 4G modem, I recommend to use NetworkManager instead of Wicd. wpa_gui (wpagui) is another option worth considering (comes with less features than Wicd though).

Localization

This is an example for Japanese locale.

# apt install fcitx fcitx-anthy fonts-takao fonts-vlgothic

Then open Fcitx config and enable Anthy input. You can also pick fcitx-kkc and/or fcitx-mozc.

You may want to deploy Source Han fonts as well.

Set locale and timezone:

# sed -i -e 's/# ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/g' /etc/locale.gen && locale-gen && update-locale LANG=ja_JP.UTF-8
# timedatectl set-timezone Asia/Tokyo

Lower swappiness

Most USB flash drive controllers don’t have wear leveling nor bad block management functionalities. For a better lifetime of flash memory, lower swappiness from 60 to 10.

# vi /etc/sysctl.d/10-swappness.conf

Drop this here:

vm.swappiness = 10

It is not good idea to set it 0 or completely disable the swap. When running out of RAM, your system will freeze and FS / NAND will suffer from more damage.

Disable SSHD

As your Frite have got a monitor and inputs, it is a good idea to disabling sshd (running by default) just in case to minimize potential risk.

# systemctl disable sshd
# systemctl stop sshd

Note: It seems iptables or ufw (netfilter) is not working on this kernel. Need more invesigation.

Do startx on login

To automatically do startx on login, add

if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
  exec startx
fi

to the last line of ~/.profile (or .bash_profile or .bash_login if you have)

Disable suspend & hibenate

Disable these unsupported operations that will cause unexpected reboots.

# systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

(Optional) Encrypting directories

Unfortunatelly ecryptfs is not supported on La Frite’s kernel so far. Userspace (FUSE-based) encryption tools are working.

I’m currently using gocryptfs on a per-directory basis.

(Optional, Not recommended) Install and enable unattended-upgrades

Realize the risk before enabling. Unattended upgrade will not always safe.

If you are super lazy, you can automate upgrade using unattended-upgrades.

# apt install unattended-upgrades
# dpkg-reconfigure unattended-upgrades

As TUI interface pops up, select “yes” to enable it.

(Optional, Not recommended) Aggressive OOM killing using earlyoom

Using earlyoom can result in data loss on running applications.

earlyoom is a lightweight daemon to watch for and kill memory hogging processes with no mercy.

# apt install earlyoom

Reboot and enjoy

Now your system is (supposed to be) ready. Just reboot and enjoy your desktop environment.

If you encountered with problem with X, try changing graphics stack (see README.php of image distributing directory).

For web browser, my favorite on single board computer is Netsurf. It’s just like a modern-day dillo — ultra light and simple. Since it is not on Bionic’s repo, you need to install Cosmic .deb of netsurf-common and nesurf-gtk manually.

にほんブログ村 IT技術ブログ Linuxへ Amazon ほしい物リスト
Pocket

コメントを残す

メールアドレスが公開されることはありません。