Dell Seagate SSHD Firmware Update on Linux

I am a happy owner of a Dell Precision M4800.

Just kidding – I don't remember ever having so many problems with a PC hardware platform on Linux.

The biggest problem was in that I kept losing my Seagate ST1000LM014 SSHD at runtime. All of a sudden my /dev/sda1 partition would vanish without a trace and would stay vanished until the full power-off, battery & power removal, capacitor discharge and restart.

First thought was, obviously – “Firmware!”. As a good boy I am I went to Dell Support and found Seagate ST500LM000/ST1000LM014 Firmware Update “DEM6”.

Yay! Boot Windows. Flash USB drive with firmware. Reboot. Crap!

The flash boots, shows Linux TinyCore, then a few flashing messages and a power-off sequence, a total of 3 – 5 seconds after the kernel has loaded. Obviously the firmware wasn’t being updated. My guess the hardware is too new for TinyCore 3.0 kernel or ramdisk wasn’t initializing or something.

Oy vey!

Drastic times call for drastic measures.

Research

If you are a "Too long; didn't read" kind of guy/al — don't click this.

Booting Fedora, inserting the USB flash and looking inside we find something along these lines:

[arcivanov@aimobile-sm SEABOOT]$ ls -la
total 80
drwx------  4 arcivanov arcivanov 16384 Dec 31  1969 .
drwxr-x---+ 3 root      root         60 Jul 29 21:25 ..
drwx------  3 arcivanov arcivanov 16384 Jul 29 21:28 boot
-r--r--r--  1 arcivanov arcivanov 32256 Jul 29 19:46 ldlinux.sys
drwx------  2 arcivanov arcivanov 16384 Jul 29 19:46 stelogs
[arcivanov@aimobile-sm SEABOOT]$ ls -la *
-r--r--r-- 1 arcivanov arcivanov 32256 Jul 29 19:46 ldlinux.sys

boot:
total 14976
drwx------ 3 arcivanov arcivanov    16384 Jul 29 21:28 .
drwx------ 4 arcivanov arcivanov    16384 Dec 31  1969 ..
-rw-r--r-- 1 arcivanov arcivanov  2103360 Jul 29  2013 STXbzImage
drwx------ 2 arcivanov arcivanov    16384 Jul 29 20:24 syslinux
-rw-r--r-- 1 arcivanov arcivanov 13165208 Jul 29  2013 tinycore_Seagate.gz

stelogs:
total 32
drwx------ 2 arcivanov arcivanov 16384 Jul 29 19:46 .
drwx------ 4 arcivanov arcivanov 16384 Dec 31  1969 ..

STXbzImage is a Linux kernel.
tinycore_Seagate.gz looks promising.

[arcivanov@aimobile-sm SEABOOT]$ cp boot/tinycore_Seagate.gz ~
[arcivanov@aimobile-sm SEABOOT]$ cd ~
[arcivanov@aimobile-sm ~]$ gzip -d tinycore_Seagate.gz 
[arcivanov@aimobile-sm ~]$ file tinycore_Seagate 
tinycore_Seagate: ASCII cpio archive (SVR4 with no CRC)

Ah, just a CPIO archive. I can work with that.

[arcivanov@aimobile-sm ~]$ mkdir seaboot
[arcivanov@aimobile-sm ~]$ cd seaboot
[arcivanov@aimobile-sm seaboot]$ cpio -dvi < ../tinycore_Seagate
.
run
run/udev
tmp
tmp/aberr
tmp/98-tc.rules
init
var
var/run
var/run/utmp
[...]

Nice. So let’s take a look what’s inside, remembering that firmware is actually called “DEM6”:

[arcivanov@aimobile-sm seaboot]$ find -iname \*dem6\*
./root/stelogs/DEM6L.LOD
./root/stelogs/DEM6H.LOD

Yay again! Using Google we find that the tools is called SeaTools Express and hence “ste” is, probably, a common acronym.
Let’s use that knowledge:

