I usually want to have the following things set in the operating environment:
Now, for the shell logins, the path adjustment already comes with the system, in the ~/.profile. And the compose key is less relevant there as I am not so likely to write anything that needs it outside the GUI -- I can do without it there.
Raspbian systems already have a convenient tool for defining this on login, even into terminal windows.
However, when I set-up this newer machine using Debian Jessie, with GUI startup using LXDE, then the path was not set, and neither was there any obvious way to get the keyboard settings into place.
Looking on the net, there were references to all sorts of different systems and files, most of which would not work.
As it turns out, there are two files that have to have things changed in them. Both of the files live somewhere in the home directory tree.
The file in question is:
~/.config/lxsession/LXDE/autostart
Adding the line
@setxkbmap -option compose:rwin
makes the right windows key into the Compose key .
The utility for showing and selecting various characters might not have been installed initially. This is gucharmap, and
apt install gucharmap
will work to enable it.
As the ~/.profile isn't being read on startup, and the ~/.bashrc file is only read on starting a shell, these files are not the ones to use. However, another file similar to these can be created. This file is ~/.xsessionrc and it can be created if it doesn't already exist.
The contents of this is similar to the relevant script in ~/.profile :
if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi
Some Debin LXDE installations only provide 1 or 2 desktop, I like to have 4 of them. To change this, and set the number of desktops, for the general case, this is in /etc/xdg/openbox/LXDE/rc.xml
In the object named <desktops> there is an object identified as <number>, which is the setting. If this value isn't 4 it can be changed to 4, for 4 desktops.
There are several other rc.xml files around, and the one here is the one being given to various users when they first start the GUI. For existing users, this file sits in ~/.config/openbox/lxde-rc.xml where the same <desktops> and <number> objects can be found.
To start with the console instead of the full desktop GUI appearing on powerup:
systemctl set-default multi-user.target
It can always be entered via startx
I like some of the default settings in vim, such as syntax coloring, but incremental search and many levels of undo are annoying. The configuration used to be .exrc files, but these removed the coloring, so there are some other places for settings, notably /etc/vim/vimrc
So adding the following in /etc/vim/vimrc worked almost right:
set background=dark set noincsearch set undolevels=0 set tabstop=4 set shiftwidth=4 set showmatch
undolevels=0 turns the many undo levels things off, tabstop=4 and shiftwidth=4 makes tabs at spacing 4, and the << and >> shifts 4 to the left or to the right. showmatch makes vim highlight matching parentheses and bracket. And background=dark makes things look good on the usual black screen background.
Except for that the incremental search stayed on no matter what. Turns out, this is enabled as long as the terminal is sufficiently responsive. This was found in the file: /usr/share/vim/vim81/defaults.vim and the cure was to comment out the section there that turned on the incremental search.
For the ll command, usually mapped to ls -l to show file dates in iso-8601 style yyyy-mm-dd, the option --time-style=long-iso exists for ls. So in the .bashrc file the alias is defined as:
alias ll='ls -l --color=auto --time-style=long-iso'
Sometimes, server programs started from /etc/rc.local won't run. This is because rc.local might be started before the networking is up. One fix is to have it wait for 10 or 20 seconds before doing anything.
Or use the systemd mechanism instead of /etc/rc.local. For the rpiinfoserv program that listens on port 11620 and allows discovering interesting and useful info from the device, then instead of:
sleep 20 /usr/local/bin/rpiinfoserv &
in /etc/rc.local, we make a file /etc/systemd/system/rpiinfoserv.service with the following contents:
[Unit] Description=Machine info server After=network.target StartLimitIntervalSec=0 [Service] Type=simple Restart=always RestartSec=1 User=hware ExecStart=/usr/local/bin/rpiinfoserv [Install] WantedBy=multi-user.target
Then do
chmod 664 /etc/systemd/system/rpiinfoserv.service systemctl start rpiinfoserv.service systemctl enable rpiinfoserv.service
Now this will start up automatically on booting, as well as re-start when or if it fails.
/etc/rc.local is the older startup. With systemd we can check if this is enabled and running:
$ systemctl | grep rc-local rc-local.service loaded active running /etc/rc.local Compatibility $
Or it might be included in the root's crontab.
@reboot /bin/sh /etc/rc.local
Don't do both, or it will run the script twice!
Compose key is a matter of selecting the desired key (right alt, menu etc.) via the menu: system/preferences/hardware/keyboard and then the tab Layouts, then the button Options... and select the Compose key settings from the list there.
The default locale settings can be put into /etc/default/locale.
Most useful is one of the UTF-8 variants, since me wanting to use the accented letters in general includes both making them with the compose key and then reading them later. In many cases, a reasonably useful locale, such as en_US.UTF-8 is being set, for the LANG= entry in particular, as this controls the way things are displayed.
The Rock64's os had no defined locale setting, so that needed to be changed.
The command locale can be used to control this.