You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
3.5 KiB

---
title: Raspberry Pi
date: 2023-11-25T09:14:35+01:00
#lastmod:
#showDate: false
showReadingTime: false
showWordCount: false
showPagination: false
#showAuthor: false
showBreadcrumbs: true
feed_exclude: true
# site_exclude: true
draft: true
---
## Raspberry Pi 4
4GB version, if that information is of any use.
### No network after boot
Sometimes I make mistakes in my initial `wpa_supplicant.conf` file (that I'd place on
the boot partition of the new Raspberry Pi SDcard). Recently my `wpa_supplicant.conf`
file was totally messed up (a bracket too much I think).
So there is a quick way to connect to a WiFi network with the use of `nmcli` (NetworkManager).
~~~console
$ sudo nmcli device wifi connect [ssid] password [password]
~~~
You can view networks with (no need for _sudo_):
~~~console
$ nmcli device wifi list
~~~
### Moving to testing (from bookworm)
Why would you want to do that in the first place? Well, most
packages on debian _stable_ are quite old -- hence the name _stable_.
If you need newer packages, you should consider moving to the _testing_
branch. I moved my Raspberry Pi 4 to _testing_ because of the starship
prompt that I use on my computers -- it needed a newer version of the
`rustc` package.
First of all, upgrade to the latest packages.
~~~console
$ sudo apt update && sudo apt upgrade
~~~
Now change the release name (e.g. `bookworm`) to `testing` in `/etc/apt/sources.list`:
~~~
deb http://deb.debian.org/debian testing main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security/ testing-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian testing-updates main contrib non-free non-free-firmware
~~~
Then update step by step.
~~~console
$ sudo apt update
$ sudo apt upgrade
~~~
> Restart services during package upgrades without asking?
Answer with <kbd>Yes</kbd>.
Finish the update:
~~~console
$ sudo apt full-upgrade
$ sudo reboot
~~~
### Python 3
#### Installing non-packaged modules
I could not find `aprslib` as a package, so I had to install this myself.
Debian did not allow the installation as it did before, so I had to create
a virtual environment. And it went like this:
~~~console
$ python -m venv ~/.env
$ source ~/.env/bin/activate
$ pip install aprslib
$ deactivate
~~~
I now have a similar line in my crontab:
~~~crontab
3 * * * * /home/dominic/.env/bin/python /home/dominic/bin/aprs_sendstatus.py
~~~
We could also create virtual environments per application, module, package etc.
<https://www.raspberrypi.com/documentation/computers/os.html#python-on-raspberry-pi>
## Raspberry Pi 3
## Raspberry Pi 2
## Raspberry Pi Pico W
### Using MicroPython
<https://micropython.org/download/RPI_PICO_W/>
I did the dumb thing and made the `boot.py` file break which led to an endless
loop showing me only the Error code and restarting...
I was able to stop the script by quickly pressing <kbd>CTRL+D</kbd>,
<kbd>CTRL+C</kbd> on the serial console but never was able to update the broken
file without it doing a soft-reboot which loads `boot.py` again instantly...
After some research I was glad I found [pico-nuke](https://github.com/polhenarejos/pico-nuke/releases).
Boot into uf2 loading (pressing BOOTSEL while power on) and place the correct .uf
file (`pico_nuke_pico_w-1.1.uf2`) on the mounted device.
On OpenBSD there is no response but you can see the filesystem unmounted/removed.
Unplug the USB and plug it in again booting into uf2 loading, copying over the
MicroPython uf2 file again.