RSS Feed
okt 4

Olimex A20-OLinuXino-LIME2 – 8 years in service, 2 PSUs and 1 SD-card down

Posted on tirsdag, oktober 4, 2022 in Hal9k, Planets, Sysadmin'ing

4 years ago I posted a 4 year review of the Olimex LIME2. It seems that the lifetime of power supplies is approximately 4 years as now another power supply died, and this time also the SD-card was expiring. The LIME2 lives on however!

It was a bit hard to notice, because the battery pack of the LIME2 kept it running pretty well even with the poor power supply. So, better monitoring of the battery pack is also on the todo list.

Recovering the bad SD-card

Recovering the SD-card was relatively easy with minimal dataloss, when out of the LIME2:

$ sudo ddrescue /dev/mmcblk0 backup.img
# Put in a new SD-card
$ sudo dd if=backup.img of=/dev/mmcblk0 bs=16M

I have done this a couple of times with other SD-cards from Raspberry PIs, and though there is the potential for dataloss it is usually minimal. This time a few blocks were lost.

Upgrading Debian from Stretch to Bullseye

I took the opportunity to upgrade the Debian install while the system was offline anyway. Upgrading was generally painless, following the usual Debian method. I went through the Buster release just to be sure:

$ vim /etc/apt/sources.list
# replace all "stretch" with "buster" :%s/stretch/buster
$ apt update && apt upgrade && apt full-upgrade
$ reboot

$ vim /etc/apt/sources.list
# replace all "buster" with "bullseye" :%s/buster/bullseye
$ apt update && apt upgrade && apt full-upgrade
$ reboot

The only tricky part is booting the new kernel. Since that always fails for me on the first try, I always hookup the serial console. For future reference, this is how to hookup the serial console (which is TTL 3.3V):

Pinout from left as labelled on the LIME2: TX, RX, GND

Now, of course the boot failed. I tried getting the flash-kernel package to work for my setup, but for historical reasons I have a separate boot partition. In the end I derived a simple bootscript from that package, that boots from p1 but loads the kernel, fdt and initrd from p2:

setenv bootargs  ${bootargs} console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10

#setenv fk_kvers '4.19.0-21-armmp-lpae'
setenv fk_kvers '5.10.0-18-armmp-lpae'
setenv fdtpath dtb-${fk_kvers}

load mmc 0:2 ${kernel_addr_r} /boot/vmlinuz-${fk_kvers}
load mmc 0:2 ${fdt_addr_r} /boot/${fdtpath}
load mmc 0:2 ${ramdisk_addr_r} /boot/initrd.img-${fk_kvers}
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

The script can be manually input over the serial terminal, and thereby tested out.

The only downside is it needs to be manually updated after each kernel upgrade. To activate the uboot bootscript:

$ mount /dev/mmcblk0p1 /mnt/
$ cd /mnt
# ensure boot.cmd is as above
$ mkimage -C none -A arm -T script -d boot.cmd boot.scr

Monitoring the LIME2 battery pack

After upgrading to a recent 5.X mainline Linux kernel the battery pack is exposed in the sysfs filesystem:

$ cat /sys/class/power_supply/axp20x-battery/voltage_now 
4070000 # 4.07 V
$ cat /sys/class/power_supply/axp20x-ac/voltage_now 
4933000 # 4.93 V

I setup a couple of alerting rules for these in my home monitoring setup, so hopefully the next time the LIME2 defeats a power supply I’ll get notified.

Conclusion

I can still warmly recommend the LIME2. It is still available, and even a bit cheaper nowadays at 40 EUR + VAT, and still a little workhorse that just keeps on going.

sep 29

Olimex A20-OLinuXino-LIME2 – A review after 4 years in service

Posted on lørdag, september 29, 2018 in Hal9k, Planets, Sysadmin'ing

Last week my A20-OLinuXino-LIME2 one board Linux computer quit working, with a power supply issue. I looked up when it was purchased, and realised it had been in 24/7 service for almost 4 years. I guess that is a good excuse to do a little review. It even turned out that it the board was fine, but the AC-DC power supply brick could not supply enough current anymore.

The relevant specifications of the board, for my uses, are basically:

  • Dual core 1 GHz ARM Cortex-A7
  • 1 GB memory, 1 Gbit ethernet, SATA connector
  • LiPo battery connector/charger for UPS functionality

The Lime2 has been tasked with running my home monitoring system, consisting of a Debian installation with a Graphite backend, a Grafana frontend, and a ZoneMinder installation. The Graphite database is running on a software RAID0 of two disks (one on SATA, one on USB): in the beginning it was two spinning disks, but after a few years the random 2.5″ laptop disk I was using crapped out, so it was upgraded to a Samsung SSD. The power budget is strained more or less to the max with two spinning harddrives: The system was only able to boot if the battery was connected, presumably because the voltage would otherwise drop for the startup torque. This problem went away after switching to a SSD.

Software wise the system started out with the Debian supplied by Olimex on a SD-card, a Debian pre-Jessie with a custom SunXi kernel. This system was reasonable, but did experience random hangs after some time of use (I belive I found a bugreport back in the day, but am unable to refind it now). The system was later upgraded to a Debian Stretch with a 4.9 kernel from stretch-backports, that supports the SunXi chipset enough for my uses. The upgrade was rather involved,  requiring the correct kernel image, a custom U-boot script and the correct device tree file. Something did of course go wrong, at which point I got to be familiar with the serial console of the Lime2: there is a convenient 3 pin header, that gives access to a TTL serial. Using the serial console, I was able to identify the mistake and correct it. After the upgrade the system has been rock-stable.

