Reviving a Dead Kobo Libra 2
On the second day of my annual beach trip my Kobo Libra 2 eReader greeted me with a screen that flashed twice, turned white and the status LED continuously blinked. I did some quick searching on the web and found these are the symptoms of a bad SD card.
Luckily, I always bring one or two physical books on this vacation and tucked the Kobo back into my bag to deal with when I got home.
Removing the microSD card
After returning home, I got out the Kobo and proceeded to remove the back cover. This is an easy job with a small plastic spudger. iFixit has a guide to removing the back cover of the new Libra Colour which is the same case as the Libra 2. On the main board is microSD card that in a standard connector. Unfortunately, removing the microSD card is not as straightforward as popping off the back.
The Libra 2 is IPX 7 rated as waterproof. How do they get an IPX 7 rating with a plastic cover that can pop on and off so easily?
They cover the entire board, connectors and all, with a waterproof coating.
Removing the coating is not difficult. You can scrape the coating off parts with a small metal screwdriver. Once started it’s easy to pick away the rest with a pair of tweezers. iFixit recommends some heat could also help.
Getting the card out was a bit more difficult. First, there’s no easy way to get a good grip on the card. Usually, it’s easy to slide out with your fingertips, but not when covered in the waterproof coating. Second, the coating seeps everywhere and can really lock in the card. I had to scrape away the coating inside the small opening of the canister with the tip of the tweezers and gently lift the metal canister away from the top of the card.
After some light swearing and not gentle pulling on the card with tweezers it finally came free.
Examining the microSD card
I inserted the microSD card into my trusty ThinkPad running Linux to see what was on the card. The system found 3 partitions, 2 small Linux partitions and 1 large FAT partition:
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 29.72 GiB, 31914983424 bytes, 62333952 sectors
Disk model: SD/MMC
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0d2cc842
Device Boot Start End Sectors Size Id Type
/dev/sda1 49152 573440 524289 256M 83 Linux
/dev/sda2 573441 1359873 786433 384M 83 Linux
/dev/sda3 1359874 62301182 60941309 29.1G b W95 FAT32
And it would mount and read the partitions:
$ sudo mount /dev/sda1 /mnt
$ ls /mnt
bin/ drivers/ fs.md5sum libexec/ lost+found/ proc/ sbin/ tmp/ var/
dev/ etc/ lib/ linuxrc@ mnt/ root/ sys/ usr/
At this point, I wasn’t sure what was going on. So I re-installed the microSD card. Pushed the power button. And nothing.
No screen flash. No LED. Nothing
A detour into dealing with more f#!*@ing coating
The next morning I brought out the big guns. By big guns I mean the soldering iron. On the main board there is are four points helpfully labeled as V
, TX
, RX
, and ground. That certainly looks like a serial port. I did a quick test with a multi-meter and there was a bit of 3.3v flickering on the TX
point. That certainly is a serial port.
I soldering three temporary wires to the TX
, RX
, and ground points, connected a TTL to USB serial cable rated for 3.3v, fired up minicom
, and pushed the power button. Quickly a U-Boot banner scrolled by and just as quickly a U-Boot prompt. That’s cool, but not really what I wanted to see.
Scrolling back through the output I found this:
*** Warning - MMC init failed, using default environment
That seems bad.
Above I mentioned how the waterproof coating gets everywhere. By, everywhere I mean everywhere. After some thrashing around I realized the bottom of the microSD card had flakes of coating on in. I thought that maybe some of that was still inside the microSD card case on the board and may be causing issues with contact. I reached in with a fine, flat screwdriver and scraped off each contact, and tried booting again.
The screen flashed twice and the LED was blinking. I was back to where I started.
The serial output showed U-Boot find the card and started to boot a Linux kernel. Now I saw the real error.
mmcblk0: card_busy_detect: error sending status cmd, status 0x80900
mmcblk0: card_busy_detect: error sending status cmd, status 0x80900
mmcblk0: card_busy_detect: error sending status cmd, status 0x80900
mmcblk0: card_busy_detect: error sending status cmd, status 0x80900
mmcblk0: card_busy_detect: error sending status cmd, status 0x80900
mmcblk0: card_busy_detect: error sending status cmd, status 0x80900
mmcblk0: card_busy_detect: error sending status cmd, status 0x80900
blk_update_request: I/O error, dev mmcblk0, sector 311302
Buffer I/O error on dev mmcblk0p1, logical block 131075, lost async page write
and finally
EXT4-fs (mmcblk0p1): error loading journal
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(179,1)
random: nonblocking pool is initialized
## What’s really going on The two side effects, the screen blinking and LED flashing, are part of the Linux boot process. When the kernel initializes the display device it causes the two flashes. It also starts the LED flashing before it tries to mount the root file system. Since that file system is never mounted the LED never stops flashing.
But why does the card work fine in my laptop? I pull it out of the Kobo and load it back in my laptop to make sure I didn’t somehow damage the card. It still shows up and mounts fine. I copied a random file to the card and that works, too.
Put it back in the Kobo. Boot up and it still can’t mount the root file system.
Pull out the card, put back it in the laptop, and mount again. This time I notice the file I wrote wasn’t there.
At this point I knew I needed a new microSD card. I’m still not sure why it seemed to work fine on my laptop with no errors. A mystery for another day.
Re-imaging a new microSD card
In my stash I had a 16GB microSD card. Smaller than the 32GB that comes with the
device, but I never needed that much space on my Kobo. If I had a good card I could
dd
and image off of that, but I wasn’t sure of the state of my current card. It
would read on my laptop, but I didn’t trust the state of that card anymore.
It is left as an exercise to the reader to find a backup image somewhere on the web. It’s not too bad.
Wrote a backup image to the microSD card with dd
, put in the Kobo, and booted
up. Screen blinked, LED flashed, LED went out, and then the “Do not power down” image
showed up. After rebooting a few times it went to the select a language page.
Success!
Updating the serial number
But something still didn’t seem right. All of your Kobo data is stored on the FAT
partition including a special directory .kobo
. In there includes your settings,
version, and serial number information. But where does that come from?
I dug around in the U-Boot output and saw that when the card was not found even U-Boot didn’t get far because it was looking for configuration data on the microSD card. Doing a bit more digging I found that even the device serial number is stored in that space on the card at logical address 0x200 starting with “SN-N”. The backup that I got kindly zeroed out the serial number.
$ hexdump -C -s 512 -n 16 backup_Libra2_RevE_nosn.img
00000200 53 4e 2d 4e 30 30 30 30 30 30 30 30 30 30 30 30 |SN-N000000000000|
To add the correct serial number, load the backup file in any hex editor and put in
your serial number starting at 0x204. On the Libra 2 it’s on a sticker stuck to the
battery. Write the updated version of the file onto the card with dd
like before.
After a couple more reboots the language selection screen shows up. After a couple more screen you need to re-register the device with kobo. If you have purchased books via the Kobo online store they should even be automatically downloaded.
Restoring books and reading stats
I don’t use the Kobo store and instead sideline books using Calibre. To get my books back, I took a chance and did a copy from the old, maybe working microSD card, to the new one. Once the Kobo disconnected from my computer it did the normal import of files and everything was there. Even Calibre thought everything was back to working order, but…
Every book showed as unread.
Kobo stores reading stats in the .kobo/KoboReader.sqlite
database on the FAT
partition. If you search online you’ll find directions on moving that file to a new
device. It includes updating the database to match the new device. However, since
you’re not moving to a new device and you’ve updated the serial number correctly there
is no need to change anything in the database. Copy it over and the reading stats will
come back.
Now I was happy.