picture of 4GB usd card

When unbricking (using recovery image) goes wrong  (UM3/S3/S5 unbricking) 

(updated 3/25/2022)



Disclaimer 1: Opening the bottom of the Ultimaker S5 R1 can cause death!  There are high voltages under the cover.  Read all the cautions in your reseller's unbricking procedure before opening the cover on an S5 R1.

Disclaimer 2: Some of the unbricking steps below can in theory damage your Olimex board on your S5.  Don't hold me responsible for any damage you may cause by following my instructions.  I do not work for Ultimaker.

-gr5


If your UM3/S3/S5 won't boot there is something called a "recovery image".  The basic procedure is to download the ".img" file and "copy" it onto a uSD card using special software (don't just copy the img file - you use a special program - different depending on linux, mac, or pc).  To get the full procedure and file to download, contact your reseller.  There is some information about this here but you need to contact your reseller to get the donwloadable image and if you have an S5 R1 there are deadly voltages involved and you have to sign a waiver or something:

https://community.ultimaker.com/topic/20024-recovering-a-bricked-um3/

Note that Olimex suggests you use a 4GB class 10 (or better) uSD card.  If you get too large (UM says > 32GB ) it won't be recognized by the Olimex board.

However this is about what happens if that doesn't work. 

Note that UM3 and S5R1 have the olimex board.  S5R2 does not!?  The Olimex hardware for UM3 and S5R1 is identical but there is a critical change to an eeprom.  More on this below under "buy the olimex".

I know of at least 3 things that can go wrong.  I've helped 3 people fix their S5's so this will be S5 oriented but the help below is useful for UM3/S3/S5.

Update - if you have an Ultimaker 3 it's probably a bad block and several people had great luck by first installing version 4.3.3 recovery image which worked followed by the latest firmware recovery image (today it is 5.3.0).  It looks like 4.3.3 formats the partitions but 5.3.0 doesn't so installing 4.3.3 first seems to fix the bad blocks so then you can install 5.3.0. Latest UM3 firmware is here:
https://support.makerbot.com/s/article/1877624822572

UM3 (not S3/S5/S7) v4.3.3 firmware is here:
https://software.ultimaker.com/jedi/releases/UM3_recovery-3.7.7.20170627.img

I also have a backup copy here:
http://gr5.org/UM3_recovery-3.7.7.20170627.img

1) boot.scr file not found in the recovery image.

Some S5 printers for sure expect a file called boot.scr on the boot partition of the uSD yet instead UM only supplies a file called mmc_boot.scr in some recovery images.  One solution is to mount the uSD, copy boot.scr to mmc_boot.scr and save/unmount the uSD.  This is complicated.  Another solution is to talk to U-Boot on the Olimex board and tell it to boot from mmc_boot.scr instead.  This is also complicated and requires an Olimex serial cable. 

Actually I have since learned that the 5.7.2 and 6.4.1 recovery are missing this file but other versions e.g. 5.2.11 and 6.1.1(R1) have both .scr files.  So maybe just try a different .img file.

For the older, more complicated solution go here.

2) flash memory on Olimex has some bad blocks

The eMMC flash memory that is built into the Olimex board can go bad but it usually only goes bad in a few spots.  It is supposed to do wear balancing but that doesn't seem to work well.  Usually you can just reformat - or even repartition and reformat and that always seems to fix the problem (at least for another few years).  This requires the Olimex serial cable as well.

To figure out if the problem is 1 or 2 above you need the olimex serial cable so the first thing you need to do is spend the 10 euros/dollars or so to get this part. 

3) Motion Controller

If you get the message "The motion controller failed to update" you should reseat or better buy a new ribbon cable that goes between the 2 computers (olimex and arduino).  You can get one from amazon here for $7.
The motion controller failed to update

Olimex Serial Cable F

