Installing Raspberry Pi OS Lite + Openbox on a Raspberry Pi
Prep
-
Format SD card using SD Card Formatter
-
Burn image to SD Card using balenaEtcher
-
Create and copy wpa_supplicant.conf and ssh files to SD (usually called boot after flash)
- ssh file is just an empty file titled "ssh". Create thusly:
$: touch ssh
- wpa_supplicant.conf is a file with:
# Update your country
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
# Put your network name in the ssid (in the quotes), and the
# password in the psk (in the quotes).
network={
ssid=""
psk=""
}
-
Insert the SD card into the Pi and power on.
-
If you don't have a monitor & keyboard & mouse set up, you need to ssh into the Pi
- Give it a few minutes or so to run its initial boot process.
- Check your router (Or whatever tools you use) to find the IP address of your Pi
- (Mac) Open a Terminal and ssh into the Pi
$: ssh pi@192.168.X.X
(replacing the Xs with the appropriate numbers)
- The default password is
raspberry (We'll change this later)
- On Windows you need to use Putty to ssh into a linux system. It's been a hot minute since i used Putty so look it up yourself.
- Expand the file system to full SD card:
$: sudo raspi-config
- Advanced Options...
- Expand File System
- OK
- Finish (The Pi will reboot)
- Update System
- When rebooted, ssh in and update the system:
$: sudo apt update && sudo apt upgrade && sudo apt autoclean
- Update localizations:
$: sudo raspi-config
- Localization Options...
- Set Local, Timezone, Keyboard and WLAN
- Finish > Reboot
- Install Xorg
- Install Openbox and terminal
$: sudo apt install openbox lxterminal
- Install login manager to automatically start Openbox and log you in
$: sudo apt install lightdm
- Finish Setting up Pi
Pi should now boot right into the empty Openbox system.
If VNC cannot show desktop do step 13, otherwise carry on to 14
- Update the
config.txt
$: sudo nano /boot/config.txt
- uncomment and update to:
hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=85
dtparam=i2c_arm=on
dtparam=spi=on
- Add the following under the [all] section
enable_uart=1
start_x=1
gpu_mem=128
- Update
.bashrc
- If you have things you like in your
.bashrc, update them now
- You can do this later if you want to use copy/paste
- (You need to install a clipboard manager to copy/paste)
- Here are mine if they interest you:
- Set up Openbox Configuration
- Right-click for menu
- click ObConf (should be in right-click menu)
- Theme: Nightmare-02 (Or whatever you like)
- Appearance:
- Active window title: DejaVu Sans Bold 8
- Inactive window title: DejaVu Sans Bold 8
- Menu header: DejaVu Sans Bold 9
- Menu Item: DejaVu Sans Book 9
- Active On-screen disp: DejaVu Sans Bold 9
- Inactive On-Screen di: DejaVu Sans Bold 9
- Or whatever you like
- Desktops
- Number of desktops: 1 (Or however many you want. I like one)
- Rename it
- Close
- Install obmenu and set up menu
$: sudo apt install obmenu
$: obmenu
- Openbox 3 (My preferred items. You do your own.)
- Terminal emulator
- /Debian Menu
- separator
- Applications
- separator
- ObConf
- Save & Close
- Install some things:
-
Install a file manager (one, the other, or both):
$: sudo apt install thunar
or
$: sudo apt install pcmanfm
-
Install a clipboard app:
$: sudo apt install parcellite
-
Install feh for wallpaper/background color (if you use Thunar)
$: sudo apt install feh
-
Install Tint2 (panel app)
$: sudo apt install tint2
- Create and update openbox autostart script
-
Change directories to the .config directory
$: cd .config
-
If openbox directory doesn't exist, make it
$: mkdir openbox
-
create autostart.sh file in openbox directory
$: touch autostart.sh
-
The autostart script should exist here now:
~/.config/openbox/autostart.sh
-
edit to add items to autostart.sh
$: nano autostart.sh
# Autostart installed apps in Openbox
# File Manager (if Thunar) + run in background and automount drives
thunar --daemon &
# File Manager (if pcmanfm) + run in background and automount drives
pcmanfm --desktop &
# Clipboard Manager
exec parcellite &
# Panel
(sleep 1 && tint2) &
# Wallpaper
- (We will add the wallpaper command to
autostart.sh later. We need this preliminary setup to get the VNC file transfer working, and other things like copy/paste)
- Reboot
$: sudo reboot now
- It should reboot into an openbox with a default panel, and the things you set up in the
autostart.sh script
- If you used
pcmanfm, right-click the desktop, and under Advanced select "Show menus provided by window manager menu when desktop is clicked." This will bring back the Openbox Right-click menu.
- If you used pcmanfm, feel free to remove trash from desktop because i don't want anything on my desktop.
- Set up Tint2
-
transfer noise_TransparentPanel_top.tint2rc to the Pi via VNC file transfer, and import. (Or set up a new configuration)
File: noise_TransparentPanel_top.tint2rc
-
Right-click menu > Applications > Settings > Tint2Settings
or
$: tint2conf
-
Import the noise_TransparentPanel_top.tint2rc file into Tint2
- Theme > Import theme...
- Browse to where VNC transferred the file to (usually either
Desktop or Downloads) and import it.
-
The theme should appear in the Tint2Settings manager.
- Click on it
- Click the
Make Default button.
-
A copy of the noise_TransparentPanel_top.tint2rc is now in the ~/.config/tint2/ directory, so you can remove the one you transferred
$: rm Downloads/noise_TransparentPanel_top.tint2rc
*or*
$: rm Desktop/noise_TransparentPanel_top.tint2rc
- Fix Screen Resolution
-
Using either raspi-config or /boot/config.txt, fix any screen resolution issues you may have.
-
Play with either the framebuffer_width & framebuffer_height, or the hdmi_mode & hdmi_group. The width and height would be to directly set the resolution. The mode and group will set a standardized resolution explained here.
-
If you have those uncommented and it still refuses to give the correct screen resolution over VNC and you're on a Pi 4, in the /boot/config.txt comment out:
dtoverlay=vc4-fkms-v3d
- If you're using
Thunar, you need to set up feh to run your wallpaper or background color. (pcmanfm manages background color and wallpaper)
-
Either transfer an image over VNC with the same resolution as your screen to the Pi, or create an image in Photoshop/Gimp/etc. with that resolution. Fill it with the background color you want. (The background color is essentially just a jpg, png, tiff, or gif of made of that color.)
-
using feh, open the image:
$: feh --bg-scale “/path/to/image.jpg”
-
Now that you've opened the image in feh, it stores its name in a file called .fehbg, so you can add that to your autostart.sh file:
$: cd .config/openbox
$: nano autostart.sh
- Add wallpaper under the comment from before:
# wallpaper
$HOME/.fehbg &
- When you restart it will make the file store in
.fehbg your wallpaper
- Right-click Menu item icons and launch commands
- Out of the box, some applications won't launch their applications and others don't have the any icons. Here's how we fix that.
- You can find the
.desktop files that control menu items here:
~/usr/share/applications/
- cd into that directory and run ls to see what's in there
cd /usr/share/applications
$: ls
It should show a list of all the `.desktop` files for your installed applications in the Right-click Menu.
-
Right-click on the desktop and find an application without an icon
-
Open a second terminal window
-
Search the Pi's file structure for the program's icons:
$: sudo find / -name appname*png
So, for example, if i'm looking for the LXTerminal icons:
$: sudo find / -name lxterm*png
It should give a bunch of results like:
/usr/share/icons/PiX/48x48/apps/lxterminal.png
/usr/share/icons/hicolor/128x128/apps/lxterminal.png
Pick whichever one you see fit: highlight that line in the terminal by double-clicking the line, and then copy using `right-click > copy`
(control-c/control-v can be a bit sketchy in VNC inside terminal)
-
In the first terminal window with the .desktop file open, find the
line that starts with Icon
- search with
control-w
- type "icon"
- press enter
- it should take you to the icon line
-
Delete what Icon is pointing to, and replace it by right-click-pasting the path to the .png file you copied from the other terminal window
Icon=lxterminal
becomes:
Icon=/usr/share/icons/hicolor/128x128/apps/lxterminal.png
-
control-o saves in nano
-
control-x exits nano
-
Right-click and see that the application now has an icon.
-
Go through the Right-click menu applications and try to run them. Some will not run. They'll often throw an error like:
Failed to execute child process "evte" (No such file or directory)
This happens either because it's calling the wrong command, or trying to run the command in a terminal window.
-
Open the .desktop file and control-w to search for "exec"
-
In a second terminal window, try running the command. If the program runs, you know the .desktop file has the right command, so the problem isn't the Exec= line.
-
Look for a line li