No Comments

Running Raspberry Pi OS on a RPI Zero without SD card

{}
January 2nd, 2021

I’ve blogged before about how to boot a Raspberry Pi Zero over USB without an SD card, just powering it with an USB cable in the middle USB connector, and connecting at the same time.

This Christmas I tried it with a new Buster version and a trusty old Raspberry Pi Zero and following the tutorial it’s still running fine with the latest Raspberry Pi OS 2020-12-02-raspios-buster-armhf-lite.img.

Time for some improvements. Updating and upgrading was always possible, but not always successful: you could easily run into disk-space problems.

Default images are shipped/downloaded as small as possible and the default action of booting a Pi with a new image is resizing the root partition to claim all available space on the SD card.

We’re mounting over NFS and of course the resizing did not happen in our case. Luckily, otherwise your guest OS would end up with no space and the Pi would have a partition size of 1GB (or so).

But for upgrades we need more space than the default.

How to increase the image size of an mounted image over NFS?

The image I have downloaded is `2020-12-02-raspios-buster-armhf-lite.zip`, and we have to follow 4 simple steps.

Step 1: unpack it:

unzip 2020-12-02-raspios-buster-armhf-lite.zip 2020-12-02-raspios-buster-armhf-lite.img

Step 2: resize raw image:

Then use qemu-img (QEMU disk image utility) to resize the raw image.

sudo qemu-img resize 2020-12-02-raspios-buster-armhf-lite.img 3G

Here we resize it to 3G, that must be enough to install some extra programs, and download and install updates.

Step 3: set it up as loop device:

sudo losetup -P /dev/loop101 2020-12-02-raspios-buster-armhf-lite.img

These day I set it up as loop101 instead of loop0 as I did in the blogpost of 2018 to avoid conflicting loop devices. Snaps are also installed as loop devices.

Step 4: resize root partition

start gparted with the loop device to resize the root partition.

sudo gparted /dev/loop101

Normally gparted never shows loop devices, but it does when you explicitly start with a loop device.

Then simply push the slider to resize the image, and apply the changes and you’ve gained 900MB of disk-space.

More than enough to do updates and upgrades for years to come.

No Comments

Using a Logitech G203 mouse under Linux

December 4th, 2020

Both the Logitech G203 Prodigy and the newer Logitech G203 Lightsync are affordable gaming mouses that have a normal size, a small lag, nice sensors, and also suitable for general use.

The mouse has six buttons, and by default the the fourth and fifth thumb buttons are defined as back and forward buttons, that come in hand browsing the web. I’m not sure what the sixth is by default, but it can easily set up to switch or cycle resolution.

But how to control the RGB lighting, the buttons and the resolution under Linux / Ubuntu?

Configuring the Logitech G203 mouse

You have to do the following to get the mouse working under Ubuntu 20.04:

Install the ratbagd system daemon to introspect and modify configurable mice:

sudo apt install ratbagd

Install the GUI Piper, that is available as flatpak:


flatpak install flathub org.freedesktop.Piper

The G203 Lightsync is a relative new mouse, the ID is still missing from the definitions shipped with ratbagd, so we have to add that manually.

To find the ID:

lsusb
Bus 003 Device 002: ID 046d:c092 Logitech, Inc. G203 LIGHTSYNC Gaming Mouse

Edit usr/share/libratbag/logitech-g102-g203.device


sudo vi usr/share/libratbag/logitech-g102-g203.device
DeviceMatch=usb:046d:c084;usb:046d:c092

Restart the ratbagd daemon:

sudo systemctl restart ratbagd.service 

Run Piper, and the GUI will start, so you can set resolution, buttons and RGB effects.

Configuring the Logitech G203 mouse under Ubuntu with Piper

Configuring the Logitech G203 mouse under Ubuntu with Piper

The proper SVG image is still missing though.

No Comments

Text with pattern the new way

October 4th, 2020

In the past the only way to to get colored text, like from an image or gradient was to use SVG.

Nowadays pure CSS is enough.

Although a prefix with -webkit- is still needed for Safari and Blink browsers.

.post-2027 h1{
background-image: linear-gradient(
90deg,
#7383c1 0%,
#bed876 50%,
#e0b384 100%
);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
width:max-content;
}
1 Comment

Why the upgrade from Ubuntu 18.04 LTS to Ubuntu 20.04 LTS is not available yet.

September 9th, 2020

Linux users of the Ubuntu 18.04 LTS (Long Term Support) are still waiting to upgrade their systems to 20.04. Normally at around the time the first point release of the new LTS distribution is released.

What is a point release?

These point releases include support for new hardware as well as rolling up all the updates published in that series to date. So a fresh install of a point release will work on newer hardware and will also not require a big download of additional updates. These include security updates and corrections for other high-impact bugs, with a focus on maintaining stability and compatibility with Ubuntu 20.04 LTS.

And 20.04.1 was released on August 6. But the problem is: not all flaws have been ironed out yet in 20.04.1. So at the moment you can’t be confident to get a smooth upgrade from 18.04 LTS. That’s why the upgrade is not yet available. Yes you can get a smooth install, but not a smooth upgrade.

Upgrade blocking bugs for 20.04

There are 2 blocking issues at the moment, and they must be solved first:

  1. eoan to focal upgrade hangs when lvm snapshot is present (bug 1876506) resolved
  2. grub-pc upgrade support (bug 1891680)

Here you can track the release status.

If you wanna take the risk, you can always force a upgrade with:

do-release-upgrade -d
No Comments

Getting the date right in Javascript in your language of choice

August 20th, 2020

The Internationalization API provides language number formatting, string comparison, and date/time formatting in Javascript. It’s a global object.

Intl.DateTimeFormat('en-GB',
{
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
weekday: 'long',
era: 'long',
year: 'numeric' ,
month: 'long',
timeZoneName: 'long',
hour12: false
}).format()

What is the time today?

No Comments

Fixing HifiBerry and Raspberry Pi sound after update

June 19th, 2020

I updated my Raspberry Pi 4 which I use for playing music with the great, free and open source MPD server.

After reboot it stopped playing music. ;(

The cause was this update in May/June 2020, due to a change in audio configuration. MPD was still working but the sound was now not routed through the HifiBerry soundcard, but through the audio/headphones, simply because a new HW card was defined: headphones/analog audio out.

The solution was easy.

aplay -l shows the Hifiberry the third card instead of the second, the new headphones was now the second.

 $ aplay -l
**** List of PLAYBACK Hardware Devices **** 
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1] 
Subdevices: 4/4 
Subdevice #0: subdevice #0 
Subdevice #1: subdevice #1 
Subdevice #2: subdevice #2 
Subdevice #3: subdevice #3 
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones] 
Subdevices: 4/4 
Subdevice #0: subdevice #0 
Subdevice #1: subdevice #1 
Subdevice #2: subdevice #2 
Subdevice #3: subdevice #3 
card 2: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
Subdevices: 0/1 
Subdevice #0: subdevice #0

All I had to do is to edit /etc/asound.conf and increase 1 to 2:

pcm.!default {
type hw card 2
}
ctl.!default {
type hw card 2
}

Restart MPD and everything was working like before. 😉

sudo systemctl restart mpd