This is crucial for debugging and repairing your problem.  It's cheap and can save you hundreds of euros/dollars.  If you are in the USA you can get this from digikey.com or from my store at thegr5store.com.  If you are in europe I recommend you get it from olimex.com.  Just google "olimex serial cable F".  The "F" stands for female as you will be connecting to 3 male pins that stick out of the olimex board (or in the case of the S5 - they are right next to the olimex board).

For breveity I will now call it the "olimex cable".

This cable connects into your printer on one end (inside the printer - you have to remove covers) and has a USB connection on the other end which connects to your linux/mac/pc computer.  You start up software that gives you a command line terminal connection into your olimex board.  When you power up your printer the olimex board will start spewing out boot information in text format.  From that information you can discover a lot of things.  However you need a device driver for the olimex cable (which has it's own tiny tiny computer chip inside the usb connector) and you will need terminal software.  For mac/linux you can use software called "screen" although on the mac I recommend "picocom".  To find the drivers you need (if any) and software you need google one of these or similar.  There's lots of great info out there on how to set up the software
"olimex serial cable on a mac"
"olimex serial cable on a pc"
"olimex serial cable on linux"

On the Olimex web page where you purchase the cable there are also helpful instructions - connect Rx to Tx (what!  yes - counterintuitive).  Here's a photo of where you connect the cable on the S5

image of s5 serial connections

Again Rx goes to Tx (counterintuitive).  Colors of cables are described on olimex.com website where you buy the cable.

Using the cable


Hook up the cable to the S5, connect USB, startup the appropriate software and most importantly set the baudrate to 115200 as described on the olimex website and other helpful forums on olimex recovery.

DEADLY VOLTAGES IN S5 R1.  Make sure no pets nor people can get near the bottom of the printer before you apply power.  Maybe face the bottom of the printer towards/touching a wall anytime you power up your S5.

Then power up your printer and watch the text flyby.  If you get something like this:
USB device 0: unknown device
ethernet@01c50000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
ethernet@01c50000: No link.
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/01-cc-bd-d3-00-6d-10
ethernet@01c50000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
ethernet@01c50000: No link.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
ethernet@01c50000 Waiting for PHY auto negotiation to complete......... TIMEOUT !



Issue #2 - However if you have errors with your flash you will get something more like this:

These are not errors - this is just normal boot but very different from the boot.scr issue:

[    2.064188] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.071432] usb usb5: Product: MUSB HDRC host driver
[    2.076400] usb usb5: Manufacturer: Linux 4.14.32-ultimaker musb-hcd
[    2.082768] usb usb5: SerialNumber: musb-hdrc.1.auto
[    2.088407] hub 5-0:1.0: USB hub found
[    2.092236] hub 5-0:1.0: 1 port detected
[    2.096815] sunxi-rtc 1c20d00.rtc: setting system clock to 1970-01-01 00:28:21 UTC (1701)
[    2.105522] vcc3v0: disabling
[    2.108564] vcc5v0: disabling

Note the number in the brackets [] is the time in seconds since boot started so these for example are 2 seconds after jessie operating system started booting.

And sprinkled in there an error "mounting" or other "f2fs" errors like these perhaps:

[   13.702851] F2FS-fs (mmcblk1p2): invalid crc_offset: 64527
[   13.708814] F2FS-fs (mmcblk1p2): invalid crc_offset: 64527

Error: unable to mount '/dev/mmcblk1p2'.


Note that in the above example it got serious errors when it tried to mount "mmcblk1p2".

mmc can be either uSD or internal "hard drive" of the olimex which is flash memory.  If you are booting from uSD (you are) then
blk0 = uSD
blk1 = flash memory

If you are getting errors on mmcblk0 then something is wrong with your SD card - recreate it or throw it away and get a new one.

It's okay to wipe out all the flash memory because the uSD has all the files needed to replace it.

The uSD has 2 partitions - the first partition is the boot partition.
flash memory has 3 partitions.  In the above example it is getting errors mounting the second partition.  You can easily get errors when copying data into the partition (sometimes mount works but copying files fails).  You can also get errors when mounting.  So anyway the 3 partitions for your olimex flash drive are:
mmcblk1p1 (boot)
mmcblk1p2 (jessie linux and ultimaker software)
mmcblk1p3 ("user" partition - not much stored here - gcode files go here if you print over network)

