Install Ubuntu as dual boot
Author(s): Ferry Schoenmakers, Koen Meessen (TechUnited), edited by Jordy Senden (MSD)
This document describes how to install Ubuntu 16.04 and all the software needed to make a working DevPC. For the MSD project it is not necessary to make a DevPC, only to install Ubuntu, Matlab, Eclipse and some other packages which might come in handy. In the remainder of this guide it is assumed that the username at the Ubuntu partition is robocup. For the MSL project this might not be necessary, but for simplicity (to not change to much from this tutorial) lets just use the username: robocup. Since we are not making DevPCs, the computer name is not relevant. In the remainder of this guide you will see a lot of lines with robocup@devpcX:~$ (when opening a terminal) this will be different for you if you have chosen a different computer name.
Install Ubuntu 16.04 64 bits
Verify that your computer has a cpu with 64bit architecture, since the DevPC setup is a 64bit one. In principle you should be able to make your own TU/e laptop a DevPC. The installation of Ubuntu 16.04 64 bit is straightforward and explained on numerous websites. If you only want your computer to run Ubuntu, simply make a startup disk or usb-drive and install Ubuntu by booting from it and follow on screen instructions. More detailed information is listed here: Install Ubuntu 16.04
If you want to install Ubuntu 16.04 next to your existing Windows installation so that you can choose which OS to boot each time you turn on your pc, please follow the next link. Be aware that a clean install of Ubuntu with full checkout of the repository needs about 45GB. When you want to make a dual boot installation, make sure the root partition of Ubuntu is larger than 45GB. Ubuntu 16.04 dual boot with windows
If you do not get a OS selection screen at boot after installing Ubuntu next to your existing OS look into this: Boot-Repair
To change the boot order to Windows 10, check out this instruction to change boot order.
During the installation process a few questions are asked. Make sure you enter the following details:
- username: robocup
- password: *******
- computer's name: devpc# (where # is a number below 20 which has to be unique if you want to connect with the turtles (contact Patrick for a unique devpc number), it does not have to be unique for simulation purposes)(MSD: just put a name here for now. It need not be devpc)
NOTE: In case you have already installed Ubuntu 16.04 but used a different computer name you can change it by editing /etc/hosts and /etc/hostname (reboot before proceeding). Changing your hostname is required to be able to run the simulator:
robocup@??:~$ sudo apt install gksu robocup@??:~$ gksudo gedit /etc/hostname /etc/hosts
Ubuntu configuration and package installation
Note: for several commands an internet connection is required. At this point your Wifi is still working and you can connect to the TU/e wireless network, or simply plugin an ethernet cable. To enable wifi and connect to the tue network, check out Connect to tue-wpa2
After installation you want to apply the following changes to the system:
- allow for sudo without entering password
robocup@devpcX:~$ sudo visudo
add
robocup ALL=NOPASSWD: ALL
at the end of the file. Close the terminal editor with Ctrl+X, press y to accept changes and enter to verify.
Install correct version of gcc
Install gcc 4.7 for MATLAB compatibility In a terminal execute:
robocup@devpcX:~$ sudo apt-get install gcc-4.7 g++-4.7
- make gcc-4.7 the default gcc compiler
In a terminal execute:
robocup@devpcX:~$ cd /usr/bin; sudo ln -sf /usr/bin/gcc-4.7 /usr/bin/gcc; sudo ln -sf /usr/bin/g++-4.7 /usr/bin/g++
Install required packages
In a terminal execute:
robocup@devpcX:~$ sudo apt-get install libjson0 libjson0-dev eclipse eclipse-cdt cmake flex glade automake openssh-server libcv-dev libcvaux-dev robocup@devpcX:~$ sudo apt-get install libhighgui-dev ffmpeg libusb-1.0-0-dev bison cmake valgrind ccache gconf-editor nfs-common zlib1g-dev openjdk-8-jre-headless libpng12-dev libjson0-dev gksu robocup@devpcX:~$ sudo apt-get install libsdl-image1.2 cpufrequtils libssl-dev
Install Subversion 1.9
In a terminal execute:
robocup@devpcX:~$ sudo apt-get update robocup@devpcX:~$ sudo apt-get install subversion
Install smartSVN
See Download and install SmartSVN to install SMartSVN and checkout the TechUnited svn repository. Note: The current SmartSVN version requires jre toolkit 1.8.0.
Install MATLAB
See Matlab R2016a installation.
Configure Devpc for trc and simulator
The AGENT variable has to be set to let the software know which devpc you are. This can be done automatically.
robocup@devpcX:~$ gksudo gedit /root/.bashrc /home/robocup/.bashrc
Copy-paste the following lines to the bottom of the two opened files in gedit:
if [ -f /home/robocup/svn/trunk/src/Turtle2/Tools/scripts/General/bashrc_devpc ]; then . /home/robocup/svn/trunk/src/Turtle2/Tools/scripts/General/bashrc_devpc fi
Install Tech United software
Finally see if everything succeeded. Launch matlab as root:
robocup@devpcX:~$ sudo su root@devpcX:/home/robocup# matlab
Browse to the Libs directory: '/home/robocup/svn/trunk/src/Turtle2/Libs' and in the command window execute (you may have to chmod 777 the file to make it executable):
>> !./buildlibs_once
Then run in matlab
>> addpathrobocup >> savepath
Followed by a well known:
>> make_all_install >> build_all
Finish
That should be it! If everything worked out well you should be really happy now and you can open your well deserved refreshing beer! If something went wrong, still open it, and don't start to cry immediately. First contact Ferry, Koen or Patrick to see if we can help fixing it..
For MSD, this should be it for now.
If you have a dual boot system and want Windows to be the default OS, do:
robocup@devpcX:~$ grep menuentry /boot/grub/grub.cfg
Find your windows partition, for instance: "Windows 10 (loader) (on /dev/sda1)" copy this from the terminal. Next open the /etc/default/grub file
robocup@devpcX:~$ sudo nano -B /etc/default/grub
and replace GRUB_DEFAULT=saved with your partition, for instance GRUB_DEFAULT="Windows 10 (loader) (on /dev/sda1)". Close with ctrl+x and update grub:
robocup@devpcX:~$ sudo update-grub
Advanced, for connecting to Turtles
Rename your wired and wireless interfaces
robocup@devpcX:~$ sudo gedit /etc/udev/rules.d/70-persistent-net.rules
Since this file does not exist yet, it will request to create a new file. Add two lines to the file:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="YOUR WIRED HWAddress", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0" SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="YOUR WIRELESS HWAddress", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth1"
You can find the HWAdressess by :
robocup@devpcX:~$ ifconfig
Reboot necessary after doing this!
- create the /etc/Robocup directory by executing in a terminal:
robocup@devpcX:~$ sudo mkdir /etc/Robocup
To connect to the robocup network for the first time, after you've obtained your devpc number from Patrick, make sure to take the following steps:
- Make sure you're logged in as user 'robocup'
- Make sure you're computer name is 'devpcX' with X the number Patrick assigned to you. In case you are already using a different pc name you are able to change it by editing /etc/hosts and /etc/hostname (reboot after doing so).
- In ../Turtle2/Tools/scripts/general/Robocup/macs, replace the wired and wireless mac address by the ones corresponding to your pc and commit this change to svn. After taking the before mentioned steps, your wireless device name is eth1.
- Run copy_scripts in ../Turtle2/Tools/scripts
- Run the rc.local script in /etc (on some pc's this script will hang at the 'stop network-manager', in case this is happening just manually stop the network manager 'sudo stop network-manager' and remove 'stop network-manager' from the script)
- In /home/robocup/.ssh/ and in /root/.ssh/ edit permissions of all files such that only 'robocup' has read and write access to them. All other groups/users should have access permissions 'none'
You're done! You should now be able to enter the robocup network by running the robocup_network script from /etc/Robocup.
Note: Standard, the network manager is closed so that the Wifi will only communicate to the robocup_network. You can still use the Wifi for internet if you're not connecting to Turtles by executing in a terminal:
robocup@devpcX:~$ sudo service network-manager start
Remember to shut it down again before connecting to turtles! Do this by executing:
robocup@devpcX:~$ sudo service network-manager stop
Optional: Editor for TRC GUI
The TRC GUI is based on the Gtk 2.0 framework. This framework has been replaced by its successor Gtk 3.0, and is getting more and more deprecated. A first sign of this is that the UI editor Glade for GTK 2.0 can no longer be installed in Ubuntu 16.04. Because Rewriting the TRC for Gtk 3.0 would take a considerable amount of time without adding any new functionality. Therefore, manually compiling Glade for Gtk 2.0 from source is a suitable containment.
To get the source code, download it by clicking here: Glade-3.8.5.
In Nautilus, right-click the tarball file and extract it.
Install required packages
robocup@devpcX:~$ sudo apt install intltool libxml2-dev
Go to the directory to which you extracted the source code and configure the installer:
robocup@devpcX:~$ ./configure
Compile the program
robocup@devpcX:~$ ./make
Install the program
robocup@devpcX:~$ ./make install
Update the linker database
robocup@devpcX:~$ sudo ldconfig
Create a symbolic link
robocup@devpcX:~$ sudo ln -sf /usr/local/bin/glade-3 /usr/bin/glade-3.8
You can now start the editor by entering
robocup@devpcX:~$ glade-3.8
Optional: switch to old layout
Install the old Ununtu desktop. The newer version of Ubuntu has a launcher bar on the left side of the screen. If you don't like this 'Unity' layout you can go back to the old layout ('Gnome'). Open a terminal and execute:
sudo apt-get install gnome-session-flashback
Now, to finalize switching back to gnome, please click on the icon top right of the screen and click logout. Next click the footprint icon next to robocup and select: GNOME FLASHBACK (METACITY) (No effects).
- (Optional) if you want to have the close/minimize/maximize windows back on the top right of your window open a terminal and execute (NOT AS A ROOT, so no sudo!)
robocup@devpcX:~$ gsettings set org.gnome.desktop.wm.preferences button-layout :minimize,maximize,close
- (Optional) as you've maybe already noticed, everytime you shutdown a terminal while you were root, the system asks you if you really want to do this. To remove this warning do the following:
Execute in a terminal (NOT as root):
robocup@devpcX:~$ gsettings set org.gnome.Terminal.Legacy.Settings confirm-close false
- (Optional) If you're using the Gnome panel, instead of Unity, some launchers exist for frequently used robocup actions like turning the network-manager on or of, starting matlab as a root user, running the robocup network script etc... Have a look at /home/robocup/svn/trunk/dev/Ferry/Launchers and simply drag the .desktop files of the launchers you would like to have to the top-panel. Click the launcher icon while pressing ALT to move the launcher, change its icon by choosing 'properties' and clicking on the icon that appears in the pop-up window.