Skip to content

Aquatic Drone's Initial Configurations

Vasco Craveiro Costa edited this page Jul 3, 2015 · 14 revisions

1 - Launch raspberry configuration tool using sudo raspi-config (in case it is the first boot of the OS, the configuration tool will be shown automatically) and make the following configurations:

  • Expand filesystem
  • Internationalization Options
  • Locale en_US.UTF-8 UTF-8
  • Time zone: Europe > Lisbon
  • Keyboard Layout: choose Generic 105-keys (intl) PC>Other>Portuguese>Portuguese (or change GB to PT in /etc/default/keyboard file, using vi, nano, vim or any other kind of editor - do not forget sudo!)
  • Overclock set to High (High option for Raspberry B/B+ and PI2 option for Raspberry 2)
  • Advanced Options
  • Set the desired hostname (biomachines-XX in our case, where XX is the drone's number)
  • Enable SSH server
  • Configure only 16MB of memory for the GPU (memory split)
  • Enable loading of I2C kernel module on boot
  • Disable the login shell accessibility over serial (by other words, select option "No" on the serial menu)

2 - Reboot Raspberry Pi (sudo reboot). If any error appears related to a non-set LOCALE, LANGUAGE or LC_ALL, add the following to /etc/default/locale (using nano,vi or other editor):

LANGUAGE=en_US:en
LC_ALL=en_US.UTF-8

And if keyboard layout is not in correct, edit /etc/default/keyboard, changing XKBLAYOUT="gb" to XKBLAYOUT="pt".

3 - Delete unnecessary files:

cd ~ && rm -rf python_games

4 - Install needed applications:

sudo apt-get update && sudo apt-get install -y screen deborphan i2c-tools

5 - [DEPRECATED STEP] Remove unnecessary applications (go make a mug of coffee, this will take awhile....):

sudo apt-get remove --yes --purge --auto-remove libx11-.* ^libx ^python3 ^aptitude libraspberrypi-doc xkb-data fonts-freefont-ttf luajit omxplayer penguinspuzzle gnome-themes-standard* menu-xdg console-setup* desktop-file-utils* gsfonts* gsfonts-x11* libgnome-keyring0* libgtk-3-common* libgtk2.0-common* libjavascriptcoregtk-3.0-0* libqt4-xml* libqtcore4* libqtdbus4* libsoup-gnome2.4-1* libxcb-glx0* libxcb-render0* libxcb-shape0* libxcb-shm0* libxcb-util0* libxcb1* libxfont1* lxde-icon-theme* omxplayer* shared-mime-info* x11-common* xdg-utils* gcc-4\.[0-5].* samba-common smbclient strace traceroute ^vim raspberrypi-artwork sgml-base xml-core fonts-.* ^sane openresolv
sudo apt-get remove --yes --purge --auto-remove $(deborphan)
sudo apt-get remove --yes --purge --auto-remove deborphan

6 - Update System

sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove && sudo apt-get -y autoclean

7 - You can also limit the log's quantity and size by making some slightly modifications to /etc/logrotate.conf file, so the first lines become something like:

# see "man logrotate" for details
# rotate log files weekly
daily

# keep 7 days worth of backlogs
rotate 7

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
compress

8 - You can also change the /etc/rsyslog.conf in order to produce less quantity of logs (probabily is better to make a backup of the original file using sudo cp /etc/rsyslog.conf /etc/rsyslog.conf.backup). The final content can be something like:

#  /etc/rsyslog.conf    Configuration file for rsyslog.

$ModLoad imuxsock # provides support for local system logging
$ModLoad imklog   # provides kernel logging support

# To enable high precision timestamps, comment out the following line.
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# Set the default permissions for all log files.
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022

# Where to place spool and state files
$WorkDirectory /var/spool/rsyslog

# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf

# First some standard log files.  Log by facility.
*.*;auth,authpriv.none          -/var/log/syslog
daemon.*                        -/var/log/daemon.log
kern.*                          -/var/log/kern.log

# Some "catch-all" log files.
*.=debug;\
        auth,authpriv.none;\
        news.none;mail.none     -/var/log/debug

9 - The file /etc/logrotate.d/rsyslog can also suffer some changes, ending up like shown bellow (probabily is better to make a backup of the original file using sudo cp /etc/logrotate.d/rsyslog /etc/logrotate.d/rsyslog.backup) :

/var/log/syslog
{
        rotate 7
        daily
        missingok
        notifempty
        delaycompress
        compress
        postrotate
                invoke-rc.d rsyslog rotate > /dev/null
        endscript
}

/var/log/daemon.log
/var/log/kern.log
/var/log/debug

10 - In order to decrease log growth and increase boot velocity, change the system loglevel to 4 (KERN_WARNING) by addind loglevel=4 on /boot/cmdline.txt, after rootfstype=ext4.

Reference