ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Operating Systems

Arch Linux - Hummingboard

Updated on July 7, 2015

What is a Hummingboard

A Hummingboard is a small pc board roughly the size of a creditcard. These small pc's operate using small amounts of power, usually a couple of watts, compared to normal pc's. The best known Arm mini pc is the Raspberry Pi. The Hummingboard i2eX is a more powerful mini pc than the Raspberry Pi - it has a dual core Arm processor, 1 GB of memory, 1GB ethernet port, two usb ports, infrared, hdmi port and an msata 2 slot for adding an msata ssd to the system.

The system runs smoothly and my only gripe is that it runs really hot when you watch movies on XBMC. I have got this Raspberry Pi casing but I removed the cover because the system would get as hot as 80 degrees celsius. Now without the cover it get 50-60 degrees when I watch something on XBMC. In the near future I will buy another case with a fan attached to it to lower the temperatures. According to some people on the solid run forum this can lower the temperatures to 30 - 40 degrees.

Image Hummingboard

Hummingboard i2eX
Hummingboard i2eX

Arch Linux Installation

My goal was to have a system with xbmc on it for entertainment, but also to have it run a mailserver with Roundcube webmail so that in the future I could not only access my email on my network via imap through Thunderbird but also remotely.

Debian

My first choice was to run Debian on it. I have been managing several Debian servers and Ubuntu desktops so this is the distribution I am most experienced with. First I tried the Debian Jesse image from the solid run website which got totally messed up after doing an update of all the packages. Some systemd problems which made the system inaccessible. After that I tried the image provided by Igor found here. Although this image was a lot better I could not get xbmc to work. So I decided finally to give Arch Linux a go.

Installing Arch

First I tried installing Arch using the solidrun wiki found here. This resulted in an unusable system. Not sure why it did not boot properly. So next I tried the Arch wiki found here on the installation tab. After following all these steps you should get a bootable arch system with a root user which has the password root. Starting with a separate /boot partition would be better if you want to add an ssd later to your system. This is because you will have to copy new kernel sources to the sd card, because the sd card is needed to boot the system even with an ssd. If you have a separate boot partition you can mount it via /etc/fstab this will install the new kernel updates directly to your sd card.

Some things you might want to do after installing Arch:

Updating Arch Linux
pacman -Syu - this updates all the repositories and installs the latest packages. If you are used to Debian this is the same as "apt-get update && apt-get dist-upgrade" so a lot shorter.
pacman -Scc - this clears the cache - its like apt-get clean with Debian.

Change root password and add another user
passwd root and useradd user - I had to create the home dir manually and copy all the bash files from /etc/skel.

mkdir /home/username
cp /etc/skel/.* /home/username
chown -R username: /home/username
chmod 700 /home/username

There is probably an easier way than this with the useradd command.

You might want to disable root access via ssh - change /etc/sshd_config - PermitRootLogin no
Even better is to disable password logins and go with keys like I did.

Change from dhcp to fixed ethernet address
I followed the excellent arch wiki on networking. https://wiki.archlinux.org/index.php/Network_configuration#Static_IP_address Follow the instructions under Persistent configuration to get a fixed ip. You may also want to disable dhcp afterwards.

I created this shell script you can run to check the temperature while xbmc is running. You need to install hddtemp if you have an ssd like me. pacman -S hddtemp

vi /root/temp

#!/bin/bash
#
# check system temperature

euid="$(id -u)"

