Categories
Brainwaves

Watched 34c4: SecuShare looks cool!

Secure Scuttlebutt is not anonymous and this is what put me off when initially looking into it. That as well as that it is reinventing the wheel and not using a standard protocol / library.

Reading about SecuShare makes me excited. Even more so when I compare it to reading about e.g. Secure Scuttlebutt or other non-cloud social networks.

I read about PSYC: I have my doubts about a 1995 protocol, but hey, SecuShare uses this, so it has to be cool, right?

Categories
Brainwaves

Discovered youbroketheinternet.org and secushare.org with some interesting points on how and why the current Internet is broken. Can’t really argue with them…

Federation doesn’t work, here is why: I thought federation was a way to go, an improvement on the current centralized corporation-owned services. Though still somewhat true, I can’t argue that federation isn’t as awesome and wildly spread as it should’ve been by now.

GNUnet looks to be “better” than I2P or Tor according to SecuShare’s site.

Is SecuShare project still alive? Looks interesting, lots of good ideas and observations (e.g. on federation and P2P technology in social setting).

Well, there are 2020 updates on the page. Sounds like it lives to some extent.

SecuShare Prototype: “Mobile is further down the road, re-using the code for desktop. The problem is getting our daemons onto mobile operating systems.” — looks like a job for PinePhone, i.e. native GNU/Linux smartphone?

Categories
Brainwaves

Discovered GNUnet. A redesign of the Internet with privacy in mind. The main point that stuck with me was that it is a framework, not the end product. It often occured to me that a lot of the inovative privacy-respecting distributed applications have to reinvent a lot of stuff. Which is a dumb thing to do if you know anything about security or value your developers’ time.

Found out about CADET-GTK which is a GNUnet-based messenger: CADET-GTK
Looks to be alive, supports libhandy (convergence, yay!), though not very far in terms of development. Maybe I should help here?

GNUnet repository: Looks to be alive. Nice.

GNUnet documentation: Lots of modules are provided, e.g. DHT, File Sharing, GNS name service, crypto functions, …
Several interesting apps are already in the making with this. Sounds interesting.

GNUnet is NOT based on or using blockchain. GOOD! I hate blockchain.

Discovered Taler: GNU microtransactions system that could act as an alternative to ads.

Categories
Brainwaves

Markdown, anyone?

Right after sending my first post I discovered that I couldn’t be bothered to enter raw HTML. Markdown on the other hand is quite easy to write. Hence my update to the wordpress-rest-curl tool, which does the transformation from markdown to HTML on its own!

Categories
Brainwaves

I’ve improved my WordPress instance with the ability to post to it through the REST API right from the terminal. How? See https://git.dejvino.cz/dejvino/wordpress-rest-curl

And why? I want to experiment with “brainwave” posts, i.e. very short posts that require only minimal effort on my part, but still provide a lot of value. To any potential reader and to me as well, since I can easily track and record what I worked on.

Categories
Awesome Hardware Linux

Orange Pi Zero running in QEMU

I needed a way to run an Orange Pi Zero SD-Card image of Armbian as a virtual machine. And this is actually possible with QEMU!

This is the command I used:

qemu-system-arm \
-M orangepi-pc -m 1024 -cpu cortex-a7 -dtb boot/dtb/sun8i-h3-orangepi-pc.dtb \
-kernel boot/vmlinuz-5.4.45-sunxi -initrd boot/initrd.img-5.4.45-sunxi \
-append 'earlyprintk loglevel=8 earlycon=uart8250,mmio32,0x1c28000,115200n8 console=ttyS0 root=/dev/mmcblk0p1' \
-nographic -serial stdio -monitor none \
-drive file=Armbian_20.05.3_Orangepizero_buster_current_5.4.45.img,format=raw,if=none,id=d1 \
-device sd-card,drive=d1 \
-nic user,model=allwinner-sun8i-emac,hostfwd=tcp::50022-:22

Original source: https://forum.armbian.com/topic/7547-run-armbian-into-qemu/?tab=comments#comment-86797

You need to get the contents of the /boot directory from the SD Card image so that you can start booting it. I just used scp to copy it from a running Orange Pi Zero to my main machine. The command above doesn’t actually run an Orange Pi Zero board, it runs an Orange Pi PC, though this is almost the same thing. At least the CPU is the same (note: Allwinner H2+ and H3 are binary compatible). But it has more memory!

Why run Armbian in QEMU?

I wanted to compile an application written in Rust. The problem was that installing it the official way through rustup (or more precisely rustup-init) resulted in an error:

