by Lewis Loflin

arduino Raspberry Pi project

Getting Started with Raspberry Pi Linux Permissions Files

by Lewis Loflin

In this section we will install most of our software and set permissions for users. This project will have multiple sections for learning Linux and electronics. For the project main page see Build Your Own Raspberry Pi Arduino System

I tried other distributions from the free DVDs included with various Linux magazines and found a number of problems being simply slow and frustrating to work with. I did take the official Raspbian and upgraded it to a fast and lite system complete with audio and using both JWM and Openbox. Both are light weight and faster compared to the original LXDE.

The PiBang distribution for Raspberry Pi is put out by the same people as the Crunchbang Linux Desktop. This is a powerful, but lite Debian based distribution. Not only does one have access to their software repositories, but the thousands of programs available with Debian.

Debian seems to me to be the most popular being the basis of Ubuntu and many other distributions. They do have some quirks about Open Source, but when used through Ubuntu, Crunchbang, etc. that problem is bypassed.

The PiBang distribution when first operated kept the setup screen. Make sure to put in a root password such as raspberry. The keyboard is default US. Important: On the selection "boot_behavior" or going right to the desktop select no, we want to go to the command line. This can be changed later by typing "raspi-setup" (raspi-config in the official version) in the terminal window as root.

Go to finish and reboot. It will come back and enter root for user then the root PW you setup earlier. It will say something like "root@PiBang[~]:". Type startx and what will bring up is an empty black screen with a mouse pointer - right click and a small menu will appear. Here we will not use the default display manager.

A quick note on Linux files. Any file with "." in front of it is a hidden file. Many configuration and control files/folders in the home directory are hidden. In your file manager set that to display hidden files. From the command line see those hidden files and directories:

root@PiBang[~]: ls -a

If one hasn't already added in the initial setup user pi do so now:

root@PiBang[~]: adduser pi

Give the password, etc. Adding existing user pi to groups such as to sudo. Then:

root@PiBang[~]: adduser pi sudo

Now we add user pi to various groups to access USB, audio, etc.

root@PiBang[~]: adduser pi audio
root@PiBang[~]: adduser pi dialout
root@PiBang[~]: adduser pi video
root@PiBang[~]: adduser pi games
root@PiBang[~]: adduser pi netdev
root@PiBang[~]: adduser pi root
root@PiBang[~]: adduser pi users

Open this folder and add the following:

root@PiBang[~]: sudo geany /etc/sudoers

You should see the following.

# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

Add the line:

pi ALL=(ALL) NOPASSWD: ALL

Save and close geany. This gives user pi root access without having to type in a password with sudo every time. Now that we have sudo access issues out of the way let's begin build our new system.

Type reboot (enter) to reboot RPi, log back in as pi and type startx.

What to install

Update 2021: some of these may already be in your system. I'm referring to present Raspbian distributions. Some are for alternate desktops.

Welcome back. Let's update the system before we begin - do the following:

pi@PiBang[~]: sudo apt-get update

If the previous steps were done right you should not have had to give your password.

pi@PiBang[~]: sudo apt-get upgrade

Then download the following - this will take a while.

pi@PiBang[~]: sudo apt-get install arduino rox-filer roxterm dillo galculator x11-apps locate apt-file menu thunar fluxbox feh scrot openbox, obmenu viewnior

Mousepad is OK for general text files while Beaver is much better for programming. It's much more functional than leafpad and far faster and less "bloated" consuming less system resources than Geany.

Viewnior is much faster and less bloated than Gpicview and consumes one-third the system resources. In 2021 it is in the repository. We are working for a fast flexible system and still have access to the other files if needed.

RoxTerm is a great terminal program that will allow one to cut and paste, bookmark, etc. besides being lightweight and fast. This is optional and similar to LXterminal that comes installed.

Rox-filer is a fast "drop and drag" file manager used in Puppy Linux and Damn Small Linux. In addition to being a file manager it creates a "pinboard" for icons and links across the system. Rox-Filer is highly configurable and super fast, opening in less than a second.

The Rox-Filer pinboard is great for displaying icons on those window managers such as JWM, Openbox, Fluxbox that don't directly support icons. Like Rox-Filer it's a simple drop-drag solution for folders, links, and files.

Dillo is best used for fast webpage browsing and unlike MIdori that comes with both Raspberry Pi distributions opens in less than a second. This is more a utility than a serious web browser.

Raspbian comes with VLC video and audio player

As an alternative one can get Alsa Player:

pi@PiBang[~]: sudo apt-get install alsa-oss alsaplayer mpg321 alsaplayer-alsa alsa-base

To update locate:

pi@PiBang[~]: sudo updatedb

Locate replaces find in that it makes a list of file in the system for faster search. Finding the package that contains a particular file for Debian is easy. First install apt-file if one hasn't already:

pi@PiBang[~]: sudo apt-get install apt-file

Then the first time, you need to download the files index with the data for your Debian system:

pi@PiBang[~]: sudo apt-file update

Finally, you can use apt-file to find the package. For example with alsa/asoundlib.h

pi@PiBang[~]: apt-file search alsa/asoundlib.h
pi@PiBang[~]: libasound2-dev: /usr/include/alsa/asoundlib.h

That is how I located a needed file for Zmixer.

Install feh:

sudo apt-get install feh

For more information on FEH see Using FEH Wallpaper Setter, Image Viewer.

Use FEH to produce a nifty pop up image resizable within a window. Press "+" or "-" minus on your keyboard. Also drag image around within the feh window.

Download gpio2.png and save in your /home/pi/bin folder. This install on Raspberry Pi and this is where you can place your executable scripts and programs.

Open a text editor and copy/paste the code below. Save as gpio.sh /home/pi/bin directory above. Open a terminal in bin. Then make the file executable:

~ $ sudo chmod +x gpio.sh.

Now type "gpio.sh" image will pop up. Rename the file to whatever you want. This works with any image file.

Place it as an icon on your desktop.


#!/bin/sh
# some feh commands                      
# -z, --randomize
# use feh to display screen shot at reduced size
# -d draws the file name
# -g sets size to no larger than wxh or 800x600
#  -Z, --auto-zoom
# -., --scale-down
# -i, --index It creates an index print of thumb‐
# nails, printing the image name beneath each thumbnail.
feh -g 800x600 -Z.  gpio.png
exit 0

If gpio.png is not in the same directory one must use the complete path. For example if the image is in ~/Pictures:

feh -g 800x600 -Z. /home/pi/Pictures/gpio.png

Remember Linux is case sensitive.

This is a collection of programs and hardware hacks related to mainly Raspberry Pi and Debian Linux.