CubieTruck

So my new CubieTruck has arrived in the post and its time to set it up.  The CubieTruck is very much like a Raspberry Pi except it sports a few more sockets (VGA and SATA).  A common configuration is with Lubuntu installed on a laptop size 2.5″ SATA drive without an additional power source.  This post describes the setup and update process I went through to get the CubieTruck running as a headless server using VGA video output.   The post takes the installation to the point that I could look at installing the Weewx weather station software that I use.  PS:  My main machine is a Mac.

I started by following the Cb3 Lubuntu-12.10-desktop Nand Installation V1.00 guide which required I install LiveSuit.  I also wanted to install the VGA Server version so visited the software page and downloaded lubuntu-server-nand-vga.img.gz rather than the directed link for the HDMI desktop version.  I unzipped the lubuntu download zip file in my desktop Cubie folder:

gzip -d lubuntu-server-nand-vga.img.gz

With LiveSuit opened from the applications folder I started to follow the rather vague instructions presented in the LiveSuit window which meant:

  • Finding an external power supply for the CubieTruck and powering it on.  I used an iPad power block.
  • Holding down the power button till it turned off.
  • Holding down the FEL button (next to the USB) and at the same time plugging the micro USB connection from my iMac into the CubieTruck.  (At which point a livesuit dialog box appeared on the computer screen asking about formating during the update).  I kept my finger on the FET button.
  • I persisted with the instructions and clicked the power key ten times and then released both the power key and FEL keys at the same time.  (Now I’m not sure this is require – it seems to make no difference and once the dialog described above is visible I think the process is good to go?)
  • I then clicked YES in the dialog box and a few moments later the process bar on Livesuit begins to show progress and around six minutes later the process completed and CubieTruck board lights started to flash!

Next I connected a network cable, VGA lead plus monitor and keyboard and was able to see the CubieTruck already booted into root!  I must admit to being a bit surprised that it automatically logged in as root and that SSH was not installed as default when I probably expected the opposite as per the Raspberry Pi.

Next job was to move the installation onto the 2.5″ SATA drive.  So the CubieTruck was shut down so I could connect the drive and cables.

sudo shutdown -h now

This didn’t entirely shut the CubieTruck down so I held down the power button till shut down before pulling the power cable.  The drive was already in situ so I connected the data cable and after much searching I plucked up the courage to plug in both cables to the power sockets. Now I rebooted the CubieTruck and I checked that the disk was connected with:

fdisk -l

It was mapped as expected to sda and I was able to use fdisk then to format it into a single partition.  For the next section I was basically following this YouTube video although (as mentioned by the narrator) some of the instructions had to be changed.

sudo su
mkdir /tmp/1 /tmp/target
mount /dev/nandb /tmp/1
mkfs.ext4 /dev/sda1
mount /dev/sda1 /tmp/target

Next I could copy the old rootfs from its old location to the new location.

(cd /tmp/1; tar --backup -c *) |tar -C /tmp/target -xv

Now to switch the booted rootfs from the nand version to the sda copy.  First you must mount the boot partition of the nand which is A.

mount /dev/nanda /mnt/

Next you should edit the uEnv.txt file and change the nand_root to /dev/sda1. I used Nano to achieve this but vi or pico will also work.

nano /mnt/uEnv.txt

Change the line so it looks like:

nand_root=/dev/sda1

The final steps are to sync, unmount and then reboot

sync
umount /mnt
reboot

Disable Auto Root Login

My first attempt to do this via  /bin/auto-root-login resulted in a keyboard lock out so don’t do this – it kills it.  I eventually found this comment on a Sunxi page which suggested: to get rid of annoying root autologins rename “/etc/init/openvt.conf” to “/etc/init/openvt.conf.noboot” and edit “/etc/default/autogetty” to disable tty and serial autologin

Update installation to the latest version

I wanted to update to the latest version but sudo do-release-upgrade failed with two errors.  The first error required that python-apt was installed.

sudo apt-get install python-apt

The second error related to space on the /tmp folder.  From some internet investigations I realised that the /tmp folder was mounted to tmpfs and limited to 20M.  This can be confirmed with the df command and by taking a peek at the /etc/fstab file:

df -h
more /etc/fstab

In order to overcome this for the installation I just commented out the line in fstab and rebooted the CubieTruck.   Finally I was able to issue the upgrade command. The upgrade process is best completed directly on the CubiteTruck and not via SSH.  It took around twenty minutes to complete and asked a series of questions along the way.  After the installation I uncommented the fstab entry  as there are suggested performance advantages of this approach.

sudo do-release-upgrade

Creating a new SuperUser

Next I wanted to create a new user that was part of the sudo group so I could remove the standard linaro user:

sudo adduser username
sudo usermod -a -G sudo username

Next, I checked that my new user did indeed have sudo power by logging in as them (via ssh) and using

sudo - v

Initially it returned “Sorry, user username may not run sudo on cubietruck.”  but I realised I had logged into ssh to check the add user process was OK prior to modifying the user and adding them to the sudo group so had to logout and back in again.  On the next attempt I was asked for the sudo password – success.  Now, I was able to delete the linaro user.

sudo deluser linaro

Other packages installed

  • sudo apt-get install openssh-server

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.