Development environment configuration
The Raspberry Pi Desktop Linux OS distribution is the official iaiaGi Project development environment.
This document details how this environment is configured to support the iaiaGi Project developments.
When we started developing the iaiaGi Project development platform, we suddenly faced a dilemma: which software development environment to use? To make this choice, we had to consider a lot of factors, mainly related to the hardware platform and the opensource filosophy. At the beginning of the project, it was clear that developing the D-ECU (Development - Electronic Control Unit) hardware on the Raspberry Pi platform, one optimal choice could have been using a Debian based Linux distribution. At that time we were much confident with the Ubuntu distribution and we initially used that operating system. Recently, the Raspberry Pi foundation released a Debian based Linux distribution that carries the same Raspberry Pi desktop environment to the PC and Mac platforms. That news drove us to conform our development enviroment to the same Linux distribution both on the Raspberry Pi and on our PC workstations. This document describes how to configure the Raspberry Pi Desktop Linux distribution on a Intel x86 64 bit PC workstation.
This procedure has been tested with the following environment:
- Raspberry Pi Desktop OS (on an Intel x86 64 bit PC workstation):
sudo lsb_release -a [sudo] password for <user>: No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.2 (stretch) Release: 9.2 Codename: stretch
- Raspberry Pi Desktop kernel version:
sudo uname -a Linux iaiaGi-wks-01 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux
- Raspberry Pi Desktop operating system has to be installed with the default configuration on a 64 bit platform.
- The desktop PC CPU must have the VT-x functionaly, and that functionality has to be enabled in the machine BIOS. This is a requirement to support Oracle VirtualBox virtual machines (see "Configuring the desktop environment" chapter's "Install Oracle VirtualBox" bullet for the details).
To write this document we referred to the following Internet shared resources:
- Raspberry Pi Desktop Linux distribution download page 
- Change default users on Raspberry Pi - Gordon Lesti 
Configuring the desktop environment
Below are the steps to follow to initially configure the Desktop Environment:
- Wi-Fi connection: press the Network Connection tool button on the top right side of the Task Bar and choose your wireless network. Insert your wireless network passphrase when the system asks for Pre-Shared Key, then press the OK button to confirm. After some seconds, the Wi-Fi connection to your router has established.
- Disable the Auto Login: press the Raspberry Pi top left button in the Task Bar, then select Preferences and Raspberry Pi Configuration. In the Raspberry Pi Configuration dialog window under the System tab, uncheck the Auto Login: As current user option. Press the OK button to confirm.
- Change the default user: as with the Raspberry Pi Raspbian distribution, the default user of the Raspberry Pi Desktop PC Linux distribution is pi with the password raspberry. First of all create a new user by opening the Terminal through the Task Bar button in the top left corner (or press CTRL+ALT+T), and run the following commands:
pi@raspberry:~ $ sudo -i root@raspberry:~# adduser <new_user> Adding user `<new_user>' … Adding new group `<new_user>' (1001) … Adding new user `<new_user>' (1001) with group `valeriov' … Creating home directory `/home/<new_user>' … Copying files from `/etc/skel' … Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for <new_user> Enter the new value, or press ENTER for the default Full Name : New User Room Number : Work Phone : +39 123 4567890 Home Phone : +39 098 7654321 Other : Is the information correct? [Y/n] root@raspberry:~# Then add the new user to the sudo and netdev groups: root@raspberry:~# adduser <new_user> sudo Adding user `<new_user>' to group `sudo' … Adding user <new_user> to group sudo Done. root@raspberry:~# adduser <new_user> netdev Adding user `<new_user>' to group `netdev' … Adding user <new_user> to group netdev Done. root@raspberry:~#
- Reboot the operating system by pressing the Raspberry Pi applications menu in the top left corner of the Taskbar and selecting Shutdown… , then the Reboot button. Login as the new user and open a Terminal window to delete user pi:
<new_user>@raspberry:~ $ sudo deluser pi [sudo] password for <new_user>: Removing user `pi' … Warning: group `pi' has no more members. Done. <new_user>@raspberry:~ $
- Create a new root user password: in the same Terminal window of step 4 run the following commands:
<new_user>@raspberry:~ $ sudo passwd root Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully <new_user>@raspberry:~ $
- Increase the Terminal display buffer: in order to have the complete history of a Terminal session you have to run a Terminal window. Select Edit, Preferences. In the Display tab set to 100000 the Scroll-back lines option (100000 is the maximum number of lines the Terminal application can manage). Press the OK button to confirm the new parameter configuration.
- Enable seconds in the desktop clock: right click on the clock in the top right corner of the Task Bar and choose Digital Clock Settings. In the Digital Clock dialog window set the %R:%S string in the Clock Format field, then press the OK button to confirm. Now the clock shows also the seconds.
- Change the hostname: press the Raspberry Pi top left button in the Task Bar, then select Preferences and Raspberry Pi Configuration. In the Raspberry Pi Configuration dialog window under the System tab, set the Hostname: field to the workstation hostname.
- Configure system's localization: in the Raspberry Pi Configuration dialog window under the Localization tab, set the Timezone to your timezone (Europe/Rome for our team). Set the Keyboard to your layout (Italian (Winkeys) for our team), and the Wi-Fi Country to your country (IT Italy for our team). Press the OK button to confirm the new parameters configuration. When the system asks for reboot, confirm.
- Update the Raspberry Pi Desktop Linux distribution to the latest version: open a Terminal window and run the following commands:
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo rpi-update sudo apt-get autoremove
- Reboot the operating system by running:
- To to manage desktop resolution and additional displays: use the lxrandr tool. Below is an example to configure the 2560x1440 pixels resolution on an external HDMI display (HDMI-1 is the hdmi port name):
cvt 2560 1440 # 2560x1440 59.96 Hz (CVT 3.69M9) hsync: 89.52 kHz; pclk: 312.25 MHz Modeline "2560x1440_60.00" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync sudo xrandr --newmode "2560x1440" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync sudo xrandr --addmode HDMI-1 2560x1440 xrandr --output HDMI-1 --mode 2560x1440
- Then run lxrandr tool to adjust and save current display configuration:
- Install Oracle VirtualBox: in order to manage Curtis controller configuration and Kaitek BBS battery management system, we need to install their management software. Unfortunately that software is available only for Microsoft Windows systems. We solved this issue by configuring two Microsoft Windows virtual machines that run under Oracle VirtualBox (those virtual machines cannot be distributed outside iaiaGi Project because of the Microsoft Windows licenses required to activate them). There is also an issue with Raspberri Pi Desktop distribution, because it has no available implementation of Oracle VirtualBox in its repositories, so we have to install that software from the Oracle VirtualBox official Web site .
- First, download the Debian 9 ("Stretch") AMD64 Oracle VirtualBox package from this link .
- Also, download the VirtualBox <lastest_version> Oracle VM VirtualBox Extension Pack for All platforms from this link .
- Navigate to the folder where you downloaded the two software packages and double click on the Oracle VirtualBox installer, then follow the installation wizard instructions to complete the installation.
- In a Terminal window add your user to the vboxusers group:
sudo usermod -a -G vboxusers $USER
- Then verify that your user is member of the vboxusers group (it requires to reboot workstation):
- In order to properly configure the vboxdrv service we need to install amd64 kernel headers in a Terminal window:
sudo apt-get update sudo apt-get install linux-headers-amd64 linux-headers-4.9.0-5-amd64
- Then we need to reconfigure the Oracle VirtualBox services:
- Press the Raspberry Pi top left button in the Task Bar, then select System Tools and Oracle VM VirtualBox to run the application. From the Oralce VM VirtualBox Manager dialog window, select File menu, Preferences, then the Extensions tab. Press the Adds new package button on the right side of the Extensions Packages panel and navigate to the directory where you downloaded the VirtualBox <lastest_version> Oracle VM VirtualBox Extension Pack and complete its installation. Close Oracle VM VirtualBox application.
- Run again VirtualBox and import the two Microsoft Windows virtual machines from the File/Import Appliance… menu.
- Now the two Microsoft Windows virtual machines can be run to manage Curtis and Kaitek device configurations. Please, note that according to your PC workstation environment, some adjustments to the Microsoft Windows virtual machines configurations could be necessary, and that the Audio options have to be set to support Alsa Audio Driver instead of the configured PulseAudio. Also remember that to load all the new system configuration, you have to reboot the Raspberry Pi Desktop.