[arcivanov@aimobile-sm seaboot]$ find -iname \*ste\*
./lib/modules/3.0.21.tcSeaKernel-03_12_05CORE_SG/kernel/drivers/net/phy/ste10Xp.ko.gz
./lib/modules/3.0.21.tcSeaKernel-03_12_05CORE_SG/kernel/drivers/scsi/stex.ko.gz
./lib/modules/3.0.21.tcSeaKernel-03_12_05CORE_SG/kernel/net/ipv4/netfilter/ipt_CLUSTERIP.ko.gz
./lib/modules/3.0.21.tcSeaKernel-03_12_05CORE_SG/kernel/net/netfilter/xt_cluster.ko.gz
./etc/udev/rules.d/60-persistent-input.rules
./etc/udev/rules.d/60-persistent-alsa.rules
./etc/udev/rules.d/60-persistent-serial.rules
./etc/udev/rules.d/60-persistent-storage.rules
./root/stelogs
./usr/bin/stecon.sh
./usr/bin/STECon

So, STECon is a console SeaTools Express binary and stecon.sh is a shell wrapper. Let’s look inside.

[arcivanov@aimobile-sm seaboot]$ cat ./usr/bin/stecon.sh 
#!/bin/sh
if [ $# -ne 0 ]; then
    LOGS="-USBSTELogs $1"
fi
/usr/bin/STECon  -exitpause -colorizePassFail $LOGS -scriptcab /root/FDLSG_LTO.cab FDLSG_LTO.xml
sync

Cool. Now let’s see who invokes this script:

[arcivanov@aimobile-sm seaboot]$ grep -rnw '.' -e "stecon.sh"
./usr/bin/oemshell.sh:148:         safeexecute stecon.sh $dataDirectory
./usr/bin/oemshell.sh:191:   safeexecute stecon.sh $dataDirectory
./usr/bin/oemshell.sh:195:   safeexecute stecon.sh $dataDirectory
./usr/bin/oemshell.sh:199:#for getting all log output using a command like: " 
    safeexecute stecon.sh | tee log.log "works really well, but after this and 
    before the press any key use the following sed command to remove the spinner.
grep: ./usr/bin/sudo: Permission denied
grep: ./usr/sbin/visudo: Permission denied

Looking inside oemshell.sh we find lots of blah but, importantly, these things:

  • when launched MARKDOWN_HASH985179f13a12cbe578cc67ae6aa40a46MARKDOWN_HASH working directory is set to MARKDOWN_HASH205419cf9650806540ae0d7f5e6c3ebfMARKDOWN_HASH
  • MARKDOWN_HASH91e816649910def834d48e0da7318e24MARKDOWN_HASH is also MARKDOWN_HASH205419cf9650806540ae0d7f5e6c3ebfMARKDOWN_HASH

Finally, let’s look at what STECon links to:

[arcivanov@aimobile-sm seaboot]$ readelf -d usr/bin/STECon 

Dynamic section at offset 0x5c01d4 contains 35 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libcryptopp.so.6]
 0x00000001 (NEEDED)                     Shared library: [libaio.so.1]
 0x00000001 (NEEDED)                     Shared library: [libexpat.so.1]
 0x00000001 (NEEDED)                     Shared library: [libcrypto.so.10]
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]

Thus we will need to install MARKDOWN_HASH4f111a8bc55c40439b0fc1489371767cMARKDOWN_HASH and MARKDOWN_HASH3457a73e3029da7a16b93cee013ccc8fMARKDOWN_HASH.

That’s it, now to adapt the shell wrapper script for our purposes and we’re all set.

Solution

This solution only covers updating firmware on an HDD that is not currently in use, i.e. hosts no mounted volumes. If you need to update a boot drive or other drives that host volumes that cannot be dismounted, you’ll need to create a liveCD/USB by hand. This scenario is NOT covered here. Good luck!

