HELP in setting up a Meraki52

So before we get started just so you know I have read through the following:

[OpenWrt Wiki] Meraki MR52
How to Flash Cisco Meraki with OpenWRT

And, based on reports from the following:

Meraki Mr52 Ubootwrite.py - Installing and Using OpenWrt - OpenWrt Forum
[solved] Meraki MR52 eth0 not working, no phy - Installing and Using OpenWrt - OpenWrt Forum
Meraki MR52 5g radio problem - Installing and Using OpenWrt - OpenWrt Forum
MR52 users' experience - Installing and Using OpenWrt - OpenWrt Forum

I am using version 22.03.6

I have downloaded the various files. I've verified the tftp server works via tftp from a different host. I am powering the Meraki from a PoE switch

I have a serial console cable plugged into the Meraki and if I run Minicom and connect to /dev/ttyUSB0 I get plenty of screen output from the boot loader.

I'm using Ubuntu 16 because ubootwrite.py is written for python2.7 and trying to use it on Ubuntu 24 with python3 blows up with an error message.

I installed pyserial from here:

pyserial · PyPI

by downloading it and running

python setup.py install

However, when attempting to run ubootwrite.py I get these kinds of errors:


root@tedm-HP-Pavilion-17-Notebook-PC:/var/lib/tftpboot# python ubootwrite.py --write=mr52_u-boot.bin  --serial /dev/ttyUSB0
Waiting for device...
Prompt is '   7.791442] random: board_data_conf: uninitialized urandom read (4 bytes read, 66 bits of entropy available)
<Meraki> '
Traceback (most recent call last):
  File "ubootwrite.py", line 223, in <module>
    main()
  File "ubootwrite.py", line 218, in main
    upload(ser, options.write, int(options.size, 0), int(options.addr, 0), options.verbose, debug, options.shell)
  File "ubootwrite.py", line 171, in upload
    ret = memwrite(ser, path, size, start_addr, verbose, debug, shell)
  File "ubootwrite.py", line 141, in memwrite
    if not writecommand(ser, str_to_write, prompt, verbose):
  File "ubootwrite.py", line 74, in writecommand
    if (buf.decode("utf-8") != command):
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf7 in position 1: invalid start byte

root@tedm-HP-Pavilion-17-Notebook-PC:/var/lib/tftpboot# python2.7 ubootwrite.py --write=mr52_u-boot.bin  --serial /dev/ttyUSB0
Waiting for device...
Prompt is 'eraki> '
Found an error, so aborting
Done

root@tedm-HP-Pavilion-17-Notebook-PC:/var/lib/tftpboot# python2.7 ubootwrite.py --write=mr52_u-boot.bin  --serial /dev/ttyUSB0
Waiting for device...
Prompt is 'eraki> '
Traceback (most recent call last):
  File "ubootwrite.py", line 223, in <module>
    main()
  File "ubootwrite.py", line 218, in main
    upload(ser, options.write, int(options.size, 0), int(options.addr, 0), options.verbose, debug, options.shell)
  File "ubootwrite.py", line 171, in upload
    ret = memwrite(ser, path, size, start_addr, verbose, debug, shell)
  File "ubootwrite.py", line 141, in memwrite
    if not writecommand(ser, str_to_write, prompt, verbose):
  File "ubootwrite.py", line 74, in writecommand
    if (buf.decode("utf-8") != command):
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xbe in position 5: invalid start byte

root@tedm-HP-Pavilion-17-Notebook-PC:/var/lib/tftpboot# python -V
Python 2.7.12
root@tedm-HP-Pavilion-17-Notebook-PC:/var/lib/tftpboot#

Sometimes I get no output other times the output is different.

I'm using a CH340 clone for the 3v+ serial console cable that has worked fine with many other routers.

Does anyone have any advice as to what is going on here? If needed I can provide a boot output.

I can run any needed version of python or Linux or I can do this on Windows instead of Linux.

Is it possible that the python on Ubuntu is bad?

I'm not very experienced with flashing via UART, but the variability in your output perhaps points to a problem in the physical connection. Maybe try redoing the connections to the MR52 UART? Whilst some of my Meraki flash attempts were unsuccessful, I never saw variable output like the above, so I suspect some IO problem.
Or could it be the later Meraki firmware that prevents flashing this way altogether?

It would be most helpful if anyone who did this successfully were to bother to include the operating system version they used as well as the version of Python and the version of pyserial.

Python changes more than a cat has lives it is a constant moving target. It's a horrible choice for doing anything with, frankly, because of this. And the modules change as well. Without knowing EXACTLY what version was in use when the hack/script was written, I'm driving completely blind

For YOUR successful Meraki flashes, what operating system were you using?

Hello,

soooo I flashed my MR 42, and let me tell you I was about to give up until I found this video on YouTube..... It saved my life.

For me, my biggest mistake was the serial connection.... triple check yours!!!1
My second mistake was on step 6. In my case was not optional....
"1. (Optional) If you have no further use for the Meraki OS, you can remove all other UBI volumes on ubi0 (mtd11), including diagnostic1, part.old, storage and part.safe. You must not remove the ubi1 ART partition (mtd12).for i in diagnostic1 part.old storage part.safe ; do ubirmvol /dev/ubi0 -N $I done"

Also, stay on the 22 version of OWRT.

try looking for some of my posts on this forum...

I successfully flashed via ubuntu 20.04 and python 2.7 running as root IIRC! I may have used a venv. However I did not encounter problems in respect of that side of things and therefore never thought to report it in any posts I made on the subject. I don't believe your errors stem from python/OS compatibility. But something else.
Whatever OS you're on, you should be able to install a python2.7.

Not sure what causes the error. I've installed OpenWrt on multiple MR42 and MR52's and never had this issue. The only thing I can think of is to make sure you have no other program such as screen or minicom listening on /dev/ttyUSB while you are using ubootwrite.py since it may cause interference.

Run ubootwrite.py and then power on the device. Once ubootwrite.py finishes it will close the connection and you can then connect to /dev/ttyUSB using screen / minicom / picocom to interact with the OpenWrt initramfs to finish the install.

I'm using Kubuntu 24.04 and the standard python3 and other libraries included with the distribution

1 Like

Looking at apt/dpkg, I may have in fact used python3 with Ubuntu 20.04 too to run that script. I don't appear to have installed any python2.7 environments on the machine I used at the time.

Ok then it must be the serial port adapter I'm using I will have to try a different one then.

Thanks for the video. There's several things he did differently. First he used a FTDI232 (Future Technologies Inc.) serial cable not the CH340. Second, he also used python 3.8 and pyserial 3.5 it looks like under ubuntu 20 I knew about not deleting the ART partition already, but I appreciate your confirmation. I believe the FTDI USB serial chip is considered "better" than the CH340 so that might be the issue.

The MR52 appears to setup at 115200 baud which historically was way too fast for a 3-wire serial port connection. We always used a max of 9600bps for those, and it might be that the connection is dropping characters if there's something in the driver chain that is not handling it. If the driver isn't fast enough and keeping up that would explain why it worked fine using minicom for console observation.

Canonical switched to python3 on Ubuntu 18. They removed Python 2.7 from the Universe repo for Ubuntu 24

Do you see any garbled or dropped characters while you just watch it boot with minicom?
Speed 115200 is not a problem when the wires are very short.