XRDP revisited

Stretch november version:

1. Add stretch-backports to sources.list

Create:   sudo nano /etc/apt/sources.list.d/backports.list
Add:      deb http://ftp.debian.org/debian stretch-backports main

Update:   sudo apt-get update

Ignore complaints about not signed

2. XRDP is in stretch-backports

Use apt or apt-get, need to install with the -t option.
Answer Y to install without verification.

sudo apt-get -t stretch-backports install xrdp

Ignore complaints about not verified

 

3. Shutdown menu not working:

You can get the Buttons working, just change the line ‘Logout=lxde-pi-shutdown-helper’ to ‘Logout=gksudo lxde-pi-shutdown-helper’
in ‘/home/pi/.config/lxpanel/LXDE-pi/config’.

 

3. Raspi config tool:

In order to run ‘Raspberry PI Configuration’ tool and others that need ‘sudo’ to run in Remote GUI, insert X authorization of ‘xhost’ for ‘root’ in:
/home/pi/.config/lxsession/LXDE-pi/autostart –> Insert ‘@xhost si:localuser:root’ as last line.”

If no file named autostart at this folder location use nano to create it and then add the line ‘@xhost si:localuser:root’ and save the file.

 

 

Shutdown Raspbian with a button

he simplest way to set up a “pushbutton to shut down” is to add “dtoverlay=gpio-shutdown” to /boot/config.txt and rig a NO momentary contact switch across pins 5 and 6. Push once to shut down the system. Push again to reboot it.

dtoverlay=gpio-shutdown,gpio_pin=3

To avoid I2c being unusable:GPIO26 is physical pin 37
dtoverlay=gpio-shutdown,gpio_pin=26

pi@raspberrypi:~ $ dtoverlay -h gpio-shutdown
Name:   gpio-shutdown

Info:   Initiates a shutdown when GPIO pin changes. The given GPIO pin
        is configured as an input key that generates KEY_POWER events.
        This event is handled by systemd-logind by initiating a
        shutdown. Systemd versions older than 225 need an udev rule
        enable listening to the input device:

                ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \
                        SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \
                        ATTRS{keys}=="116", TAG+="power-switch"

        This overlay only handles shutdown. After shutdown, the system
        can be powered up again by driving GPIO3 low. The default
        configuration uses GPIO3 with a pullup, so if you connect a
        button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
        you get a shutdown and power-up button.

Usage:  dtoverlay=gpio-shutdown,=

Params: gpio_pin                GPIO pin to trigger on (default 3)

        active_low              When this is 1 (active low), a falling
                                edge generates a key down event and a
                                rising edge generates a key up event.
                                When this is 0 (active high), this is
                                reversed. The default is 1 (active low).

        gpio_pull               Desired pull-up/down state (off, down, up)
                                Default is "up".

                                Note that the default pin (GPIO3) has an
                                external pullup.
