Install GUI-less UBUNTU: Difference between revisions

From Rsewiki
 
(49 intermediate revisions by the same user not shown)
Line 1: Line 1:
===Introduction===
===Introduction===
This guide is a guide to install UBUNTU on a robot without GUI.
This guide is a guide to install UBUNTU on a robot almost without GUI.
intended for robot operating system for SMRs


Further to install mobotware, and connect the logon and home directory to the AU server (kalman).
Basically it is installation of xubuntu 12.04 on a 4GB disk for SMRs, where the GUI (lightdm) is disabled (but available to start by root).


===UBUNTU installation===
===NB!===


Disk space of at least 4GB is needed, internet access for use during installation and a connected CD-drive for the initial boot.
RTAI installation requires patching and recompiling the kernel.
This part is postponed, to be solved by Søren Hansen


The installation follows in general the guidanve in:
===XUBUNTU installation===
https://help.ubuntu.com/community/Installation/LowMemorySystems


Make a UBUNTU 11.10 minimal from the page https://help.ubuntu.com/community/Installation/MinimalCD
Installed per default, and modified as per package list and below
Select the x86 32bit version of ubuntu 11.10 (mobotware do not support 64bit yet)


Installed with the following selections:
====remining issued (todo)====


* local user selected as "demo", do not use one you want to use over the network.
'''todo'''
* Installed on entire disk (160GB and 2GB swap - swap should later be removed and disk image reduced to 4 or 8 GB)
* Language: English (UK)
* Time: UTM with local time beeing København


When asked for packages to install, just install (i.e. no GUI):
* Test boot without WAN access
* Get small (old CRT) console to work (in text mode) at boot time
* aukeeper do not connect to MARG
* new MARG laser client should be installed
* joystick control fails (OK in rhdtest, but no control of wheels)
* test with student login (access right to camera, sound, laser - etc)
* make script to copy image to other 4GB sticks


* server basis
'''bad standings'''
* ssh server
* USB3 ports fail for Kinect
* reboot of a new cloned disk seems to fail at first boot, but OK at second boot.
* sometimes boot options do not timeout (like if a key is pressed)


Then finish and reboot.
'''done'''
* 2 kinect is OK
* ULMS server is OK
* guppi cam is OK
* MARG loads, but aukeeper do not connect
* NTP time sync is OK (to 192.38.66.1)
* switchtool work OK
* sound is OK from command-line (flite)
* MRC is running (one motor controller failed)


After reboot, the default virtual screen is 7 (the not installed GUI screen),
===installed packages===
switch to virtual screen 1 by '''Ctrl-Alt-F1''' (we will fix this later).


Login at the prompt.
Install packages like:
 
===install packages===
 
Install packages:


  sudo apt-get install cmake
  sudo apt-get install cmake
Line 43: Line 51:
Install also the following packages:
Install also the following packages:


* cmake
* cmake
* gcc
* gcc
* g++
* g++
* make
* make
* ncurses-dev
* ncurses-dev
* libraw1394-dev (used by camera server)
* libcv-dev
* libdc1394-dev (used by camera server)
* libraw1394-dev (used by camera server)
* libpng-dev (used by camera server)
* not libdc1394-dev (used by camera server)
* libexpat-dev
* isOK libpng-dev (used by camera server)
* pciutils-dev
* isOK libexpat-dev
* libreadline-dev
* pciutils-dev
* bison (used by MRC)
* libreadline-dev
* libudev-dev
* isOK bison (used by MRC)
* libv4l-dev (used by camera server)
* libudev-dev
* pkg-config
* libv4l-dev (used by camera server video 4 linux 2)
* librtai-dev
* isOK pkg-config
* subversion (to get mobotware from timmy - if you have a password)
* autofs (to mount users home-dir)
* git (to get a newer version of libusb and kinect driver)
* nis (for shared files - askes for a domain while installing)
* librtai (can be used by RHD - but strictly needed)
* isOK gdb (to be able to analyse e.g. core dumps)
* libcv-dev (installes pt opencv version 2.1)
* valgrind (to analyse for memory leaks etc.)
* libcomedi (used by analog/digital IO boards)
* apache2 (to get default web access to robot - using MARG)
* autofs (to mount users home-dir)
* isOK lsof (to track open files - also device files)
* nis (for shared files - askes for a domain - domain for kalman is 'eriks')
* ssh  (ssh server)
* gdb to be able to analyse e.g. core dumps
* sox  (to play a waw file)
* valgrind (to analyse for memory leaks etc.)
* flite (to play a text string)
* libusb-dev (mainly for kinect)
* libusb-1.0-0-dev (mainly for kinect)
* libboost-dev (for some AURS plugins)
* localepurge (maintaining only en_UK locale files)
* ntp  (to time sync clock on robot)
* vim  (line based editor)