The system has been handling the load reasonably: The 1GB of memory is constraining, there is not really any more free memory. The processor is only really strained by the motion detection in ZoneMinder, which uses more or less one core per camera. This will hopefully be optimized a bit, as ZoneMinder is being optimized for the ARM instruction set. Handling only the Graphite/Grafana load would be a breeze, even though the system is receiving ~650 metrics per minute.

All in all, I can recommend the Lime2 board for applications that need a little more umph than a Raspberry Pi, notably on the SATA and Ethernet side, and/or applications that need to be continuously available even after the power cuts out. For applications that need more than one SATA port, or more than one Ethernet port, or on-board Wifi, there are better — and more expensive — options. The price point of 45 EUR + VAT (which did not change from 4 years ago) puts the Lime2 slightly above the price of a RaspberryPi or BananaPi, but below boards like the Apu2. In addition, Olimex has announced that the Lime2 will be available “forever”, making any system designed using the Lime2 future proof — for the foreseeable future.

I ordered a new Lime2, before realising the problem was the power supply. I opted for the industrial variant that is now available. The only change, as far as I’m aware, is that the Allwinner A20 chip is rated for a larger temperature range, and it is 5 EUR more expensive.

jan 31

Stupid sys-admin’ing, and hooray for LVM and unnecessary partitions

Posted on fredag, januar 31, 2014 in Planet Ubuntu-DK, Planets, Sysadmin'ing, Ubuntu

The scenario is: almost finished migrating from an old server to a new server. Only a few steps remain, namely

  • change DNS to point to new server
  • wipe disks on old server

Done in this order, one might be unlucky that ssh’ing in to wipe the disks lands you on the new server. If you don’t discover this and run the command
dd if=/dev/zero of=/dev/md2
to wipe the disks you might run it on the new server instead. BAM: you just wiped the data of your new server. Fortunately, I realised my mistake after a few seconds, and was able to recover from this with only unimportant data loss, and a little panic.

/dev/md2 is actually a LVM physical partition, of which the first part now only contains zeroes; hereunder all the meta-data. LVM reported no volumes of any kind:
root@server# pvs -v
Scanning for physical volume names
root@server# lvs -v
Finding all logical volumes
No volume groups found
root@server # vgs -v
Finding all volume groups
No volume groups found

After a bit of Google’ing while panicking I found out LVM keeps a backup of all its metadata in /etc/lvm/backup, and that it could be rewritten to the physical volume using:
pvcreate -ff -u XXXXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXXXX --restorefile /etc/lvm/backup/vg0 /dev/md2
where XXXXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXXXX is the physical UUID from the backup file:
...
physical_volumes {
pv0 {
id = "XXXXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXXXX"
device = "/dev/md2" # Hint only ... 

Unfortunately, I got an error:
root@server# pvcreate -ff -u XXXXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXXXX --restorefile /etc/lvm/backup/vg0 /dev/md2
Couldn't find device with uuid XXXXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXXXX.
Can't open /dev/md2 exclusively. Mounted filesystem?

lsof showed nothing accessing md2, but I guess something still had references to the logical volumes. I was unable to get it to work, so I decided to reboot (while making sure the system would come up, and nothing would try to mount the (non-existent) LVM volumes). After a reboot the command worked, but still no logical volumes:
root@server # pvcreate -ff -u XXXXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXXXX --restorefile /etc/lvm/backup/vg0 /dev/md2
Couldn't find device with uuid XXXXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXXXX.
Physical volume "/dev/md2" successfully created
root@server # sudo pvs
PV VG Fmt Attr PSize PFree
/dev/md2 lvm2 a- 648.51g 648.51g
root@server # sudo lvs
No volume groups found

Now I had a physical volume, and could use the vgcfgrestore command:
root@server # vgcfgrestore -f /etc/lvm/backup/vg0 /dev/vg0
Restored volume group vg0
root@server # sudo lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
...
home vg0 -wi-a- 20.00g

I now had my logical volumes back! Now to assess the data loss… The backup file /etc/lvm/backup/vg0 lists which order the logical volumes are stored. The first volume in my case was the “home” volume. Sure enough, it would no longer mount:
root@server # mount /dev/vg0/home /home
mount: wrong fs type, bad option, bad superblock on /dev/mapper/vg0-home,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

I actually had no important information on that file system, so I re-created it. Luckily the next volume was intact, and I could bring up the rest of the system without problems.

So to sum up: LVM keeps a backup of all it’s metadata that can be restored (after a reboot), but if your keyboard is faster than your brain it can be a good idea to keep an unused volume as the first logical volume 🙂

dec 12

WordPress – mildly impressed

Posted on fredag, december 12, 2008 in Planet Ubuntu-DK, Sysadmin'ing, Ubuntu, University

So, I just installed WordPress, because I was starting to have a too long mental list of things that I considered “blog-able”. My current estimate of what I will be blogging about is: Sysadmin’ing on a tight budget, Ubuntu Linux, MultiADM, various happenings in the Open Source world, and probably a bit about my everyday life as a student of Computer Science at Aalborg University, Denmark.

But back to the title of this post. For various reasons I have previously preferred other blogging software (primarily blogging software integrated with Typo3), but I finally gave in and installed WordPress. I deemed that I was simply missing out on too much: trackbacks, tags, anti-spam measures for comments. All this warranted a separate blogging system, and WordPress is pretty much the no. 1 blogging system in use.

My experience with it so far: Installation was okay, but it could have told me that the reason I didn’t get the fancy install-wizard was because I had forgot to give permissions for WordPress to modify its files. Minor nitpick: I decided to move my installation from /wordpress to just /. This resulted in all links still pointing at /wordpress. After a little detective work, and phpMyAdmin to the rescue to alter a couple of rows, and everything was working again.

But overall it seems WordPress is a pretty capable and extendable, and has a nice Web 2.0-like user interface. I’m pretty sure I will grow accustomed to it over time.