info: installing component 'cargo'
info: Defaulting to 139.4 MiB unpack ram
thread 'main' panicked at 'RUSTUP_UNPACK_RAM must be larger than 220000000', src/dist/component/package.rs:200:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'No process instance', src/currentprocess.rs:126:17

The newer versions of rust required more memory than the Orange Pi Zero had! Mine had 256 MB (since I thought I’d take this as a challenge instead of going with the 512 MB version). Rustup needed at least 220 MB on its own.

Alternatively I could get some cross-compilation toolchain. But that seemed even harder; I couldn’t find anything usable.

Categories
Hardware

Serial Connection to Orange Pi 4

I thought I’d use my trusty CP2102 USB-UART adapter. But as it turns out, it only works up to 1 Mbps, while the Orange Pi 4 is running at 1500000 bauds. Oops.

My other attempt was to try the Raspberry Pi‘s serial port, but that also didn’t work. The data coming in was also just a random garbage.

I tried using a random Arduino‘s on board serial module CH340 (while having Reset hooked up to GND so that it bypasses the Atmel chip) but that for some reason didn’t produce any data on the high baud rate. Even though based on the specification of the chip the baud rate should be supported.

My next attempt was with an ESP32 dev board, hooking it up similarly to an Arduino. No luck, turns out there is again the CP2102 chip. There was some output from the Orange Pi 4, but again it was garbage since it can’t keep up at this speed.

Finally I found a lonely DAPlink module that is specifically designed for ARM programming. Among other things it has a UART with 3.3V TTL levels. And bingo, this one was fast enough to finally read the Orange Pi 4’s debug UART port.

Categories
Awesome Linux Open source PinePhone Projects

Mouse in a Pipe

Have you ever wanted to control your notebook directly from your desktop? How about controlling your phone? Wouldn’t it be better to type that chat message using a real keyboard? I wanted the same thing, so I wrote an app for that!

More precisely I created a tool that enables you to redirect mouse and keyboard events from one device to another. It’s like you reconnected your mouse and keyboard, but without the physical effort! All of this happens on a very low level (through the kernel) so this works seamlessly with any application you want to control. All you need is a Linux OS on both of the devices.

Repository: https://github.com/Dejvino/mouse-piped

One more interesting point is that the input events are pushed through a pipe, which is a generic way of transferring data among processes in Unix-based operating systems. It is up to you how you decide to transfer the data. Though most likely it will happen via SSH. You can easily generate input events on your main computer and then pipe them through SSH to your secondary computer (or a phone) and control it that way. Or you might decide to create a TCP connection and pass the data through that. That’s up to you!

And you know what else is this useful for? That’s right, you can finally play OpenTTD on a PinePhone with the full comfort of a mouse and keyboard!

Categories
Linux Open source PicoPosts PinePhone Projects

Arch Linux ARM Installer for PinePhone

I started building an automated Arch Linux ARM installation and customization set of scripts to be used for the PinePhone. The aim is to make the process easier while still being able to customize every aspect of the OS.

Repository URL: https://github.com/Dejvino/pinephone-arch-install

Arch Linux ARM running LXDE, Firefox and Onboard keyboard.

Arch Linux ARM was the best OS for PinePhone I’ve seen so far. It might be due to personal preference, but I just love how you have the full power of Arch on your mobile phone.

And if Arch is not your thing, at least you can learn what are the steps required for bringing a Linux OS into a PinePhone.

Categories
Linux PinePhone

Errors During PinePhone Install

I learned a lot about hardware and operating systems since I received my PinePhone. A lot of times it was during error investigation. With a small chance that this information might get picked up by another PinePhone enthusiast, I’ll post the error messages and my solutions here.

RTL firmware not found

Bluetooth firmware on my Arch Linux ARM was missing, it is a non-free firmware so it is not included by default.

Feb 23 19:21:58 alarm kernel: bluetooth hci0: Direct firmware load for rtl_bt/rtl8723cs_xx_fw.bin failed with error -2
Feb 23 19:21:58 alarm kernel: Bluetooth: hci0: RTL: firmware file rtl_bt/rtl8723cs_xx_fw.bin not found

With this I just went over to my postmarketOS SD Card image and copied the corresponding files from /lib/firmware/rtl_bt/ over SSH

