Pages

Sunday, 1 June 2014

Cubietruck: Ubuntu SSD install and boot from disk

Installation

  • Get the ubuntu image (you can find a list of available images here)
    curl -O http://dl.cubieboard.org/software/a20-cubietruck/lubuntu/ct-lubuntu-nand-v1.02/lubuntu-server-nand-hdmi.img.gz
    
    gzip -d lubuntu-server-nand-hdmi.img.gz
    
  • Download and install LiveSuit
    http://docs.cubieboard.org/tutorials/common/livesuit_installation_guide
  • Run LiveSuit
    • Select the Ubuntu image
    • Connect to your Cubietruck in FEL mode:
      1. Press FEL key and while holding it
      2. Plug in mini usb cable, and wait the following prompt
      3. Release FEL key
      4. When seeing the prompt, you have enter FEL mode. Select Yes to continue
  • you can login (via ssh) with username/password linaro/linaro

Move Rootfs to SSD

Prepare the drive for rootfs

Login as root
  • list all available drives
    fdisk -l
    
  • Choose the drive you want to make changes to (e.g. sda):
    fdisk /dev/sda
    
    • Delete all partitions using the “d” option
    • Create a new primary partition using the “n” option (you can accept all the defaults)
    • Use the “w” option the apply the changes.
  • Format the partition for rootfs with EXT4 filesystem
    mkfs.ext4 /dev/sda1
    

Copying Rootfs

We assume that, /dev/sda is the hard drive we want to install
mkdir /tmp/1 /tmp/target
mount /dev/nandb /tmp/1
mount /dev/sda1 /tmp/target
(cd /tmp/1; tar --backup -c *) |tar -C /tmp/target -xv
  • Changing kernel parameters in order to boot from the SSD drive
    mkdir /tmp/boot
    mount /dev/nanda /tmp/boot
    pico /tmp/boot/uEnv.txt
    
    Change the last line to:
    root=/dev/sda1
    
  • Sync to disk, and reboot to your hard drive
    sync
    reboot 
    

Optional post install

  • Remove MySQL
    sudo apt-get remove --purge mysql-server mysql-client mysql-common
    sudo apt-get autoremove
    sudo apt-get autoclean
    
  • Install extra packages
    sudo apt-get install vim htop
    
  • Upgrade Ubuntu Server
    sudo apt-get install python-apt
    sudo do-release-upgrade
    
  • Enable local discover services
    sudo apt-get install avahi-daemon
    sudo apt-get install libnss-mdns
    
    sudo pico /etc/nsswitch.conf
    
    Add mdns to the end of the following line:
    hosts:      files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns
    
    sudo /etc/init.d/avahi-daemon restart
    
  • Add a user
    sudo useradd -d /home/newuser -m newuser
    usermod -s /bin/bash newuser
    sudo passwd newuser
    
    visudo 
    
    Add the following line (second one just underneath the first one)
    root    ALL=(ALL:ALL) ALL
    newuser ALL=(ALL:ALL) ALL
    
  • Enable color prompt
    https://help.ubuntu.com/community/CustomizingBashPrompt
  • Set the correct time
    • Find your time zone
      ls /usr/share/zoneinfo
      
      Ex.: “Europe/Brussels”
    • Remove your old timezone link.
      rm /etc/localtime
      
    • Create a symlink to the appropriate timezone information.
      ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime
      
    • Second option
      pico /etc/timezone. 
      
      Replace the old timezone by yours. Ex. “Europe/Brussels"
    • Sync your local clock
      sudo apt-get install ntp
      
    • Test your setup
      date