If installation fails the output should show a frowny face ultimaker robot and above that there is some restoration going on and above that is the key error that caused the install to fail.  And then the install ends with the # prompt:
#

If you are asked for username password note that all Ultimaker images are root/ultimaker for username/password.  Olimex images (images you downloaded that were created by olimex - this is talked about below) are root/olimex or sometimes root/password.

At that prompt you can type all kinds of linux commands.   For example you can display all the "disks" on uSD and on flash:

/tmp # fdisk -l
Disk /dev/mmcblk0: 15 GB, 15931539456 bytes, 31116288 sectors
486192 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk0p1    0,32,33     4,52,48           2048      67583      65536 32.0M 83 Linux
/dev/mmcblk0p2    4,52,49     22,15,19         67584     354393     286810  140M 83 Linux
Disk /dev/mmcblk1: 3688 MB, 3867148288 bytes, 7553024 sectors
118016 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk1p1    32,0,1      1023,3,16         2048      67583      65536 32.0M 83 Linux
/dev/mmcblk1p2    1023,3,16   1023,3,16        67584    1998847    1931264  943M 83 Linux
/dev/mmcblk1p3    1023,3,16   1023,3,16      1998848    7553023    5554176 2712M 83 Linux
Disk /dev/mmcblk1boot1: 16 MB, 16777216 bytes, 32768 sectors
512 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Notice that it shows you "blk0" which is uSD "disks" and notice that the first partition on both devices is smallish (both 32MB).  Those are the boot partitions for uSD and flash.  Note that the flash has 3 partitions (p1,p2,p3).  Note the sizes.  Take notes - grab a screenshot - the sizes may differ if you don't have an S5R1 with version 5.7.2.  You may have an S3 or UM3 or it's possible a future version of UM software will create a larger second partition to store more software.  You need to save these partition sizes because you may need to delete them and recreate them later.

For example you can try to mount a partition but first create a folder:
# mkdir xx   <-- mkdir="make directory" (create a subfolder) called "xx" (if this gets an error you already created xx so don't worry)
# mount /dev/mmcblk1p1 xx

That tries to mount partition 1 (p1).

How to reformat a partition.

Critical Background Information


Why we repartition - eMMC "hard drive" chip on the olimex has "wear leveling". Each memory location can only be written maybe 100K times which is not nearly enough for a few locations (some processes write to the same memory location every few seconds 24/7). So "wear leveling" fixes this.  When you write to a particular address the eMMC chip internally actually writes somewhere else and has a map called the LBA that keeps track of where things really are.  If the failure is in the formatting portion of the eMMC or if the failure is in the partitioning part of the eMMC you need to recreate that.  The eMMC should notice bad blocks and designate that those parts of memory should never be used in the future but until you rewrite a new partition or format data it will be a serious error on the "hard drive".  The strange thing is that some people have repartitioned and reformatted 3 times and installed the recovery image and every time it got serious errors but when they repartitioned in such a way as to skip the first GB of "hard drive" things worked great and their printer worked great going forwards.  Unfortunately version 5.X and newer repartition back to the way it was.

Okay so things have changed.  The newer img (recovery image) and swu (software update - file you put on the USB flash) now will reformat if you change the partition sizes in any way.  Starting with version 5.X if you change the partition locations or sizes the installer will repartition the eMMC "hard drive".  This may be okay as the wear leveling is supposed to find and stop using bad blocks each time you try to write to one. So some versioning info:

https://support.ultimaker.com/hc/en-us/articles/360012055979-Ultimaker-S-line-firmware-release-notes

4.3.3 On the plus side, it does not partition.  Does not format.  And it works great.  I used this version for probably a year of printing.  On the minus side it does not support digital factory, air manager, material station.  So you can't print over the network unless you use an ancient version of Cura.  But I just print using USB flash anyway.