if [[ $euid -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
else
echo "CPU temp"
cat /sys/class/thermal/thermal_zone0/temp

echo -n
echo -n

# 70 C temp thermal management
echo "HDD temp"
hddtemp /dev/sda
fi

chmod +x temp to make it executable and you might want to copy or move it to /usr/local/sbin so that you can execute it as temp otherwise you have to execute it as /root/temp or ./temp in the root home folder.

After doing all these steps you will have a pretty solid Arch Linux installation. You can do some more tuning and even install an SSD to your system like I did. See the ssd section how to migrate your brand new Arch install to the ssd drive.

Installing XBMC Kodi

Installing XBMC on Arch was a breeze compared to the hoops I had to jump through with Debian. Now you can also install Kodi (latest version of xbmc - follow other step)

Install xbmc:
pacman -S xbmc-imx-git

Install Kodi
pacman -S kodi-imx

Start xbmc for the first time
systemctl start xbmc

Start kodi for first time is the same but instead of xbmc kodi:
systemctl start kodi

Enable the xbmc service so that xbmc will start when you power on
systemctl enable xbmc

systemctl enable kodi

Getting CEC to work

Add the following:
vi /etc/udev/rules.d/99-hdmi-cec.rules
KERNEL=="mxc_hdmi", SUBSYSTEM=="mxc_hdmi", GROUP="video", MODE="0666"
KERNEL=="mxc_hdmi_cec", SUBSYSTEM=="mxc_hdmi_cec", GROUP="video", MODE="0666"

Turning the tv off also shutdown Kodi (XBMC) and Arch. On my Samsung TV there's a setting that says something like turning the tv off turns also other attached devices off. Disable this if you do not want Arch to shutdown each time you turn the TV off. Which is very annoying if you use your hummingboard for more than just XBMC/Kodi.

Installing Alsa

Run the command below to install the alsa packages
pacman -S alsa-plugins alsa-utils alsaplayer alsa-tools

Backup asound.conf - mv /etc/asound.conf{,.bak}
Edit asound.conf:
vi /etc/asound.conf

pcm.!default {
type hw
card 2
}


ctl.!default {
type hw
card 2
}

Test of it works:
aplay -c 1 test.mp3
You first need to upload a test.mp3 file to your hummingboard - I used: scp test.mp3 192.168.1.8:
Change the last ip to the ip of your hummingboard.
You should hear sound coming from your tv.

Controlling XBMC

You can use your laptop or pc to control xbmc with a browser by going to http://ipofyourinstallation:8080 in my case its http://192.168.1.8:8080/
Or what I also use is the android app Yatse - you can find it in the google appstore for free. I control xbmc with my phone.


xbmc splash screen
xbmc splash screen

SSD

I bought the Crucial M500 120 GB msata ssd for my hummingboard (about 65 euros). Unfortunately the package contained smaller screws than the one I needed to attach the msata ssd to the Hummingboard. This small problem was easily fixed by unscrewing one screw from an old sata harddrive I had lying around. You will need a torx screwdriver to attach the msata tightly to the board. I followed this guide here to install the os which was on the sd card. Follow the following steps to get a working system on ssd.

  1. prepare the filesystem as root: cfdisk /dev/sda
    You can also use fdisk if you want like in the guide - I like cfdisk better. I used the whole disk so I made one big partition with the Linux filesystem. Then format your new partition: mkfs.ext4 /dev/sda1 - now you have one big Linux partition on your ssd.

  2. Next is copying all your stuff from the sd card to the ssd. The hummingboard will be using the sd card only for booting in the future and the rest is executed from the ssd. Add two directories for mounting: mkdir /tmp/source /tmp/target
    Mount sd card on source: mount /dev/mmcblk0p1 /tmp/source/
    Mount ssd on target: mount /dev/sda1 /tmp/target/
    Copy to ssd: (cd /tmp/source; tar --backup -c *) |tar -C /tmp/target -xv

  3. Final step is to change the boot parameter on the sd card so that it knows where the root file system is. I made a backup first! Incase you want to revert. cp /boot/uEnv.txt{,.bak}
    Edit uEnv.txt: vi /boot/uEnv.txt
    Change root into: root=/dev/sda1
    sync disk: sync
    Reboot: reboot

Now you have a working system that reads the first from the sd card then boots from ssd. It should be a lot faster now than before.

Important kernel updates:

When ever you get a kernel update it will be called something like this: linux-imx6-cubox-dt with a version number it is important to copy all the files to the sd card. Also Arch will give a warning that you should copy the image to the sd card. I will run you through this trivial process below:

Mount the sd card on /mnt : mount /dev/mmcblk0p1 /mnt/ - cd /mnt/boot/
Make backup of the old stuff to directory old: mkdir old then move old images to old: mv /boot/imx6* old/ - move zImage too - mv zImage old/
Now copy all the new files from the ssd /boot directory to the sd card /boot directory
cp /boot/imx6* /mnt/boot/
cp /boot/zImage /mnt/boot/zImage

Now you can reboot with your new image. You can check the image by giving the following command: uname -r which should display the latest kernel. Check package with this command: pacman -Q | grep linux-imx6

Performance Tuning

The default scheduler for Arch is bfq which is more suitable for normal harddrives. We would like to run the deadline scheduler. Here is how to change it - it should all be on two lines (i.e. the comment and the action line):

vi /etc/udev/rules.d/60-schedulers.rules
# set deadline scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"


Kodi splash screen
Kodi splash screen

Backup and restore

Making a backup of your sd card is very easy under Linux. Warning: make sure that /dev/sdb is your sd card and not your harddrive - check by using df -h to see mounted partitions! Usually sda is your first harddrive. And do not swap if with of! Run as root or use sudo like below.

sudo dd if=/dev/sdb of=arch.iso bs=1M

The backup will be the same size as your entire sd card -in my case it was 8 GB.

Restore your image back to an sd card: - Again make sure that /dev/sdb is your sd card otherwise you may destroy your Linux drive.

sudo dd if=arch.iso of=/dev/sdb bs=1M

Imap mail server

Would you like me to add a section on how to set up your own imap mail server?

See results

Arch Linux Handbook: A Simple, Lightweight Linux Handbook

Was this helpful?

See results

Comments

    0 of 8192 characters used
    Post Comment

    • booknow profile image
      Author

      booknow 2 years ago

      If you install it for the first time its better to start with a separate boot partition because it will be easier to add the sd /boot to fstab when you copy everything to your ssd.

      If you have one big partition on the sd card - like I had initially - you can either:

      - create a new partition with gparted and copy the boot files in it;

      - remove everything and copy boot files to sd card (same like one big /boot);

      - another option would be mount the one big partition ex /dev/mmcblk0p1 /mnt and then link the /boot partition to the boot subfolder on /mnt. ex.

      ln -sd /boot /mnt/boot/

      Why is it better to make two partitions?

      Because your can mount /boot separately.

      Why you think it's a bad idea to mount a partition with whole size of a sdcard (lets say 8gb) to /boot on the ssd? Because it will contain the complete filesystem (ex. /var /etc/ etc.. ) if you mount it on /boot.

      My advise is if its your first install - install directly with separate /boot or change it afterwards with gparted (very easy to use).

      Yes you can backup the ssd the same way - but remember the target needs exactly the same amount of space - a 120GB ssd means a backup of 120GB.

      Yes you can backup one partition if you want - then it will just make an image of one parition.

      With dd you need to remember that oif you have a 16GB sdcard the backup will be 16 GB. You won't be able to go to a smaller sdcard only larger - same for other media.

    • profile image

      fabiustus 2 years ago

      Hi and thanks for all this useful information.

      I already installed arch on ssd before by myself. I didn't change the scheduler though. Now i suffered a kernel panic...=/ Turns out i have to set everything up anew. I also noticed the kernel update "problem".

      Why is it better to make two partitions? Why you think it's a bad idea to mount a partition with whole size of a sdcard (lets say 8gb) to /boot on the ssd?

      And concerning backup/restore: I think i can backup the ssd in the same way as described, right? When backing up sdcard: Can i also do this with just one partition, not the whole sd card? Then one small boot partition would make sense..

      In case of a restore i then would: set up new sdcard (install ubootloader, one partition for now), dd iso of old sdcard to new sdcard. Then resize new sdcard+make second empty partition. With ssd simply dd old ssd iso to new ssd. Would this work? (im linux noob =D)

      I only know i can't dd from say 16gb sdcard iso to 8gb sdcard.

    • booknow profile image
      Author

      booknow 2 years ago

      Thank you for this update. It would be better to start with two partitions on the sd card instead of the one partition like in the arch linux install example. I will add some text so that people are informed of the benefits of starting with a serperate boot partition instead of one big partition.

    • profile image

      Tostaki 2 years ago

      You're right, this is much more efficient. Here the steps for the people interested in to follow after the reboot to enable FS on SSD.

      1/ change /boot/uEnv.txt the same way we did on SD card (root=/dev/sda1)

      nano /boot/uEnv.txt

      2/ Delete partition on sd card, the recreate 2 of them : one for /boot, the other one as free space

      fdisk /dev/mmcblk0

      - delete partition with d

      - new partition with n

      - start at block 2048

      - last sector +20M

      - create another patition if you want (n, etc...) with the available space - all default values are fine

      - write al changes with w command

      3/ format the new 20M partition

      mkfs.ext4 /dev/mmcblk0p1

      4/ Mount it to copy files

      mkdir /tmp/sdpartition1

      mount /dev/mmcblk0p1 /tmp/sdpartition1

      5/ Copy files onto this partition & unmount

      cd /boot

      cp * /tmp/sdpartition1

      sync

      umount /tmp/sdpartition1

      6/ erase /boot content

      rm *

      7/ alter fstab by adding this line

      nano /etc/fstab

      /dev/mmcblk0p1 /boot ext4 defaults,noatime 1 0

      you're done, just need to reboot. After reboot, you'll find the kernel files in /boot

    • booknow profile image
      Author

      booknow 2 years ago

      If you want to symlink a folder you will have to mount it first via fstab. I think a better idea is to have a separate /boot partition on the sd card so that you can also mount it via fstab ex. /dev/mmcblk0p1 /boot etc.. Unfortunately my install is one big partition on the sd card. To fix this I would have to make a new partition (resize existing partition and add a new one) via gparted and make it bootable instead of /dev/mmcblk0p1 and then move all the existing files in /boot to the new /boot partition. I agree the copying of the kernel is a bit of an extra hassle.

    • profile image

      Tostaki 2 years ago

      Hi,

      Thank you for all that. Just a quick question about the Kernel update. Do you think we can remove the /boot from the SSD and symlink the same folder on the sd card ? This would (perhaps) avoid the need to manually copy kernel files to sd card when updating.

      BR