scp lib/firmware/rtl_bt/rtl8723cs_xx_fw.bin root@pinephone_ip_address:/lib/firmware/rtl_bt/
scp lib/firmware/rtl_bt/rtl8723cs_xx_config-pinebook.bin root@pinephone_ip_address:/lib/firmware/rtl_bt/rtl8723cs_xx_config-pinephone.bin # notice the rename

systemd-binfmt Failed

I was getting a lot of binfmt-related errors like the ones in bold below. And if there is one thing you don’t want to see it is a red FAILED log line during boot process.

[...]
Feb 23 19:36:10 alarm systemd[1]: Mounted Temporary Directory (/tmp).
Feb 23 19:36:10 alarm systemd[1]: Started Create list of static device nodes for the current kernel.
Feb 23 19:36:10 alarm systemd[1]: systemd-binfmt.service: Main process exited, code=exited, status=1/FAILURE
Feb 23 19:36:10 alarm systemd[1]: systemd-binfmt.service: Failed with result 'exit-code'.
Feb 23 19:36:10 alarm systemd[1]: Failed to start Set Up Additional Binary Formats.
Feb 23 19:36:10 alarm systemd[1]: Started Load Kernel Modules.
[...]
Feb 23 19:36:10 alarm systemd-binfmt[267]: Failed to add binary format: No such file or directory
[...]
Feb 23 19:36:13 alarm systemd[1]: Starting Load/Save RF Kill Switch Status…
Feb 23 19:36:13 alarm systemd-binfmt[385]: Failed to add binary format: No such file or directory
Feb 23 19:36:13 alarm systemd[1]: Condition check resulted in Create System Users being skipped.
Feb 23 19:36:13 alarm systemd[1]: systemd-binfmt.service: Main process exited, code=exited, status=1/FAILURE
Feb 23 19:36:13 alarm systemd[1]: systemd-binfmt.service: Failed with result 'exit-code'.
Feb 23 19:36:13 alarm systemd[1]: Failed to start Set Up Additional Binary Formats.
Feb 23 19:36:13 alarm systemd[1]: Started Load/Save RF Kill Switch Status.
[...]

So I went to investigate the service’s config files, seeing the “Failed to add binary format: No such file or directory” error. There are several directories that binfmt is looking for its config files. As it turns out all of them were empty apart from one. I found out that after installing mono it registered itself with binfmt. Not sure why, but I certainly don’t need it, so the solution is simple.

rm /usr/lib/binfmt.d/mono.conf 

Done!

Broken Battery In ACPI

Multiple components make use of the ACPI and all of them report a dead battery. E.g. battery applet or laptop-mode service:

Feb 23 19:22:05 alarm laptop-mode[1653]: Failed to re-set power saving mode for wireless card
Feb 23 19:22:05 alarm laptop-mode[1700]: WARNING: Battery does not report a capacity. Minimum battery
Feb 23 19:22:05 alarm laptop-mode[1701]: charge checking does not work without a design capacity.
Feb 23 19:22:05 alarm laptop-mode[1702]: WARNING: Battery does not report a design capacity. Auto hibernation
Feb 23 19:22:05 alarm laptop-mode[1703]: does not work without a design capacity.
Feb 23 19:22:05 alarm laptop-mode[1704]: You seem to have a broken battery
Feb 23 19:22:05 alarm laptop-mode[1705]: Cannot determine design_capacity_warning
Feb 23 19:22:05 alarm laptop-mode[1706]: Disabling hibernation
Feb 23 19:22:05 alarm laptop-mode[1707]: Failed to determine battery charge. Battery charge units are not in
Feb 23 19:22:05 alarm laptop-mode[1708]: mWh, uWh, mAh or uAh.
Feb 23 19:22:05 alarm laptop-mode[1711]: enabled, active

This is not the case since the battery is actually fine, it just doesn’t work with ACPI:

# cat /sys/class/power_supply/axp20x-battery/uevent 
POWER_SUPPLY_NAME=axp20x-battery
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_ONLINE=1
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_VOLTAGE_NOW=4112000
POWER_SUPPLY_CURRENT_NOW=429000
POWER_SUPPLY_CONSTANT_CHARGE_CURRENT=1200000
POWER_SUPPLY_CONSTANT_CHARGE_CURRENT_MAX=1200000
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4200000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=2900000
POWER_SUPPLY_CAPACITY=95

Seems the kernel I’m using doesn’t have it enabled, as you can see here:

#  ls -l /usr/lib/modules/$(uname -r)/kernel/drivers/acpi
ls: cannot access '/usr/lib/modules/5.6.0-rc1-00239-geb93b104bbccb/kernel/drivers/acpi': No such file or directory