Modifying HDD firmware via this method is dangerous and should not be attempted! I take no responsibility for lost data, damaged hardware, denied warranty and/or a sudden death of your favorite pet. If you are a brave and unwise enough soul to actually attempt this, you’re using these instructions at your own risk. Furthemore, only proceed after making sure you’ve read and agreed to the binding Terms & Conditions.

  1. Once you have flashed your USB drive with Dell Seagate firmware, boot into Linux and plug the USB drive in.
  2. Install required dependencies: sudo yum -y install cryptopp.i686 libaio.i686
  3. Download the following script into your home directory and make it executable by invoking chmod u+x sg_flash_firmware.sh:
    #!/bin/bash -eEu
    
    TINYCORE=${1:-}
    
    if [ -z "$TINYCORE" ]; then
            echo "Usage: sg_flash_firmware.sh <path to tinycore_Seagate.gz>" >&2
            exit 1
    fi
    
    TMP_DIR="$(mktemp -d /tmp/sg_flash_firmwareXXXXXXXXXX)"
    echo "Extracting into '$TMP_DIR'..."
    
    ( cd "$TMP_DIR" && gzip -c -d "$TINYCORE" | cpio --quiet -di 2>/dev/null || true )
    
    ROOT_DIR="$(readlink -nf "$TMP_DIR/root")"
    STELOGS_DIR="$(readlink -nf "$ROOT_DIR/stelogs")"
    
    (
      cd "$STELOGS_DIR" && sudo "$TMP_DIR/usr/bin/STECon" -exitpause -colorizePassFail \
         -USBSTELogs "$STELOGS_DIR" -scriptcab "$ROOT_DIR/FDLSG_LTO.cab" FDLSG_LTO.xml
      sync
    )
    
  4. Unmount ALL volumes hosted on all drives to be updated. Failure to do so will most likely result in data corruption and/or loss.

    In my case the drive to be updated was /dev/sda while the OS was booted from volumes residing on /dev/sdb.
  5. Run ~/sg_flash_firmware.sh <path to tinycore_Seagate.gz>. The tinycore_Seagate.gz will most likely be located in /run/media/<username>/SEABOOT/boot/tinycore_Seagate.gz

As a result you will get something along these lines, except that it’ll show your drive being flashed. Also note, you’ll be asked to enter a password for sudo (root privileges are required).

[arcivanov@aimobile-sm misc]$ ./sg_flash_firmware.sh /run/media/arcivanov/SEABOOT/boot/tinycore_Seagate.gz
Extracting into '/tmp/sg_flash_firmwareOsJtK7gHNk'...
SeaTools Express
Copyright (c) 2013 Seagate Technology LLC, All Rights Reserved
v031205CORE Build Date: Jun 26 2013 Build Time: 11:21:25
Searching for available devices:

   

                              Overall Progress Completed:  50%
---------------------------------
        Firmware Download        
---------------------------------
 Model Number     :  ST1000LM014-1EJ164
 Serial Number    :  W3XXXXXX
 Firmware Revision:  [ DEM6 ] 
 File Standard.cfs found and starting Download process.

 This drive already has this firmware.

 SMART Status Good
 Total Test Time = hrs:0.00  min:00  sec:03
================================================================================
                              Overall Progress Completed:  100%
-----------------------------
 Overall Status  =   PASSED
-----------------------------

   

                              Overall Progress Completed:  50%
---------------------------------
        Firmware Download        
---------------------------------
 Model Number     :  SK hynix SH920 mSATA 256GB
 Serial Number    :  EIXXXXXXXXXXXXXXXX
 Firmware Revision:  [ 10108L00 ] 
 File Standard.cfs found and starting Download process.

 Bad Firmware String. 

 SMART Status Good
 Total Test Time = hrs:0.00  min:00  sec:01

================================================================================
================================================================================
  Model Number: ST1000LM014-1EJ164                      
  Serial Number: W3XXXXXX                         PASS  

  Model Number: SK hynix SH920 mSATA 256GB             
  Serial Number: EIXXXXXXXXXXXXXXXX               FAIL  


Press any key to continue...

Enjoy!

Leave a Reply