Archive for the ‘Embedded’ Category

Debian Buster can’t boot because initramfs doesn’t activate a LVM /usr volume

Wednesday, January 13th, 2021

One of the great things about Debian is the ease of migrating an installation through multiple releases via the dist-upgrade facility. However, regardless of the technical design, over time opinions change and begin to collide with those prior intentions.

One such example is the practice of placing /usr on a separate partition. Previously, doing so was the default approach of the Debian installer, but it has fallen out of favor due to the declining utility and popularity of remote-mounting /usr. Hidden boot-time dependencies on /usr have crept in as a result, in turn making a separate /usr mount increasingly impractical to maintain.

Upon upgrading a system with such a configuration to Debian 9 “Buster”, the user will be confronted an unbootable system and the following console gibberish:

Gave up waiting for /usr device. Common problems:
 - Boot args (cat /proc/cmdline)
   - Check rootdelay= (did the system wait long enough?)
 - Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/mapper/debian-usr does not exist. Dropping to shell!

BusyBox ........
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
(initramfs)

What’s going on here? Even the initramfs init script seems to accommodate a separate /usr, searching for and mounting it:

if read_fstab_entry /usr; then
        log_begin_msg "Mounting /usr file system"
        mountfs /usr
        log_end_msg
fi

The actual problem is that on a LVM system, the block device (volume) containing /usr is not accessible because it hasn’t been activated. The reason is because the LVM initramfs scripts only activate two volumes: the volume designated as the root filesystem, and the volume containing a swap area designated as the resume device.

/usr/share/initramfs-tools/scripts/local-top/lvm2:

[..]

activate "$ROOT"
activate "$resume"

exit 0

A manual workaround to get the system booting from the initramfs prompt:

(initramfs) lvm vgchange -a y
  5 logical volume(s) in volume group "debian" now active
(initramfs) exit

To fix it permanently, add a custom script to /etc/initramfs-tools – the description of how to do this is in Debian bug #980021.

Happy hacking!

Install Linux on an Android-Based Lenovo Yoga Book (YB1X90F)

Friday, April 28th, 2017

Having a Linux distribution installed on an Android netbook can be the best of both worlds. Leveraging the Linux kernel already running on any Android device, a Linux userspace will be native and fast and come with many tools power users will appreciate. Here are some ways to get the most out of the Linux on Android experience.

(more…)

I just want to PXE-boot my PC with some image on a Debian-based server.

Monday, August 22nd, 2016

This should be the least-hassle method of booting a PC over the network from a Debian-based server using the Intel PXE interface.

I set this up to PXE-boot memtest86+, but anything that can be loaded via the PXELINUX loader (such as a Linux kernel) can be added to the menu and booted this way. Building the menu via PXELINUX avoids the byzantine and reportedly bug-ridden PXE menu facility.
(more…)

Repair Black Box ServSwitch EC Series KVM IP Switch

Sunday, July 31st, 2016

KV9316A

I repaired a broken Black Box KV9316A 16-port KVM-over-IP switch through replacing electrolytic capacitors and an internal battery. The short story is that a manufacturer of several internal logic boards used cheap “TRec” electrolytic capacitors which failed with high ESR, and the manufacturer of the power supply unit used a cheap “SWC” electrolytic capacitor which failed open, causing a voltage drop under load. The long story follows.

(more…)

My Samsung Galaxy S5 smartphone charges too slow, how can I make it faster?

Thursday, July 28th, 2016

I noticed lately that as a heavy smartphone user, the charging rate of my Galaxy S5 running the Android v6 Marshmallow firmware was barely outpacing drain rate.  Sometimes even an overnight charge would not be enough to bring it back to a full charge.  After installing the free app Ampere, I realized that regardless of what the phone was connected to (wall charger, USB2, USB3 ports), it was charging at only the 500mA rate that is the maximum allowed for computer USB 1.1/2.0 ports.  So I did some investigation and this is how I found that I was able to increase the rate to 2.0A on both my Galaxy S5 and my wife’s Google Nexus 5, dramatically reducing charge time over most of the battery’s capacity range.

(more…)

My Nexus 5 has an erratic touch screen that jumps all over the place

