Saturday, 31 October 2020

Building a Raspberry Pi 4 laptop

I was watching a lot of YouTube videos where people gave Raspberry Pi 4 a try as their primary PC. I got tempted myself but lacking a desk I had to explore the options of building a laptop based on Raspberry Pi 4. I have done a similar test with my Samsung 10-inch tablet in a Bluetooth keyboard case but as it still runs Android Nougat and has 1G of memory only the experience is really slow. The most important match to find was a Bluetooth keyboard case with a monitor. As a pointing device with a computer, the touchpad was a necessity on the keyboard too. In terms of size I was aiming at 10-inch again and found a reasonable match on Amazon:

10-inch monitor

Bluetooth keyboard and touchpad case

I managed to tie my Raspberry Pi and a big 20,000 mAh power bank to the case and used short USB power and HDMI cables to connect it all. 


The overall experience is pretty reasonable on Raspberry Pi OS. Unfortunately Bluetooth is not stable on Ubuntu desktop yet. YouTube in Chromium browser is playing without a noticable drop of frames up to 720p but even 1080p60 is watchable. Email and chat are widely supported with the exception of the Outlook desktop experience and WhatsApp Web. Lack of built in microphone makes it more difficult to test voice calls but even with a USB sound card the result is dubious. Telegram desktop does not recognise the USB sound card and Messenger from Chromium does not provide stable voice calls either. With some hacking even Netflix and Amazon Prime are running fine in Chromium. As the monitor has a second HDMI input the other use case that I am trying is Samsung Dex from my Galaxy S10. First try with a USB-C to HDMI adapter was quite reasonable also however not all apps are working fine. Netflix and BBC iPlayer are notable examples of apps that are not functioning correctly. To minimise the cableing I have a Miracast dongle shipping that I plan to test soon.

Saturday, 10 October 2020

[Updated] Removing quiet and splash options from command line of Debian RPD live USB with persistence

The excuse to remove quiet and splash options from the kernel command line of my Debian RPD live USB with persistence was the tty consoles did not reliably setup increased font size with dpkg-reconfigure console-setup on bootup. I have found xorriso and its alter ego osirrox to extract grub.cfg, remove the quiet and splash options and write it over back in the ISO image.

pi@raspberrypi:~ $ osirrox -dev Downloads/2020-02-12-rpd-x86-buster.iso
-extract boot/grub/grub.cfg grub.cfg
xorriso 1.5.0 : RockRidge filesystem manipulator, libburnia project.
xorriso : NOTE : Loading ISO image tree from LBA 0
xorriso : UPDATE : 5398 nodes read in 1 seconds
xorriso : NOTE : Detected El-Torito boot information which currently is set to be discarded
Drive current: -dev 'Downloads/2020-02-12-rpd-x86-buster.iso'
Media current: stdio file, overwriteable
Media status : is written , is appendable
Boot record : El Torito , MBR isohybrid cyl-align-on GPT APM
Media summary: 1 session, 1527416 data blocks, 2983m data, 521m free
Volume id : 'Debian RPD M-A 1'
xorriso : UPDATE : 1 files restored ( 1828b) in 1 seconds = 0.0xD
Extracted from ISO image: file '/boot/grub/grub.cfg'='/home/pi/grub.cfg'
pi@raspberrypi:~ $ chmod +w grub.cfg
pi@raspberrypi:~ $ nano grub.cfg
pi@raspberrypi:~ $ chmod -w grub.cfg
pi@raspberrypi:~ $ xorriso -indev 2020-02-12-rpd-x86-buster.iso /
-outdev 2020-02-12-rpd-x86-buster-mod.iso /
-map '/home/pi/grub.cfg' '/boot/grub/grub.cfg' /
-overwrite nondir /
-boot_image any keep /
-close off /
-write_type auto /
-stream_recording data /
-commit
xorriso : UPDATE : 5398 nodes read in 1 seconds
xorriso : NOTE : Loading ISO image tree from LBA 0
Drive current: -indev '/mnt/2020-02-12-rpd-x86-buster.iso'
xorriso : NOTE : Detected El-Torito boot information which currently
is set to be discarded
Media current: stdio file, overwriteable
Media summary: 1 session, 1527416 data blocks, 2983m data, 754g free
Media status : is written , is appendable
Boot record : El Torito , MBR isohybrid cyl-align-on GPT APM
Volume id : 'Debian RPD M-A 1'
Media summary: 0 sessions, 0 data blocks, 0 data, 754g free
Drive current: -outdev '/mnt/2020-02-12-rpd-x86-buster-mod.iso'
Media current: stdio file, overwriteable
Media status : is blank
xorriso : UPDATE : 1 files added in 1 seconds
xorriso : UPDATE : Writing: 4512s 0.3% fifo 0% buf 50%
Added to ISO image: file '/boot/grub/grub.cfg'='/home/pi/grub.cfg'
xorriso : NOTE : Keeping boot image unchanged
xorriso : UPDATE : Writing: 2048s 0.1% fifo 2% buf 50%
Writing to '/mnt/2020-02-12-rpd-x86-buster-mod.iso' completed successfully.
xorriso : UPDATE : Writing: 16384s 1.1% fifo 81% buf 50% 17.5xD
...
xorriso : UPDATE : Writing: 1523712s 99.9% fifo 75% buf 50% 18.7xD
ISO image produced: 1525788 sectors
Written to medium : 1525952 sectors at LBA 32
xorriso : UPDATE : 5398 nodes read in 1 seconds
xorriso : NOTE : Re-assessing -outdev '/mnt/2020-02-12-rpd-x86-buster-mod.iso'
xorriso : NOTE : Loading ISO image tree from LBA 0
libburn : SORRY : Read start address 1527415s larger than number of readable blocks 1525984
xorriso : NOTE : Detected El-Torito boot information which currently is set to be kept
unchanged
xorriso : NOTE : Tolerated problem event of severity 'SORRY'
Drive current: -dev '/mnt/2020-02-12-rpd-x86-buster-mod.iso'
Media current: stdio file, overwriteable
Media status : is written , is appendable
Boot record : El Torito , MBR cyl-align-on GPT APM
Media summary: 1 session, 1525788 data blocks, 2980m data, 751g free
Volume id : 'Debian RPD M-A 1'
xorriso : NOTE : -return_with SORRY 32 triggered by problem severity SORRY

