Install Ubuntu-13.10 beta2 ARM on Cubieboard2 from another Cubie ARM system :)

Work in progress: Following this tutorial there is still problem with automatic network dhcp and clock at boot time, until installing a full distro desktop. I still need to find the needed packages to resolve this without installing the full distro

Ubuntu 13.10 Saucy on Cubieboard2

Ubuntu 13.10 Saucy on Cubieboard2

In my case, I start from a previously installed system with u-boot and kernel, this make things easier.

We take for our example:
* /arc as archive directory
* /mnt directory where the (futur) new system will be installed.

In a console, as root user, create a directory /arc, in which you will get ubuntu-core 13.10 beta2 tarball.

sudo bash
mkdir /arc; cd /arc
wget http://cdimage.ubuntu.com/ubuntu-core/releases/13.10/beta-2/ubuntu-core-13.10-beta2-core-armhf.tar.gz

Creation of base system

We then unarchive this ubuntu core system base, and copy kernel modules, firmwares, loading modules file (for example for mali driver or if you didn’t hard linked network module(s) in the kernel). You also need to copy /etc/resolv.conf, to be able to get other packages after entering in chrooted environnement:

cd /mnt/
tar xf /arc/ubuntu-core-13.10-beta2-core-armhf.tar.gz   # désarchivage du core
cp -a /lib/{modules,firmware} lib/               # Copy kernel modules and firmwares
cp -a /etc/modules etc/
cp -a /etc/resolv.conf etc/                            # Copy resolv.conf for after chroot and before dhcp from reboot

Depending if you use static network configuration or dynamic configuration, you need to copy your interface configuration in /etc/network/interface.d/ to obtain working network after reboot…

Chrooting

Chrooting (meaning changing root) is a method to change the root system into a subdirectory of current system. Here we move to the system basis we just installed.

chroot /mnt

Configuring the new system

This stage is like the Ubuntu installation procedure.

Configure some base system details, as that’s asked in classic cd installation process:

localedef -i fr_FR -f UTF-8 fr_FR.UTF-8  # Defining the management of  french with UTF-8 encoding.
dpkg-reconfigure tzdata # Set your timezone : For example, Europe (8), Paris (35).

Then install minimum required (at least for me) packages, that was not preinstalled:

  
apt-get update    # Update repository informations an links
  
apt-get install keyboard-configuration    # For set the keyboard, depending of the one you use. Type 40 then 9 to have french one AZERTY for example.
apt-get install net-tools sudo vim adduser dialog man uuid-runtime # MINIMUM INDISPENSABLE SET (lighter vim-tiny can replace vim)
apt-get install less htop                          # Very usefull software for everyday uses.
apt-get install console-setup                   # For accessing the system using the serial console
apt-get install usbutils                            # Base USB tools
apt-get install isc-dhcp-client                  # For dynamique configuration by router or other DHCP server
apt-get install openssh-server                 # For connecting to your system from another one using SSH
      # openssh-server will return an error, because it depend on a system that will only start at reboot time.
      # You can then ignore it.
apt-get install rsync ssh-client w3m wget wget curl   # Some really usefull network clients.
apt-get upgrade  # Upgrade system packages (could be better to make this only after reboot 
                           # To have the logs of problems, else you will have alert about the unavailability of logs

Create a basic user, I choose ubuntu with ubuntu password for the example and reusable configuration, but you can choose your prefered nickname, and it is strongly advised to choose a minimal 12 characters password using a mix of alaphabetical characters, numbers and punctuation.

  
adduser ubuntu      # Create base user and, for example, use ubuntu as password
addgroup ubuntu adm   # give him administration rights
addgroup ubuntu sudo   # and ability to sudo root.

If you don’t use DHCP server for automatic configuration of this system, but instead static IP address, you should create now the network configuration file. It will been then easier to have a working system, get other packages and to connect to other system or from other system to your Cubie.

Network interfaces configuration are now in the following parsed directory, you can add a file by interface.

/etc/network/interfaces.d/

Serial port console

To have serial port consol you can add in /etc/init/, the ttyS0.conf containing the following lines:

# console - getty
#
# This service maintains a getty on console from the point the system is
# started until it is shut down again.

start on runlevel [2345]
stop on runlevel [S016]

respawn
exec /sbin/getty -8 115200 ttyS0 vt102

If you have already rebooted, you can start it to immediatly (without re-reboot) with the following command:

sudo initctl start ttyS0

Network

At this time, to activate manually network, you need to do this manually after stat. I didn’t found the good solution, I will update this post when I found the best method.

Create a file /etc/network/interfaces.d/eth0, containing the following lines (on x86 version, no interface file was needed for dynamique DHCP created interface.

The solution seems to be in

/etc/udev/rules.d/70-persistent-net.rules 

This file should contain something like the following, replace the MAC address by yours (can be see by ifconfig). This file should had been automagically created by the system. That wasn’t the case.

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="02:49:02:41:90:e1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

I installed xubuntu-desktop, that installed huge number of package at the same time, and after that it worked, the I have not 100% certitude that was not linked to a missing package

If this doesn’t work you still can do :

# interfaces(5) file used by ifup(8) and ifdown(8)
auto eth0
iface eth0 inet dhcp

To mount the interface you then need to type the following line:

sudo ifup eth0 -i /etc/network/interfaces.d/eth0

Basic audio

To activate the sound, add alsa-utils, it will install all needed package you will be able to use alsamxier:

apt-get install alsa-utils
adduser ubuntu audio


you should no be able to use alsamixer as root, still need to deconnect/reconnect user to activate its new group after this and then be able to use alsamixer and sound device with ubuntu user.

Temps !

A wrong time can cause lot of problems : Database inconsistencies, SSL certificate refused, etc… so…

sudo apt-get install ntpdate     # install ntpdate
sudo ntpdate fr.pool.ntp.org    # Synchronise on good servers near your home
hwclock --systohc --utc            # Save correct time to your internal clock

Need of a graphic desktop environment ?

If you need a graphic desktop environment, you just have to install it using

apt-get install DESKTOP

Where DESKTOP is among the few available:

Light one:
* lxde (or lubuntu-desktop) after this you can start it using lxdm start
* xfce4 (or xubuntu-desktop), after this you can start it using lightdm start

Heavy one:
* kde-standard, kde-full (or kubuntu-desktop),
* gnome or gnome-fallback (a less graphic ressource intensive version, usefull until graphic drivers are installed)
* ubuntu-desktop, using unity interface

In this case synaptic have a usefull interface to manage Ubuntu debian based packages.

sudo apt-get install synaptic

Bonus – kpartx, manage multipartition disk image

kpartx allow to loopback mount, not only a filesystem image, but a whole multipartition image, you can then accces each partition of the image as a classical partitionned disk. Very handy to partitioning update file systems on a whole µSD, NAND or harddrive image making lot of manipulation before copying it on the needed device.

Usage :

kpartx                                       # Return supported commands list
kpartx -l file.img                        # List the image partitions (the same way than fdisk -l file.img)
sudo kpartx -a file.img               # Mount image on /dev/mapper/loopX as a disk device containing partitions
sudo kpartx -a -v file.img           # Same but verbose to see the partition that are on disk and devices files associated
sudo mount /dev/mapper/loopXpY /mnt  # Mount disk X partition Y on /mnt directory
sudo umount /mnt                    # Unmount the partition
sudo kpartx -d fichier.img          # Remove the device files linked to the image
sudo kpartx -d /dev/loopX          # Same but using device file as reference (without mapper/)

Tutorial about kpartx with examples

Leave a Reply