5.1.18 and older don't know how to use .swu files so you have to install the "stepping stone" firmware first if you are installing ujsing USB (unbricking "recovery image" method uses ".img" file and doesn't need the "stepping stone" firmware installed first).

5.7.2 - the version I am using on my S5 (march 2022).  Will partition if sizes and locations not as expected.  Even though it is old (2020) it works great.  It is the first version to support Digital Factory and has lots of bugs related to digital factory, material station and air manager.  But I use the USB drive for printing so I don't care (no bugs if you avoid DF, AM, MS).

5.8.2 Final version before Buster operating system

6.1.1 - Has Buster and also will partition (somewhat annoying).  Buster needs more space so the "root" partition is bigger.

7.0.3 - Has new features so that it will partition in some special circumstances.  This version might be worth installing a few times before trying the more complicated steps below of repartitioning and reformatting.  But probably you need to change something (remove partitions?  repartition differently?) to get it to repartition again (to avoid the bad blocks).



All partitions are in f2fs (flash to file system) format.  Not fat32.  Not ext4.  f2fs.  Actually now firmware 5.X and newer formats the first partition (the boot partition) as ext4.  f2fs is a rarish and unusual type and the formatter doesn't come on the UM repair disk (damn it - why does it have to be so complicated!).  So to format I installed olimex version of jessie but it's possible you don't have to do that.

Debian Jessie/Buster OS. side note - what's "jessie"?  It's a version of Debian linux.  It's a complete operating system like windows.  Instead of version numbers the debian people like to use names like "jessie" aka (debian version 8).  Apple Mac IOS also has names for their operating systems.  Did one copy the other?  I don't know.  I don't care.  Buster is debian version 10.

Reformat steps

Note that version 5.X and newer of Ultimaker firmware checks the partition sizes and if they aren't perfect it repartitions and formats automatically.  But you probably can't just delete all the partitions as the recovery procedure needs a place to put it's files into I think?  Or maybe you can - if you can that would be great - just delete the partitions and rerun the recovery procedure 2 or 3 times until all the bad blocks are locked out and things work fine.  Let me know if this works so I can greatly simplify this web page!

So I installed the Olimex eMMC jessie operating system onto a uSD card - you can download the image file from olimex.com but they make you install bittorrent and it took like 8 hours to download.  Someone else needed it so I put it here for you conveniently:
http://gr5.org/a20-lime2_mainline_uboot_sunxi_kernel_3.4.103_jessie_eMMC_rel_16.zip

Ultimaker has confirmed that most S5 printers (all but a few pre release units) have eMMC memory. 

I learned you don't have to use bittorrent as these images are also on an olimex server here:
https://ftp.olimex.com/Allwinner_Images/A20-OLinuXino/2.legacy_images_kernel_3.4.x/
Make sure to get "jessie" and "lime2".   You can get the newer version from there ("bullseye") but that won't work with most lime2 boards so definitely get jessie.

HOWEVER it occurs to me you can probably do all the same stuff on the operating system that comes with the Ultimaker recovery image!  I tried using f2fs on the 4.X recovery image but it was "not found" even though I know for sure it is on there.  Certainly the 5.X recoveries use f2fs in the update script so it might be trivial to use those?  If mkfs.f2fs command says "must specify device" or something (as opposed to "no such command" or similar) then you can probalby skip down to step 5.

STEP 1: NETWORK!!!  You absolutely need networking and seting up wifi in Jessie is a pain so use an ethernet cable to your printer - that probably means it's time to move your printer to another room where you have ethernet - like your basement or attic router - sorry - you have to do this.  You have to move a laptop or desktop there too so you can type commands through the olimex serial cable.  Sorry.  Just do it.  Stop complaining.