====LIBUSB====
removed the following packages:


Download libusb (need to be a vesion newer than 1.0.0) from http://sourceforge.net/projects/libusb/files/libusb-1.0/
* firefox
* xfburn
* games (mahjongg, mine, suduko, aislerion, gnome-games)
* gimp
* thunderbird
* xchat
* parole
* gmusicbrowser
* abiword
* calender
* aspell
* gcalc
* transmission
* pidgin
* dictionary


unpack and in the unpacked directory:
(saved about 210 MB)


./configure
- installed on smr10 (xubuntu-12.04) / jca
make
sudo make install


====PCL====
====PCL====
Line 90: Line 116:
  sudo apt-get install libpcl-all
  sudo apt-get install libpcl-all


===Configure for kalman log-in===
===Configure for kalman log-in and disk share===


Copied
Copied from bode


  /etc/hosts.allow
  /etc/hosts.allow
Line 98: Line 124:
  /etc/auto.master  (NB! these auto* files must NOT be executable)
  /etc/auto.master  (NB! these auto* files must NOT be executable)
  /etc/auto.misc
  /etc/auto.misc
/etc/nsswitch.conf


from Bode
Make links for home directories (NB! do NOT: sudo mkdir /misc)
 
Make links for home directories:


  sudo ln -s /misc/vhome /vhome
  sudo ln -s /misc/vhome /vhome
  sudo ln -s /misc/shome /shome
  sudo ln -s /misc/shome /shome


After a reboot (and Ctrl-Alt-F1), it should now be possible to login using user-ID from kalman
===Limit SSH login===
 
Copied from bode
 
/etc/hosts.allow
/etc/hosts.deny
 
Edit /etc/hosts and add to the sshd line (to allow login from wired network):
,192.169.0.0/255.255.0.0
 


===Compile mobotware on new platform===
===Network setup===


The parts of mobotware that depend on openCV-highgui will not compile, so remove them from the respective Makefiles:
Wired network is set up to use 192.168.2.210 and mask 255.255.255.0 in /etc/network/interfaces:


From aurobotservers/trunk/src/Makefile edit 'apps=' list from
auto lo
# set wired network to manual IP
auto eth0
iface eth0 inet static
address 192.168.2.210
netmask 255.255.255.0


apps = auclient  auservertest  ucamserver  uclient  ulmsserver  userver 
===Environment variables===


to
The bin path for mobotware is added to /etc/environment, so that it now reads
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/smr/bin"


apps = auservertest  ucamserver  ulmsserver  userver 
The library path can not be added to /etc/environment, but is added as /etc/ld.so.conf.d/mobotware.conf as


And in aurobotservers/trunk/'''plugin'''/Makefile edit 'plugins=' list to '''remove 'audisp' '''
/usr/local/smr/lib


And in aurobotservers/trunk/'''utils'''/Makefile cange
But this do not work, so you must still add to your .bashrc file (sorry):


  APPSUBDIRS = mapoffset smrcllogtrim cameracalibrate aulogrotate \
  export LD_LIBRARY_PATH 
            barcode2d stereocalibrate utmpose2kml bayer2rgb


If you want it to look elsewhere for applications and plugins, then redefine in your .bashrc file,
e.g. if you want to add a version of mobotware in /shome/ex22/mobotware/build/bin (applications) and /shome/ex22/mobotware/build/lib (plugins), add the following lines to ./bashrc in your home directory:
# file ./bashrc
export PATH="/shome/ex22/mobotware/build/bin:$PATH"
export LD_LIBRARY_PATH="/shome/ex22/mobotware/build/lib"
===NIS start and switch===
NIS start by default, when any network is up and running, this
does not work if wireless is used.
So edit /etc/init/ypbind.conf
change
start on (started portmap ON_BOOT=
      or (started portmap ON_BOOT=y
      and ((filesystem and static-network-up) or failsafe-boot)))