xorriso : UPDATE : 5398 nodes read in 1 seconds
xorriso : UPDATE : 5398 nodes read in 1 seconds

This made increased font size reliably setup during boot of Debian RPD live USB with persistence.

[Update]

As my cheap USB SATA SSD frequently stopped working with kernel messages that suggested uas
driver is the culprit. So in order to fall back on legacy storage driver, I have looked up the idVendor and
idProduct in dmesg of my cheap USB SATA SSD and added this to the kernel command line:

usb_storage.quirks=2109:0715:u

Wednesday, 7 October 2020

Appearance fine tuning

As my eyes are getting weaker, I do not feel comfortable with the default font size on my 14" laptop screen using 1920x1080 resolution. I had to add this file to make fonts bigger:

pi@raspberrypi:~ $ nano .Xresources 
Xft.dpi: 140

This made the taskbar icons look smaller, so I increased them in Appearance Settings.

For tty, that I very rarely use I have set up the maximal 16x32 characters using:

pi@raspberrypi:~ $ sudo dpkg-reconfigure console-setup

Monday, 5 October 2020

Boosting Raspberry Pi Desktop experience with SSD

While my sleek SanDisk Cruzer Fit was great to give me the initial insight into Debian with Raspberry Pi Desktop, it is so sluggish that seriously deteriorates user experience. As a matter of fact, this SanDisk Cruzer Fit USB 2.0 flash drive is so slow that it even fails Raspberry Pi Diagnostics badly. At the same time, Raspberry Pi OS has recently made booting from USB officially supported on Raspberry Pi 4b.

As both of my laptop and the Raspberry Pi 4b supports USB 3, it made me look into investing a bootable USB 3 solution. In these investment investigations, I usually try to find the cheapest solution on Amazon. I have found for £10 a 64 GB M2 2242 SATA SSD that fits into a £20 USB 3 enclosure. While it sticks out of my laptop much more than the SanDisk Cruzer Fit did, the responsiveness it offers made me stick with it.

Just for the records, I have run Raspberry Pi Diagnostics on this new SSD drive both in my laptop and in the Raspberry Pi 4b.

Here are the results in my laptop:

Raspberry Pi Diagnostics - version 0.5
Sun Oct  4 18:13:59 2020
Test : SD Card Speed Test
Run 1
prepare-file;0;0;156410;305
seq-write;0;0;163024;318
rand-4k-write;0;0;16137;4034
rand-4k-read;16773;4193;0;0
Sequential write speed 163024 KB/sec (target 10000) - PASS
Random write speed 4034 IOPS (target 500) - PASS
Random read speed 4193 IOPS (target 1500) - PASS
Test PASS

Here are the results in the Raspberry Pi 4b:

Raspberry Pi Diagnostics - version 0.5
Sun Oct  4 16:11:35 2020
Test : SD Card Speed Test
Run 1
prepare-file;0;0;157538;307
seq-write;0;0;161418;315
rand-4k-write;0;0;49461;12365
rand-4k-read;48259;12064;0;0
Sequential write speed 161418 KB/sec (target 10000) - PASS
Random write speed 12365 IOPS (target 500) - PASS
Random read speed 12064 IOPS (target 1500) - PASS
Test PASS