STEP 2: if you install olimex jessie then put it on (preferably a different to save lots of time.  Lots of time) a uSD using the same method you put the Ultimaker img on a uSD.  Insert uSD with power off.  Turn power on (with olimex cable connected and software running to see boot).  Watch it boot.  Log in with username "root" and password is "olimex".  If not then it's "password".  You can google it.  If I'm wrong about anything email me at thegr5store _at_ gmail.com.

STEP 3 - NETWORK
Give jessie a minute to find your network.  It should just work hopefully.  If not you need to learn connmanctl or if you want to setup through wifi then google "connmanctl setting up wifi to connect to my network".  You will probably need to know what kind of wifi security you are using and stuff.  Anyway here's how to test your network:

ping 8.8.8.8         <-- this is a google server
good response:
64 bytes from 8.8.8.8: seq=0 ttl=118 time=13.646 ms
Type Ctrl+c to halt ping program - if you don't it will run forever.

If that works try pinging using the name instead of the number:
ping google.com
You should get the same response.  The "time" is how long it took for a packet to get to the google server and back to you again.  Can be anywhere from 1ms to 10000ms.  Doesn't matter.  Faster is better but it doesn't matter.

If either of those tests fail then, ug, we need to setup your internet with connmanctl.  Google connmanctl - you need to know your local ip subnet (e.g. 10.0.0.X or 192.168.1.X or 192.168.0.X are the 3 most common).  You will need to know the router ip address and you will need to setup dns manually.  "8.8.8.8" is a good DNS router to use.

More on seting up conmanctl here:
https://variwiki.com/index.php?title=Static_IP_Address

If this works then:

STEP 4 - install the f2fs formatter (f2fs = flash to file system)

apt-get install f2fs-tools

The above line should take a few seconds - it will spew out 10 or more lines of stuff and it will download the tools and install and should all work perfectly.

UPDATE!!  Jessie is very old and has old certifications so apt-get probably won't work.  This really sucks but you can get f2fs-tools this way:
Followed the steps from answer #5  with aptftparchive, which worked flawlessly:            https://unix.stackexchange.com/questions/87130/how-to-quickly-create-a-local-apt-repository-for-random-packages-using-a-debian

Downloaded the f2fs-tools together with libf2fs0 (both 1.7.0-1.1_armhf from the debian jessie repo:              
http://ftp.uk.debian.org/debian/pool/main/f/f2fs-tools/



STEP 5- reformat your failing partitions like this - it doesn't hurt to just reformat all 3 but you can just reformat the one that is failing if you want.  I recommend you do all 3:

mkfs.f2fs /dev/mmcblk1p1 -l boot       (alternatively if you are going for version 5.X or newer format boot partition as ext4 see below)
mkfs.f2fs /dev/mmcblk1p2 -l root
mkfs.f2fs /dev/mmcblk1p3 -l user


The "-l" sets the label of the partition which is critical for the ultimaker repair procedure to work.  This should only take a few seconds.  If it gets an error then we probably have to repartition (step 6).

5B) Test that you can now mount the partition - this step is very optional since it won't even work on the olimex version of jessie but should work on the ultimaker version

mkdir gr                 <-- this may get an error if folder gr already exists.  Don't worry if it gets an error just move on
mount /dev/mmcblk1p2 gr  <-- this won't work on olimex jessie but will work fine on the Ultimaker jessie

Cut power to S5, Pop out the jessie uSD (if used) and put the Ultimaker reapir uSD, turn power back on and this time it should work (may take 5 minutes but you will see it doing stuff).  As a minimum it should get much farther.  If it still fails then it's time to repartition.


STEP 6: partition with fdisk - if you got here it's because reformatting the partitions was not enough.

First do "fdisk -l" to list all the partitions like I explained above.  Take note of the size of the partitions, where they start and end and so on.  Use your phone to take an image of the output or cut and paste into some text editor or something to save this information.  Your machine may have different sizes.  The instructions below assume your partitions are the same size as mine.  If different sizes than use different numbers.

