Skip to main content
Raspberry Pi

Raspberry Pi #

Fresh Install #

  1. Install raspberry-pi-imager on macOS.

  2. Plug in a microSD card, and flash Raspberry Pi OS.

  3. Add a file called ssh (no extension, no contents) to the top folder.

  4. Add a file called wpa_supplicant.conf with:

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=DE
    
    network={
        ssid="wifi-name"
        psk="password"
        key_mgmt=WPA-PSK
    }
    
  5. Plug the microSD to Raspberry Pi, connect to power cable.

  6. Run ssh to the Pi with ssh pi@192.168.0.105 (the IP address may differ).

    • The initial password is raspberry.
    • The pre-install text editor is nano.

When connected to a screen, Pi will prompt to upgrade stuff. Don’t do it (press skip).

Use VNC Environment for Remote Desktop #

Reference: How to Use IOS Devices As a Monitor of Raspberry Pi : 6 Steps (with Pictures) - Instructables

  • SSH to the Pi.
  • Run $ sudo apt-get install tightvncserver
  • Run $ tightvncserver
  • Note down the port (1 for example)
  • On a machine with screen, connect to the server (192.168.0.105:1 for example)

For auto-start at booting, add the following to $ nano ~/.bashrc

if [ -x "$(command -v tightvncserver)" ]; then tightvncserver; fi

Do the stuff from iPad:

How To… #

  • See OS info: $ cat /etc/os-release

  • Reboot: $ sudo reboot

  • Shutdown: $ sudo halt

  • See list of running processes by uptime: $ ps -aux --sort -time

  • SSH without a password:

    $ ssh-copy-id pi@192.168.0.105
    # Number of key(s) added:        1
    
    # Now try logging into the machine, with:   "ssh 'pi@192.168.0.105'"
    # and check to make sure that only the key(s) you wanted were added.
    $ ssh pi@192.168.0.105
    

Troubleshooting #

reason is APT is installing or removing packages #

Try in sequence:

$ sudo apt-get clean

# if that returned error
$ sudo killall apt-get
$ sudo rm /var/lib/apt/lists/lock
$ sudo rm /var/cache/apt/archives/lock
$ sudo rm /var/lib/dpkg/lock
$ sudo apt-get clean

Something 2 #

$ sudo rm /var/lib/dpkg/lock
$ sudo dpkg --configure -a

Cannot SSH after re-installation #

If see this on local machine:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Try this:

$ ssh-keygen -R "<ip of server>" # 192.168.0.105, for example