"invalid ELF header" error in latest RCN image?

Image: https://rcn-ee.com/rootfs/bb.org/testing/2016-09-04/seeed-iot/BBGW-blank-debian-8.5-seeed-iot-armhf-2016-09-04-4gb.img.xz

I tried to create myself a backup user account on my BBGW, but I’m getting a “invalid ELF header” error:

debian@beaglebone:~$ sudo useradd --create-home --shell /bin/bash --user-group --groups sudo backupuser
useradd: error while loading shared libraries: /usr/lib/arm-linux-gnueabihf/libustr-1.0.so.1: invalid ELF header
debian@beaglebone:~$ file /usr/lib/arm-linux-gnueabihf/libustr-1.0.so.1
/usr/lib/arm-linux-gnueabihf/libustr-1.0.so.1: symbolic link to libustr-1.0.so.1.0.4
debian@beaglebone:~$ file /usr/lib/arm-linux-gnueabihf/libustr-1.0.so.1.0.4
/usr/lib/arm-linux-gnueabihf/libustr-1.0.so.1.0.4: data

debian@beaglebone:~$ ls -l /usr/lib/arm-linux-gnueabihf/libustr-1.0.so.1.0.4
-rw-r–r-- 1 root root 108708 Dec 9 2014 /usr/lib/arm-linux-gnueabihf/libustr-1.0.so.1.0.4

Looking at the library in question, it is 106 KiB of NULLs. It is not a valid library:

debian@beaglebone:~$ hexdump -vx /usr/lib/arm-linux-gnueabihf/libustr-1.0.so.1.0.4
0000000 0000 0000 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0000 0000 0000

…etc…

Can someone else confirm if they see the same thing, or is my device hosed?

Stéphane

I tried to create myself a backup user account on my BBGW, but I’m getting a “invalid ELF header” error:

debian@beaglebone:~$ sudo useradd --create-home --shell /bin/bash --user-group --groups sudo backupuser
useradd: error while loading shared libraries: /usr/lib/arm-linux-gnueabihf/libustr-1.0.so.1: invalid ELF header

Good news. I’ve managed to fix a bunch of problems I was having, including this one last night with the “invalid ELF header”. Turns out there were some problems on my eMMC. With the serial debug cable, I observed quite a few of these errors during the installation:

[ 117.320212] blk_update_request: I/O error, dev mmcblk1, sector 4720648
[ 117.326810] blk_update_request: I/O error, dev mmcblk1, sector 4720656
[ 117.333405] blk_update_request: I/O error, dev mmcblk1, sector 4720664

The way I solved it was to do the following:

  1. insert the micro SD card with the installation image into a laptop or desktop computer before using it on the BB device
  2. edit the file /opt/scripts/tools/eMMC/init-eMMC-flasher-v3-bbgw.sh on the micro SD card (or whatever script is appropriate for your device)
  3. search for all instances of mkfs – there are 3, all around lines 300-320
  4. add the extra parameter “-c -c” – this calls badblocks(8) which will run a lengthy test to discover and mark bad blocks
    The three individual mkfs lines will look something like this:

LC_ALL=C mkfs.vfat -c -c -F 16 ${destination}p1 -n ${boot_label}

LC_ALL=C mkfs.ext4 -c -c ${ext4_options} ${destination}p2 -L ${rootfs_label}

LC_ALL=C mkfs.ext4 -c -c ${ext4_options} ${destination}p1 -L ${boot_label}

The installation takes much longer (an hour?) because it checks the eMMC for bad blocks, but in my case it resurrected a device that was no longer working.

Stéphane