Update
S5 with firmware 5.X will look like this:
Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk1p1    32,0,1      1023,3,16         2048      67583      65536 32.0M 83 Linux
/dev/mmcblk1p2    1023,3,16   1023,3,16        67584    1998847    1931264  943M 83 Linux
/dev/mmcblk1p3    1023,3,16   1023,3,16      1998848    7553023    5554176 2712M 83 Linux

S5 with firmware 6.X may look like this (second partition larger to accomodate Buster):
Device         Boot   Start     End Sectors  Size Id Type
/dev/mmcblk1p1         2048   67583   65536   32M 83 Linux
/dev/mmcblk1p2        67584 3930111 3862528  1.9G 83 Linux
/dev/mmcblk1p3      3930112 7553023 3622912  1.7G 83 Linux

So if you want to run with the latest firmware you need to do this second way for the sizes - note mainly that p2 - the main OS partition is about twice as big.  Also I strongly recommend you just skip over the first GB so partition p1 with a "start" value of 5000000 (5 million) which is about 1GB.  That will make the last partition only .7GB but that's fine as even just 0.1GB is plenty for the last partition.

Also note that P1 is formatted with ext4 now in latest firmwares. This is reported by one user and also from a UM employee.

Nothing happens to the "hard drive" (flash drive) until you exit the program.  If you cancel/abort out of the program then nothing happens.  But if you exit properly it will do the partition at the end.

fdisk /dev/mmcblk1      <-- note that you do blk1!!! you don't want to partition blk0 which is the SD card

now you are running fdisk.  It has commands to choose from and should display the options.  Type "m" for help.  Try "p" first to display the 3 existing partitions.  You have to hit enter after you hit "p".
p <-- displays the 3 partitions

First delete the 3 existing partitions:
d
1
d
2
d
3
w <-- write and save deleted partitions  (q command aborts or ctrl+c)

Start again:
fdisk /dev/mmcblk1
p <-- should show no more partitions.  Create them fresh
n p 1 2048 +32M    <-- replace spaces with enter key - this should create the first partition as a 32MB partition
n p 2 67584 +943M    <-- replace spaces with enter key - this should create the second partition as a 32MB partition
n p 3 1998848 <enter>    <-- replace spaces with enter key - this should create the third partition with the remaining space
w <-- writes and saves - if you don't do this step no partions get created

