From iaiaGi Wiki
Jump to: navigation, search

This document contains configuration, optimization and other notes regarding the Raspberry Pi Desktop 2.2 Linux distribution.


This document is a collection of notes that describe all the configuration optimizations we did during the everyday use of the Raspberry Pi Desktop 2.2 distribution when working on the D-ECU software development.


This document 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 valeriov: 
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.3 (stretch)
Release:	9.3
Codename:	stretch
  • Raspberry Pi Desktop kernel version:
sudo uname -a
Linux Apple-iMac-RPi 4.9.0-5-amd64 #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04) x86_64 GNU/Linux
  • Raspberry Pi Desktop environment should be configured according to this document [1].


To write this document we referred to the following Internet shared resources:

  1. How to fix missing dirmngr - SLEEPLESSBESTIE'S NOTES [2].
  2. GitHub - Flash OS images to SD cards & USB drives, safely and easily [3].
  3. How to backup your Raspberry Pi SD card, or copy it to another (larger?) Raspberry Pi SD card - Tech Sparx [4].
  4. bash:tip_colors_and_formatting - FLOZz' MISC [5].


Fixing missing dirmngr

When the operating system is first installed, when trying to add a new repository key, it can happen that you receive the following message:

user@iaiaGi-wks-01:~ $ sudo apt-key adv --keyserver hkp:// --recv-keys 379CE192D401AB61
Executing: /tmp/apt-key-gpghome.ATNN3VSTHX/ --keyserver hkp:// --recv-keys 379CE192D401AB61
gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.ATNN3VSTHX/S.dirmngr' failed: No such file or directory
gpg: keyserver receive failed: No dirmngr

and the new repository key is not loaded into the system. To fix this issue run the following command:

sudo apt-get install dirmngr --install-recommends

This command installs all the dirmngr recommended components, while the Raspberry Pi Desktop 2.2 distribution comes with a minimal installation of dirmngr.

Installing Etcher SD card copier

In order to easily create images of the D-ECU SD card configuration, it is usefull to install the Etcher graphic tool:

echo "deb stable etcher" | sudo tee /etc/apt/sources.list.d/etcher.list
sudo apt-key adv --keyserver hkp:// --recv-keys 379CE192D401AB61
sudo apt-get update
sudo apt-get install etcher-electron

After installation, Etcher is available under the Raspberry Pi Applications/Accessories menu.

In case you need to uninstall Etcher:

sudo apt-get remove etcher-electron
sudo rm /etc/apt/sources.list.d/etcher.list
sudo apt-get update

How to backup a Raspberry Pi SD card and migrate to a larger one

In order to make a backup copy of a Raspberry Pi SD card verify how it is mounted in the Raspberry Pi Desktop system:

sda      8:0    0  100G  0 disk 
├─sda1   8:1    0   92G  0 part /
├─sda2   8:2    0    1K  0 part 
└─sda5   8:5    0    8G  0 part [SWAP]
sdb      8:16   0  1.8T  0 disk 
└─sdb1   8:17   0  1.8T  0 part /media/valeriov/Toshiba_2GB
sdc      8:32   1 57.7G  0 disk 
├─sdc1   8:33   1 41.8M  0 part /media/valeriov/boot
└─sdc2   8:34   1 57.7G  0 part /media/valeriov/037616fd-28fe-4652-8248-2042ea30b929

Then use the dd command to generate a SD card image on the Raspberry Pi Desktop PC:

sudo dd if=/dev/sdc of=/<absolute_path_to_backup_dir>/d-ecu_v.<version>_<aaaammdd>.img bs=1M status=progress

To copy the backup image to a new SD card you have two options:

1. you can use the dd command:
sudo dd bs=4M if=/<absolute_path_to_backup_dir>/d-ecu_v.<version>_<aaaammdd>.img of=/dev/sdc status=progress
2. you can use the Etcher graphic tool.

How to improve Terminal shell root prompt

Change the content of the .bashrc file under the /root directory with the text below:

# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)

# set a fancy prompt (non-colour, unless we know we "want" colour)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;

# uncomment for a coloured prompt if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)


if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;33m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
unset color_prompt force_color_prompt

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

For more details consult this document [6].

How to configure Terminal window size

If you need to start every Terminal window with a specific number of rows and columns, open a Terminal window and select Edit/Preferences menu. Select Display tab and set Default window size to your preferred number of columns and rows.