to  
to  
start on (started portmap ON_BOOT=
      or (started portmap ON_BOOT=y
      and ((filesystem and net-device-up IFACE=wlan0) or failsafe-boot)))
and change 3 lines in /etc/nsswitch, add nis as first option
...
passwd:        nis compat
group:          nis compat
shadow:        nis compat
...
Reboot when both changes are in place
(if nsswitch is changed only, it is likely that login will be impossible due to long timeouts.
then use failsafe boot
====Failsafe boot====
If system fails to boot due to bad configuration,


APPSUBDIRS = mapoffset smrcllogtrim  aulogrotate \
then use failsafe boot from GRUB
            barcode2d utmpose2kml
and select root shell to recover.
 
The package should now compile? - or at least the aurobotservers
Then remount disk in rw mode:
  mount -n -o remount,rw /
 
and fix the problem


====ROS====
====ROS====


- ikke testet endnu
- ikke testet endnu
===WEB server - MARG===
With the apache server installed MARG can be active (java is not needed on this platform)
The apache server has its root in '/var/www', but to be compatible with other platforms, links are made from the /srv directory:
sudo ln -s /var/www /srv/httpd
sudo ln -s /var/www /srv/www
And a directory for the aukeeper is needed, like
sudo mkdir /var/log/keeper


===Switchtool===
===Switchtool===
Line 175: Line 265:
  sleep 1
  sleep 1


Then the switchtool (a bash script) is copied from old configuration to /usr/sbin/ - looks pt like this:
Then the switchtool (a bash script) is copied from old configuration to /usr/sbin/ - looks pt (June 2012) like this:


/usr/sbin/switchtool:
/usr/sbin/switchtool:
Line 216: Line 306:
  exit 0
  exit 0


===mangler også===


- lyd
===Text console resolution===
- test med smr og kran
 
 
* Change the GRUB resolution in /etc/default/grub to include (ref: http://idyllictux.wordpress.com/)
 
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset video=uvesafb:mode_option=640x480-16,mtrr=3,scroll=ywrap"
GRUB_CMDLINE_LINUX=""
GRUB_GFXMODE=640x480
GRUB_GFXPAYLOAD_LINUX=text
 
* further changed /etc/initramfs-tools/modules to include uvesafb by adding the following line.
 
uvesafb mode_option=640-480-16 mtrr=3 scroll=ywrap
 
* Force the use of framebuffer:
echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash
* Update and we are done
 
sudo update-grub2
sudo update-initramfs -u

Latest revision as of 12:07, 16 July 2012

Introduction

This guide is a guide to install UBUNTU on a robot almost without GUI. intended for robot operating system for SMRs

Basically it is installation of xubuntu 12.04 on a 4GB disk for SMRs, where the GUI (lightdm) is disabled (but available to start by root).

NB!

RTAI installation requires patching and recompiling the kernel. This part is postponed, to be solved by Søren Hansen

XUBUNTU installation

Installed per default, and modified as per package list and below

remining issued (todo)

todo

  • Test boot without WAN access
  • Get small (old CRT) console to work (in text mode) at boot time
  • aukeeper do not connect to MARG
  • new MARG laser client should be installed
  • joystick control fails (OK in rhdtest, but no control of wheels)
  • test with student login (access right to camera, sound, laser - etc)
  • make script to copy image to other 4GB sticks

bad standings

  • USB3 ports fail for Kinect
  • reboot of a new cloned disk seems to fail at first boot, but OK at second boot.
  • sometimes boot options do not timeout (like if a key is pressed)

done

  • 2 kinect is OK
  • ULMS server is OK
  • guppi cam is OK
  • MARG loads, but aukeeper do not connect
  • NTP time sync is OK (to 192.38.66.1)
  • switchtool work OK
  • sound is OK from command-line (flite)
  • MRC is running (one motor controller failed)

installed packages

Install packages like:

sudo apt-get install cmake

UBUNTU packages

Install also the following packages:

  • cmake
  • gcc
  • g++
  • make
  • ncurses-dev
  • libcv-dev
  • libraw1394-dev (used by camera server)
  • not libdc1394-dev (used by camera server)
  • isOK libpng-dev (used by camera server)
  • isOK libexpat-dev
  • pciutils-dev
  • libreadline-dev
  • isOK bison (used by MRC)
  • libudev-dev
  • libv4l-dev (used by camera server video 4 linux 2)
  • isOK pkg-config
  • autofs (to mount users home-dir)
  • nis (for shared files - askes for a domain while installing)
  • isOK gdb (to be able to analyse e.g. core dumps)
  • valgrind (to analyse for memory leaks etc.)
  • apache2 (to get default web access to robot - using MARG)
  • isOK lsof (to track open files - also device files)
  • ssh (ssh server)
  • sox (to play a waw file)
  • flite (to play a text string)
  • libusb-dev (mainly for kinect)
  • libusb-1.0-0-dev (mainly for kinect)
  • libboost-dev (for some AURS plugins)
  • localepurge (maintaining only en_UK locale files)
  • ntp (to time sync clock on robot)
  • vim (line based editor)

removed the following packages:

  • firefox
  • xfburn
  • games (mahjongg, mine, suduko, aislerion, gnome-games)
  • gimp
  • thunderbird
  • xchat
  • parole
  • gmusicbrowser
  • abiword
  • calender
  • aspell
  • gcalc
  • transmission
  • pidgin
  • dictionary

(saved about 210 MB)

- installed on smr10 (xubuntu-12.04) / jca

PCL

Add PCL repository to source list by adding this line to /etc/apt/sources.list

deb http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu maverick main

then get new package list and install PCL like:

sudo apt-get update
sudo apt-get install libpcl-all

Configure for kalman log-in and disk share

Copied from bode

/etc/hosts.allow
/etc/hosts.deny
/etc/auto.master  (NB! these auto* files must NOT be executable)
/etc/auto.misc

Make links for home directories (NB! do NOT: sudo mkdir /misc)

sudo ln -s /misc/vhome /vhome
sudo ln -s /misc/shome /shome

Limit SSH login

Copied from bode

/etc/hosts.allow
/etc/hosts.deny

Edit /etc/hosts and add to the sshd line (to allow login from wired network):

,192.169.0.0/255.255.0.0


Network setup

Wired network is set up to use 192.168.2.210 and mask 255.255.255.0 in /etc/network/interfaces:

auto lo
# set wired network to manual IP
auto eth0
iface eth0 inet static
address 192.168.2.210
netmask 255.255.255.0

Environment variables

The bin path for mobotware is added to /etc/environment, so that it now reads

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/smr/bin"

The library path can not be added to /etc/environment, but is added as /etc/ld.so.conf.d/mobotware.conf as

/usr/local/smr/lib

But this do not work, so you must still add to your .bashrc file (sorry):

export LD_LIBRARY_PATH  

If you want it to look elsewhere for applications and plugins, then redefine in your .bashrc file, e.g. if you want to add a version of mobotware in /shome/ex22/mobotware/build/bin (applications) and /shome/ex22/mobotware/build/lib (plugins), add the following lines to ./bashrc in your home directory:

# file ./bashrc
export PATH="/shome/ex22/mobotware/build/bin:$PATH"
export LD_LIBRARY_PATH="/shome/ex22/mobotware/build/lib"

NIS start and switch

NIS start by default, when any network is up and running, this does not work if wireless is used.

So edit /etc/init/ypbind.conf

change

start on (started portmap ON_BOOT=
      or (started portmap ON_BOOT=y
      and ((filesystem and static-network-up) or failsafe-boot)))

to

start on (started portmap ON_BOOT=
      or (started portmap ON_BOOT=y
      and ((filesystem and net-device-up IFACE=wlan0) or failsafe-boot)))

and change 3 lines in /etc/nsswitch, add nis as first option

...
passwd:         nis compat
group:          nis compat
shadow:         nis compat
...

Reboot when both changes are in place (if nsswitch is changed only, it is likely that login will be impossible due to long timeouts. then use failsafe boot

Failsafe boot

If system fails to boot due to bad configuration,

then use failsafe boot from GRUB and select root shell to recover.

Then remount disk in rw mode:

mount -n -o remount,rw /

and fix the problem

ROS

- ikke testet endnu

WEB server - MARG

With the apache server installed MARG can be active (java is not needed on this platform)

The apache server has its root in '/var/www', but to be compatible with other platforms, links are made from the /srv directory:

sudo ln -s /var/www /srv/httpd
sudo ln -s /var/www /srv/www

And a directory for the aukeeper is needed, like

sudo mkdir /var/log/keeper

Switchtool

Switchtool consist of /etc/rc.smr, and this directory holds 2 files rc.smr and rc.smr_shutdown.

These are copied from old installation:

/etc/rc.smr/rc.smr:

#!/bin/bash
/usr/local/smr/bin/rhd /usr/local/smr/bin/rhdconfig/rhdconfig.smrS1.xml&
export LD_LIBRARY_PATH="/usr/local/smr/lib:/usr/local/smr/aurs/lib"
/usr/local/smr/bin/aukeeper -a -s /usr/local/smr/bin/aursconf/aukeeper.ini > /dev/null &
cp /usr/local/smr/marg/robot.xml /srv/httpd/htdocs/robot.xml
SMRHN=`hostname`
sed -i "s/smrhost/$SMRHN/g" /srv/httpd/htdocs/robot.xml
exit 0

/etc/rc.smr/rc.smr_shutdown:

#!/bin/bash
killall -q rhd
pkill keeper
pkill ulmsserver
pkill ucamserver
pkill keeper
echo "Mobotware shutdown"
exit 0

Then /etc/rc.local should be modified to load default configuration. This is also taken from old configuration (in /etc/rc.d/rc.local), add the following lines:

/etc/rc.local:

# Set standard sound level
amixer set Master 80% unmute
amixer set PCM 80% unmute 
# start default configuration
/etc/rc.smr/rc.smr
sleep 1

Then the switchtool (a bash script) is copied from old configuration to /usr/sbin/ - looks pt (June 2012) like this:

/usr/sbin/switchtool:

#!/bin/bash
dir_name="/misc/opt/smr.${1}"
if [ -z ${1} ]; then
       if [ ! -d /usr/local/smr.net/bin ]; then
               echo "Switching impossible. Kalman /opt not found."
               exit 1
       fi
elif [ "${1}" != "local" ]; then
       if [ ! -d $dir_name/bin ]; then
               echo "Switching impossible. Path: ${dir_name} not found."
               exit 2
       fi
fi
if [ ! -x /etc/rc.smr/rc.smr_shutdown ]; then
       echo "Warning: Smr startup scripts not found. Is this a robot ?"
else
       /etc/rc.smr/rc.smr_shutdown
fi
if [ -z ${1} ]; then
       echo "Switching to production mode"
       rm -f /usr/local/smr
       ln -sf /usr/local/smr.net /usr/local/smr
elif [ "${1}" == "local" ]; then
       echo "Switching to local mode"
       rm -f /usr/local/smr
       ln -sf /usr/local/smr.local /usr/local/smr
else
       echo "Switching to ${1} mode"
       rm -f /usr/local/smr
       ln -sf $dir_name /usr/local/smr
fi
if [ -x /etc/rc.smr/rc.smr ]; then
       /etc/rc.smr/rc.smr
fi
sleep 2
echo "done"
exit 0


Text console resolution

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset video=uvesafb:mode_option=640x480-16,mtrr=3,scroll=ywrap"
GRUB_CMDLINE_LINUX=""
GRUB_GFXMODE=640x480
GRUB_GFXPAYLOAD_LINUX=text
  • further changed /etc/initramfs-tools/modules to include uvesafb by adding the following line.
uvesafb mode_option=640-480-16 mtrr=3 scroll=ywrap
  • Force the use of framebuffer:
echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash

  • Update and we are done
sudo update-grub2
sudo update-initramfs -u