Now check your partitions with fdisk -l - should look something like this (and it will show the blk0 partitions as well which is the sd card):
fdisk -l   <-- should now show this for mmcblk1 device (ignore mmcblk0 - that's the micro SD card)
Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk1p1    32,0,1      1023,3,16         2048      67583      65536 32.0M 83 Linux
/dev/mmcblk1p2    1023,3,16   1023,3,16        67584    1998847    1931264  943M 83 Linux
/dev/mmcblk1p3    1023,3,16   1023,3,16      1998848    7553023    5554176 2712M 83 Linux

Step 7: format all 3 partitions - you may need olimex jessie to do this - see steps 3,4,5 above
mkfs.f2fs /dev/mmcblk1p1 -l boot     (format as ext4 if you plan to install recovery image version 6.X or newer)
mkfs.f2fs /dev/mmcblk1p2 -l root
mkfs.f2fs /dev/mmcblk1p3 -l user

Update - if the first command fails on partition 1 you have a newer version of mk2fs which doesn't allow partitions so small.  You can either increase the partition size to 58MB (which works great) or you can format it as ext4 format (which you need to do anyway if you are installing 6.X or newer).  I think it's safer to format it at 58MB.  I don't know what the latest Ultimaker installers do - I don't know if they check the partition sizes only (if so then try ext4) or if they check the type of partition (if so then try 58MB f2fs).  Here's the command to format ext4 format:
Mkfs.ext4 -L boot /dev/mmcblk1p1           (this is verbatim from a user and 100% the -L is uppercase for ext4 parameters but not sure about the capital "M")

Replace the uSD  with Ultimaker recovery if it's not already in there, power cycle the printer.



IF IT STILL DOES NOT WORK - AND IS STILL GETTING F2FS ERRORS SUCH AS THIS:


[    5.157296] F2FS-fs (mmcblk0p1): Magic Mismatch, valid(0xf2f52010) - read(0x2000)
[    5.164887] F2FS-fs (mmcblk0p1): Can't find valid F2FS filesystem in 1th superblock

Actually that looks like errors on the uSD - so maybe you need to recreate that?  But if you are still getting errors with the "hard  drive" or flash...


We eventually learned we can skip over the first bit of disk where the errors are (this shouldn't be necessary because the eMMC "hard drive" has "wear leveling" yet it seems to work as one user formatted 3 times with no luck and the first time he used this technique it worked!).   Note that the first partition starts at LBA 2048 (logical block address).  Notice how the  first 2 (the critical) partitions combined are about 975MB.  You can just kip over the first 975MB of flash since that's probably where all the errors are.  975MB appears to end at LBA 1998847.  So set it up so the StartLBA  is past that - set the StartLBA to 2000000 (2 million).  And fdisk will automatically leave the partition size of the 3rd partition to be the remainder of the flash drive.

The 3rd partition doesn't need to be 2.7GB.  Not sure how large it needs to be but I think this just stores gcode files.  How large is your largest gcode file?  I'm not sure what else is there but someone I know says he started the first (boot) partition at "700000".  I don't know if that means LBA 700000 (probably) or 700MB (probably not).  So 2 million might leave too little for the user partition but I doubt it.  I think it will be fine.  Actually I recommend you skip the entire first GB as on my S5 I have almost nothing in the final partition.  Just a few gcode files (ufd files) from old prints done over the network. Even just 0.1GB should be plenty of space.

Note also that the instructions above need to be modified slightly so that the second partition starts just past the end of the first.  You may have noticed by now that fdisk prompts you with suggested values as you go along and you can just let it choose the "start LBA" for the second and third partitions by simply hitting "enter" and not entering a value.

UPDATE - It looks like some of the newer UM firmware versions repartition!!!  6.1 and newer.  This is depressing.  It definitely won't do this in version 4.3.2 and that version works fantastic.  No "digital factory" but I don't care.  So it seems the main partition (partition 2) that is used for jessie now is bigger at 1.9GB.  You still only need a 100 MB for partition 3 so you can still make partition 1 start 1GB in from the beginging and have much more than 100MB.  Here is what the recent 5.X firmware partitions look like these days:

Device         Boot   Start     End Sectors  Size Id Type
/dev/mmcblk1p1         2048   67583   65536   32M 83 Linux
/dev/mmcblk1p2        67584 3930111 3862528  1.9G 83 Linux
/dev/mmcblk1p3      3930112 7553023 3622912  1.7G 83 Linux

I recommend you stick with 4.X but if you are going to try 5.X and it repartitions and then won't boot then you should format as above but instead of start at 2048 try starting at 5000000 (5 million - which multiplied by 256 size blocks gets you about 1GB I think).  Hopefully it won't repartition if p2 is already at 1.9GB.  But it's possible it repartitions no matter what.  I just don't know.  I could look over the code but that seems like a lot of work.

CAN'T I JUST BUY THE OLIMEX BOARD?

Yes!  The olimex board for the UM3 is a little cheaper and works on S5R1 (sort of - keep reading though).  Ultimaker part number: UM3; 1782 and for the UM3-extended: 1783

The S5 Olimex has 2 USB connectors that the UM3 doesn't: to the camera and the wifi.  So if you need either of those features you will need those connectors installed.  I don't know but it's possible the S5 won't boot if it detects one or both of those missing. 

Also if you use S5 olimex for UM3 or the other way around then you must have the serial cable.  The Olimex boards from Ultimaker have all the software loaded and there is also an area of the eeprom that stores whether it's a UM3/UM3E/S5R1.  Here's how to change that.  If you put one for the UM3 into the S5 it won't know it's in an S5 and won't talk to the display so the display will be blank.  And you can't put it into developer mode.  So you must have the serial cable.  Here's the command to convert the olimex into another type:

python3 /ulti_installer/configure_eeprom.py 9051

I haven't tried the above command - but I'm told it should work.  The number 9051 should be set as follows:
9051 S5R1  (printer has ulti robot on the side panel S5R2 printers have a big U on the side panels)
9066 UM3
9511 UM3 extended



UPDATE TO python3 command above
It looks like the configure_eeprom command isn't in the latest firmware releases.  I'm not sure if that's supposed to be in the installer but it looks like it was available in older versions of the UM3 firmware at least.  I pulled out a few python files to look at the code.  When connected to the olimex you can dump the eeprom refered to here with hexdump and here is what I get on my UM3:

root@ultimakersystem-ccbdd3005b4c:/# hexdump /sys/bus/i2c/devices/1-0050/eeprom  -C
00000000 55 ff ff ff ff ff ff ff cc bd d3 00 5b 4c cb ff |U...........[L..|
00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
*
00000100 00 00 23 5b ff ff ff ff 30 65 7f b1 b6 48 4e 41 |..#[....0e...HNA|
00000110 ac 52 72 1b a6 f3 ab c9 ff ff ff ff ff ff ff ff |.Rr.............|
00000120 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
*
00000800
root@ultimakersystem-ccbdd3005b4c:/#
So above is what you want typically.  I recommend doing the above hexdump on whatever olimex board you receive to see what it looks like.  The device above looks like a file but it's not - it's a device.  I don't know if you can use a hex editor to edit it directly.  Maybe.  Maybe not.  Probably.

Note that starting at address 100 (256 decimal) you see "00 00 23 5b"  That's hex for 9066 (use a calculator or web page to translate).  9066 is for UM3.

If you don't have the utility you can try this:

I zipped up the utility here: gr5.org/ulti_install.tar.gz


download that and then copy it to your printer with scp (similar to ssh).  For example:

scp ulti_install.tar.gz root@192.168.1.XXX:/

Replace the 192.168.1.XXX with the ip address of your particular printer.  scp works on mac or linux but on windows I think there is a way to do it with putty maybe?  Maybe not - google it.

now unzip it - log into the linux machine and do "cd /" to get to the same folder where you copied it to then do:

 tar xvfz ulti_installer.tar.gz

 That will create a subfolder (you can actually do this anywhere you want - you didn't have to scp it to the root (/) folder.

 Go into the ulti_installer subfolder and try the python3 command now.


What about just buying Olimex for S5?  Well you have to get the entire assembly and it's very expensive.  You could buy a few Creality printers for the cost of replacing the S5 controller assembly.

Can't I just get the board from Olimex.com?

Not really.  Maybe.  Read on.  You would have to remove a few connectors (including USB and power which is in the way) and add 2 USB connectors of a different type.   You will need a surface mount solder flow station and the equipment needed to do this.

Someone at Ultimaker told me the board is basically this one: UM3 / S5: A20-OLinuXino-LIME2-e16Gs16M for €53  (aka olimex lime2 with these features).  I'm not 100% sure that's all correct if you go to olimex.com they explain the numbers.  A20 and lime2 are definitely correct.  16G is the overall memory and that's 4X what the UM3/S3/S5 has but it will work fine.  n is for nand memory, e is for eMMC memory.  You need to have eMMC memory.  But you will need to remove some parts and change the USB connectors.  You can steal the USB connector from your old broken board.  Before ordering anything open up your printer and look carefully at the part in your printer and compare to Olimex photos.  The eMMC part number is JY997 (well that's the part number for the 8GB version - there are different sized memories).

MISC

If your printer is almost completely booting but not quite you can dump the most recent linux boot log by typing (log into root/ultimaker):
dmesg
and you can dump the Ultimaker python boot files with journalctl. For example, to see all python errors since most recent boot do:
journalctl -b


Good Luck!  Email me for corrections, questions, pictures to add to this, text to add to this!  Let me know if this worked!  thegr5store _at_ gmail _dot_ com