1 Setting up the Raspberry Pi 3 Lubuntu Operating System - PolytechAngersMecatroniqueClub/Tutorials GitHub Wiki

Setting up the Raspberry Pi 3 Lubuntu OS

Lubuntu

For the next steps of this tutorial, we will use a Lubuntu distribution for Rasperry Pi 3. The img file can be downloaded at the following link : https://ubuntu-pi-flavour-maker.org/download/ The version of the OS (Operating System) while writing this document is Lubuntu 16.04.2. After downloading the image file, install it on a SD card using the technics of your choice.

First start

When running the OS for the first time, a system configuration wizard will show up. Here are the parameters chosen:

Welcome > English
Wireless > I do not want to connect to a wi-fi network right now
Where are you? > Paris
Keyboard layout > French > alternative
Who are you? > name > IBOT
    computer's name > ibot-rasp
    username > ibot
    password > tobi
    log in automatically

Then the system should start its installation.

Once its done, you should see the Lubuntu desktop : the OS is installed for your raspberry.

Using AZERTY keyboard

It can happen (all the time?) that even with the correct previous configuration you find yourself with a QWERTY keyboard configuration when the raspberry restarts…

Open Panel Preferences

To open panel preferences just do a right click on the bottom Lubuntu bar and select “Add/Remove Panel Items” in the contextual menu.

Add the Keyboard handler

In the “Panel Preferences” menu, choose the “Panel Applets” tab and select the “+Add” button. Then select the “Keyboard Layout Handler” in the “Add plugin to panel“ window. Once done, you should see an American flag on the right bottom of your screen. It means that you keyboard as an us configuration (qwerty). To change it, do a right click on the flag, and select the “Keyboard Layout Handler Settings” item in the contextual menu. In the “keyboard layout handler” window, unselect the “keep system layouts” item. This should enable the left part of the window. Once enabled, click over the “+Add” button and select French as a new possible keyboard layouts. Now you will be able to change the keyboard configuration. If you do not want the qwerty version (and so the keyboard will be azerty even when rebooting the pi) you can remove the us layout by selecting it and clicking on the “-remove” button. You can now close the window and enjoy the azerty keyboard.

Connect to eduroam WiFi network

To see all the available wifi network, you can do a left click on the “Indicator applet” (wifi icon on the bottom right). If the eduroam network does not appears in the list, make shure that there is an eduroam network nearby and restart the raspberry.

Once trying to connect to the eduroam network, the “WiFi Network Authentication Required” window should appear. On the “Authentication” item chose “LEAP”. The window should redraw and now you should have to text fields : Username and Password. Just enter your university data (as when connecting to your ent) and this should do the trick, now the raspberry should be connected to eduroam.

Open a terminal

In the later, we will use the terminal to execute most of our commands. To open a LXTerminal window:

Lubuntu button > System Tools > LXTerminal

You should have a window with the following:

ibot@ibot-rasp:~$

In the later, to ease the writing, this line will be notified as

$

### Open a terminal in a directory

When a directory is opened with the File Manager PCManFM (with the graphical user interface), pressing the F4 button will open a Terminal in this directory.

Adding a terminal to the launch bar

It can be handful to have a terminal shortcut at the left bottom of the screen (with the File Manager, Web Browser shortcuts). To do that, start the Panel Preferences window (right click and add/remove panels items) and select the “Application Launch Bar” in the “Panel Applets/Currently loaded plugins” list. Then click over the “Preferences” button. A new “Application Launch Bar” window should appear. In the “Installed Applications” select “System Tools/LXTerminal” and click on the “+Add” button. Now the green square icon of the Terminal should appear on the bottom left of your screen.

Activate the SSH service

To be able to remotely be connected to the Raspberry it is needed to enable the ssh service, which is not done by default. To activate the ssh service when the raspberry start, use this command

$ sudo update-rc.d ssh enable && invoke-rc.d ssh start

and reboot the raspberry

$ sudo reboot

To test is the ssh service is started, try to connect to the raspberry from the raspberry (useful just for the test, useless otherwise…) with the command:

$ ssh ibot@localhost

you should have a message asking if you are sure, say yes, and then enter the password (still tobi), and congratulation, you are connected to the raspberry pi…

The good news is that you can do the same thing with an other computer, by changing “localhost” by the raspberry IP address in the command.

Issues while trying to connect from an other computer

If you are sure that the ssh service is enabled on the raspberry (previous commands) but you can not remotely connect to it, it may be because the computer and the raspberry are not on the same network.

To test if you are on the same network as the raspberry, try to ping the raspberry with the command

$ ping 192.168.0.2

with 192.168.0.2 the IP of the raspberry (change with your raspberry IP of course…). This should display several messages like

64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.487 ms
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.250 ms
... 