The default GPIO is 3 (which appears on pin 5 of the 40-pin header). The pin is configured to pull high by default (which is also the SoC's default), and the GPIO is marked as active low (the opposite to the pull, for obvious reasons).

If you are having trouble, you can debug using raspi-gpio on Raspbian. Assuming for now that the overlay applied correctly (lsmod should show gpio-keys as being loaded), raspi-gpio get 3 will show the pin level (which should be 1) and function (INPUT). Now run it in a loop:

pi@raspberrypi:~ $ while true; do raspi-gpio get 3; done
Attach one end of a patch lead to pin 5 (GPIO3), and touch the other end on pin 6 (GND) - the Pi should shut down immediately, but if not you will see the pin level change to 0.
post

Ultibo installation

 

 

 

Windows

1. Install from distribution on ultibo.org
2. Next rebuild RTL to latest and greatest version
– download sources
– download from github
– extract in {location}
– Lazarus tools Build Ultibo

Raspberry Pi

The next stepts, including the IDE (Lazarus for Ultibo) work file from the RPi console or over a XRDP or VNC connection.

Use the ultibo installer script, initially and to update to the latest and greatest version of Ultibo on github.

1. Copy the installer script over to the Pi, in the user pi home directory.

wget https://github.com/ultibohub/Tools/releases/download/1.0.5/ultiboinstaller.sh

2. Make the script executable

chmod +X ultiboinstaller.sh

2. Install dependencies (only needed on a fresh system)
Do the next steps in superuser mode. Convenient and otherwise it fails on an XRDP session

sudo su
apt-get update
apt-get upgrade

apt-get install -y libgtk2.0-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libatk1.0-dev libghc-x11-dev
apt-get install -y libx11-dev libgdk-pixbuf2.0-dev  gir1.2-coglpango-1.0  xorg-dev
apt-get install -y binutils-arm-none-eabi 

3. Increase swapfile

Because the Raspberry Pi only has 1024MB of memory at most, installation on Raspbian requires a swap file size of at least 1000MB, anything less may result in an error while building Lazarus.

nano /etc/dphys-swapfile

Edit the CONF_SWAPSIZE value to be 1000 or greater

sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start
ls -lh /var
exit

And check that the file “swap” is now the size specified above

5. Now run script in user mod, the ‘exit’ in step 3 takes care of that. Takes a while!

6. After completion

Change swap back to 100, see step 3, in superuser mode!

The Lazarus IDE will now show up in Programming on the desktop.

Headless setup Raspbian

From the rapsberri Pi forum written by Hawaiianpi

Most local network use WPA2-PSK (AES), and this is the procedure used here for setting up headless boot with SSH and wireless network. It works with Raspbian Jessie or Stretch, Desktop or Lite, and with the built-in WiFi on the Pi3B(+), Pi Zero W, or a Raspbian compatible USB WiFi dongle on other models. Everything is done before you boot, and can be done on a Windows or Mac computer which only has access to the small FAT32 “boot” partition of a Raspbian imaged SD card.

Grab the latest Raspbian image from https://www.raspberrypi.org/downloads/raspbian/
Grab the Etcher software from https://etcher.io/
Install Etcher and use it to write the Raspbian image to your SD card.
You don’t need to extract the image or format the card prior to writing.
Just run Etcher, choose the Raspbian .zip you downloaded, pick your SD card and write.
If you have trouble, verify the SHA256 checksum of the download.

Writing an image to your card will erase everything previously on it!

Remove and reinsert the SD card so that your Windows or Mac PC can see the small FAT32 partition on the card (labelled “boot”).
If you get a message telling you the card must be formatted, cancel it.

On that small FAT32 partition, create a file with the name ssh (or ssh.txt). It can be empty, the contents don’t matter.

To connect to a wireless network, create another file on the card called wpa_supplicant.conf, which has the following inside:


ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
ssid="Your network name/SSID"
psk="Your WPA/WPA2 security key"
key_mgmt=WPA-PSK
}

Edit country=, ssid= and psk= with your information and save the file.
Use the 2 letter country abbreviation in CAPS (without this you will have no WiFi).
Use a pure text editor like Notepad++, not a word processor, to edit the wpa_supplicant.conf file.

Make sure that both files are in the main directory of the small FAT32 partition, not in any folder.

Safely eject the card from your PC and use it to boot the Pi.

If Raspbian finds an ssh file it will enable SSH and delete the file.

If it finds a wpa_supplicant.conf file, it will move it to its correct location and connect to your wireless network. Give your Pi some time to boot and connect to your network (the first boot always takes longer), then you should be able to SSH into the Pi and configure it how you like.

If you have a Zeroconf network service installed (Apple’s iTunes or Bonjour install Zeroconf), you can SSH into pi@raspberrypi.local (provided you don’t have any other Pi computers on your network with the same default hostname). Otherwise you must SSH into your Pi’s IP address, which you can find by logging into your router and checking the list of connected clients, or using a network scanner app (like Fing for smartphones cor Advanedc IP scanner).

To login using SSH from Windows, you can use an app called PuTTY.

In the Host Name (or IP address) field, enter either,
Code: Select all

pi@raspberrypi.local
or
pi@your.pi.IP.address
make sure SSH is selected (it should be by default) and click on Open.

If you have done everything correctly, a terminal window will open and you should see a password request. Although, if it’s the first time you’ve connected to your Pi, you may have to answer “yes” to a security question, and then you’ll get the password prompt. After login you’ll get a warning about having SSH enabled with the default password, so type passwd[Enter] and enter a new password (twice). And now you can do whatever you need to configure your little Raspberry Pi computer.

sudo raspi-config

Will bring up the Raspbian configuration utility. If you have more than one Raspberry Pi computer on your network it’s a good idea to change the hostnames to something unique so that they can easily be identified.

Note: If you have attempted this and failed, then unplugged power to turn off your Pi, you should start over with a freshly imaged card. Improperly powering down the Pi can cause SSH key generation to fail, which will prevent SSH logins (even if everything else is correct).

Install Ultibo on Stretch

On a new build of RaspBian 2017-09-07-raspbian-stretch.zip

sudo apt-get install libgtk2.0-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libatk1.0-dev libghc-x11-dev
sudo apt-get install binutils-arm-none-eabi
sudo apt-get install gcc-arm-none-eabi
dpkg -l | wc
1403 14260 197899
Edit the CONF_SWAPSIZE value to be 1000 or greater
./ultiboinstaller.sh

On Ubutu 16.04
The following 2 cmds
cd ultibo/core
./startlazarus