Sunday, January 17th, 2016

Symptom: The Nexus 5 Android smartphone occasionally registers touchscreen clicks in the wrong place or when a click was not requested.  Turning the screen off and back on in a normal touchscreen recalibration maneuver does not prevent it from recurring.

Solution: Unplug the Nexus 5 from the USB charging cable while using it, or use a ferrite core USB charger cable (the kind with a round “wart” on the cable). Don’t replace your touch screen, as some users have mistakenly done!

Long answer: An erratic touchpad that seems to jump all over the screen is a problem with electromagnetic interference when the Nexus 5 is connected to a USB charger. There is a long Google bug thread here. The problem will not be fixed.

How do I charge a completely dead battery in my Creative Zen Xtra MP3 player?

Tuesday, August 3rd, 2010

One unfortunate circumstance that every Zen Xtra owner has run into is a discharged battery, either due to use or non-use, that the unit refuses to recharge. This usually manifests itself as an endless EAX screen reboot loop even when plugged into DC charger power. If you only have one battery, there is no way to recover from this firmware aberration; you must buy a battery that is charged off the shelf.

But once you have bought a new battery, how can you recover use of your old battery and use it to make sure your unit never goes dead again?
(more…)

Fortron/FSP Mini-ITX power supply repair

Sunday, February 28th, 2010

My little Mini-ITX system froze and would only sometimes power back on, only to freeze shortly thereafter. The problem was two 1000uF 10V capacitors in the PSU which had developed bulging tops and ESR greater than 1 ohm. Replacing these capacitors brought the system back to life. It would not be a surprise to see more capacitors fail in these power supplies due to the small space the Mini-ITX form factor requires several very hot power transistors to be crammed into.

Getting along with the VIA EPIA-M10000 Mini-ITX HTPC motherboard

Saturday, December 12th, 2009

I got this motherboard for free with a 933MHz Ezra-T C3 processor. It is still the cheapest option for a HTPC/MythTV box. Linux has low enough system overhead to make it usable and also has fairly well maintained open source drivers for the aging VIA hardware. But there are a few things you need to know.

(more…)

Why does Linux only see 1GB of my 2GB SD Card?

Friday, August 31st, 2007

This mailing list post explains why.

A 2GB SD card reports a 1024 byte block size instead of the 512 byte block size that all smaller SD cards employ. However, I/O is performed in 512 byte blocks by the USB mass storage driver. The card reader is supposed to know about this and report a 512 byte block size, while multiplying the number of blocks reported by the card by 2, in order to report the correct card geometry to the operating system.

Older card readers do not know about this conversion, and may even assume that all SD cards have a 512 byte block size. Thus, a 512 byte block size is reported, along with the number of blocks reported by the card. This cuts the reported capacity of the card in half.

But the filesystem that exists on the card reports a 2GB size. On a system where the card physically only shows up as 1GB, this causes the FAT filesystem driver to read past the end of the card. This will produce read/write errors, and could even crash the filesystem driver if it is not equipped to deal with this case.

Windows reportedly employs one of two solutions to ensure that 2GB cards are correctly recognized.

The first solution is to assume that the card has a PC partition table on it (a mostly correct assumption for any card purchased retail). The Windows USB mass storage driver then examines the partition table to determine the number of blocks on the physical device, and ignores the number of blocks reported by the reader. A possible flaw with this scheme is that the Windows driver may not account for cases where a partition table has been erroneously or maliciously constructed, leading to an incorrect physical size being entered, and thus a device which cannot be correctly repartitioned or reformatted. It may also not account for the device being divided into several partitions. And of course this scheme won’t work for a card which is formatted without a partition table.

The other solution is to ignore the number of blocks reported by the reader, and to probe the size of the card by issuing test reads, probably in large increments at first and then smaller increments, until a read failure occurs. The read failure is assumed to occur because the read occurred past the end of the device. A possible flaw in this scheme is that a card with one or more defective sectors could cause the storage driver to believe it has found the end of the device, when in fact the read error occurs because of a bad sector.

At the moment, the solution for Linux and other operating systems which do not implement such hacks and which trust the card reader to report a useful block count and block size of the inserted card, is to buy a new card reader.