otherwise, you need to connect the computer and the raspberry over the same network...

Finding the Raspberry IP address

To know the raspberry IP address, use the command

$ ifconfig

This command displays the network configuration of your raspberry.

Connecting the raspberry to an old screen

It can happened that the Raspberry screen will not show up while connecting the Raspberry to an old screen (with VGA-HDMI converter for instance). To avoid that and have your Raspberry desktop displayed over most of the screens, you can change the hdmi settings by editing the /boot/config.txt file. To do that, open the file in editing mode with nano:

$ sudo nano /boot/config.txt

and at the end of the file, add the following:

disable_overscan=0
hdmi_force_hotplug=1
hdmi_group=2
hdmi_drive=2
overscan_left=20
overscan_right=20
overscan_top=20
overscan_bottom=20

use Ctrl+X > Y > Enter, to exit and save the modifications.

Note that if you want to modify this file on an other computer (using the sd card), you can find it on the root of the boot partition (and not in the boot folder).

Using gedit text editor

Install gedit

When programming using a text editor, I find gedit more friendly than leafdap (the default text editor). To install gedit, enter the command

$ sudo apt-get update
$ sudo apt-get install gedit

Gedit will use syntactical coloration base on the opened file extension.

Some useful custom parameters

#### Display the line numbers

To activate the line numbers in gedit go to

Edit > Preferences > Display line numbers

Insert spaces instead of tabulation

I often rather like to add spaces instead of tabulation when programming. To do that with gedit, go to

Edit > Preferences > Editor > Tab width : 4
Edit > Preferences > Editor > Insert spaces instead of tabs

Highlight the current line

To highlight the current line (the line with the cursor), go to

Edit > Preferences > Highlight current line

Display white spacesheader-includes:

When programming I also like to display the white spaces (see tabulations, spaces…). To do that with gedit, you need to install gedit plugins by doing

$ sudo apt-get update
$ sudo apt-get install gedit-plugins

Once the plugins are installed, in gedit, do:

Edit > Preferences > Plugins > Draw Spaces

Then you should see a gray point for spaces and arrows for tabulations.

Using the Raspberry Pi3 as a WiFi Access Point

The following steps are from

https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/

This can be useful if you want to connect to your raspberry without any WiFi router.

Packages installation

First you need to install hostpad (package that allows you to use the built in WiFi as an access point), and dnsmasq (a combined DHCP and DNS server that's very easy to configure). To install those packages:

$ sudo apt-get update
$ sudo apt-get install dnsmasq hostapd

You may need to reboot

$ sudo reboot

Configurations

Here are the contents of the configuration files you need to modify in order to make it works. Do not forget to reboot the raspberry pi after that.

/etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

# The loopback network interface
auto lo
iface lo inet loopback

# for the CAN configuration, not needed for only the wifi hotspot
auto can0
iface can0 inet manual
	pre-up /sbin/ip link set can0 type can bitrate 500000
	up /sbin/ifconfig can0 up
	down /sbin/ifconfig can0 down

# for the wifi hotspot
allow-hotplug wlan0
iface wlan0 inet static
	address 192.168.49.1
	netmask 255.255.0.0
	network 192.168.0.0
	broadcast 192.168.255.255

/etc/hostapd/hostapd.conf

Note that this file may not exist, you may need to create it.

# This is the name of the WiFi ibnterface to use
interface=wlan0

# use the nl80211 driver with the brcmfmac driver
driver=nl80211

# This is the name of the network - CHANGE THE VALUE HERE!
ssid=IBOT_BOHORT

# use the 2.4GHz band
hw_mode=g

# Use channel 1
channel=6

# accept all MAC addresses
macaddr_acl=0

# Use wpa authentification
auth_algs=1

# use wpa2
wpa=2

# use a pre-shared key
wpa_key_mgmt=WPA-PSK

# the network passphrase
wpa_passphrase=WIFI_TOBI

# use AES, instead of TKIP
rsn_pairwise=CCMP
wpa_pairwise=CCMP

/etc/init.d/hostapd

change the line

DAEMON_CONF=

to

DAEMON_CONF=/etc/hostapd/hostapd.conf

/etc/default/hostapd

change the line

#DAEMON_CONF=""

to

DAEMON_CONF="/etc/hostapd/hostapd.conf"

/etc/dnsmasq.conf

You may want to save the original file by doing

$ sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.back

Then remove the content of dnsmasq.conf to just have

interface=wlan0
dhcp-range=192.168.0.2,192.168.0.10,255.255.0.0,12h

Then reboot the pi by doing

$ sudo reboot

Some usefull tools

To control the raspberry memory and computing health

You can install htop, wich is a programm that display the used RAM memory, processors and list the running processus:

$ sudo apt-get install htop

To use htop just do

$ htop