Flashing to Byzantium

In fact, USB-A to C cables are generally more reliable, as USB-C to C communication involves things like Power Delivery negotiations, which bring a quite sizeable failure surface on both host and device ends in that doesn’t exist when using a USB-A port.

4 Likes

Hello,

today I tried reflashing the Librem 5 with the scripts available here:
https://developer.puri.sm/Librem5/Development_Environment/Phone/Troubleshooting/Reflashing_the_Phone.html

And when the script is launched it outputs this error:

(lfi) ~/dev/librem5-flash-image >>> ./scripts/librem5-flash-image    ±[●][main]
2022-05-04 17:16:08 INFO Looking for librem5r4 plain byzantium image
2022-05-04 17:16:13 INFO Found disk image Build 11066 'plain librem5r4 byzantium image' from Wed May  4 02:30:43 2022
2022-05-04 17:16:15 INFO Found uboot Build 82 from Fri Sep 10 20:19:03 2021
2022-05-04 17:16:15 INFO Downloading to ./tmp_librem5-flash-image_k2emxmgr
2022-05-04 17:16:16 INFO Cleaning up.
Traceback (most recent call last):
  File "/home/antonio/dev/librem5-flash-image/./scripts/librem5-flash-image", line 475, in <module>
    sys.exit(main())
  File "/home/antonio/dev/librem5-flash-image/./scripts/librem5-flash-image", line 448, in main
    download_image(urljoin(image_ref['url'], 'artifact/{}.xz').format(IMAGE.format(board)),
  File "/home/antonio/dev/librem5-flash-image/./scripts/librem5-flash-image", line 185, in download_image
    meta = yaml.safe_load(resp.text)
  File "/home/antonio/dev/librem5-flash-image/lfi/lib/python3.10/site-packages/yaml/__init__.py", line 94, in safe_load
    return load(stream, SafeLoader)
  File "/home/antonio/dev/librem5-flash-image/lfi/lib/python3.10/site-packages/yaml/__init__.py", line 72, in load
    return loader.get_single_data()
  File "/home/antonio/dev/librem5-flash-image/lfi/lib/python3.10/site-packages/yaml/constructor.py", line 37, in get_single_data
    return self.construct_document(node)
  File "/home/antonio/dev/librem5-flash-image/lfi/lib/python3.10/site-packages/yaml/constructor.py", line 46, in construct_document
    for dummy in generator:
  File "/home/antonio/dev/librem5-flash-image/lfi/lib/python3.10/site-packages/yaml/constructor.py", line 398, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/home/antonio/dev/librem5-flash-image/lfi/lib/python3.10/site-packages/yaml/constructor.py", line 204, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/home/antonio/dev/librem5-flash-image/lfi/lib/python3.10/site-packages/yaml/constructor.py", line 126, in construct_mapping
    if not isinstance(key, collections.Hashable):
AttributeError: module 'collections' has no attribute 'Hashable'

Is there anything I can verify?

Thanks

Are you sure that finished download - disk didn’t fill up? Did you try again?

1 Like

Yes, the very next second we see that there (/home) related script isn’t continuing …:

Thanks for getting straight this fact!

On the positive side, I’m not familiar with python3.10 package anyway while still using the one that works for me, when connected toward here related server:

apt list python3.9
Listing... Done
python3.9/stable,now 3.9.2-1 amd64 [installed,automatic]
python3.9 --version
Python 3.9.2

Does Jumpdrive publish a hash of their releases somewhere? How can I be sure the Jumpdrive binary is tamper-free?

Environment: Ubuntu 22.10, Gnome 43.1, uuu installed, sudo apt build-dep . installed, ./scripts/librem5-flash-image --udev installed, restarted computer, flashing from Ubuntu desktop, librem 5 phone, original cable, Evergreen, phone and battery were fully functional yesterday, just decided to reflash due to new sparclan wifi card.

I have flashed the phone before once (or was it three times) and it worked before with the instructions: Librem 5 flashing instructions

Flashing fails for me after line two “looking for librem5r4 plain byzantium image…” nothing futher happens. It appears as if it cannot download or find the image. Ideas? Are there other ways to flash the phone to try?

The device is recognized on usb with lsusb command when in flashing mode as:
Bus 009 Device 008: ID 1fc9:012b NXP Semiconductors i.MX 8M Dual/8M QuadLite/8M Quad Serial Downloader it is not recognized as Bus 001 Device 010: ID 1d6b:0104 Linux Foundation Multifunction Composite Gadget based on instructions: Connecting Librem 5 USB Serial

Might be related to: Download Image

`~/librem5-flash-image$ ./scripts/librem5-flash-image
2023-02-18 12:41:39 INFO Looking for librem5r4 plain byzantium image
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/urllib3/connection.py”, line 174, in _new_conn
conn = connection.create_connection(
File “/usr/lib/python3/dist-packages/urllib3/util/connection.py”, line 96, in create_connection
raise err
File “/usr/lib/python3/dist-packages/urllib3/util/connection.py”, line 86, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/urllib3/connectionpool.py”, line 704, in urlopen
httplib_response = self._make_request(
File “/usr/lib/python3/dist-packages/urllib3/connectionpool.py”, line 387, in _make_request
self._validate_conn(conn)
File “/usr/lib/python3/dist-packages/urllib3/connectionpool.py”, line 1043, in _validate_conn
conn.connect()
File “/usr/lib/python3/dist-packages/urllib3/connection.py”, line 358, in connect
self.sock = conn = self._new_conn()
File “/usr/lib/python3/dist-packages/urllib3/connection.py”, line 179, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f0138b13370>, ‘Connection to arm01.puri.sm timed out. (connect timeout=<object object at 0x7f0139d886e0>)’)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/requests/adapters.py”, line 440, in send
resp = conn.urlopen(
File “/usr/lib/python3/dist-packages/urllib3/connectionpool.py”, line 786, in urlopen
retries = retries.increment(
File “/usr/lib/python3/dist-packages/urllib3/util/retry.py”, line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘arm01.puri.sm’, port=443): Max retries exceeded with url: /crumbIssuer/api/json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f0138b13370>, ‘Connection to arm01.puri.sm timed out. (connect timeout=<object object at 0x7f0139d886e0>)’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/jenkins/init.py”, line 583, in jenkins_request
self._request(req))
File “/usr/lib/python3/dist-packages/jenkins/init.py”, line 557, in _request
return self._session.send(r, **_settings)
File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 645, in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python3/dist-packages/requests/adapters.py”, line 507, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host=‘arm01.puri.sm’, port=443): Max retries exceeded with url: /crumbIssuer/api/json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f0138b13370>, ‘Connection to arm01.puri.sm timed out. (connect timeout=<object object at 0x7f0139d886e0>)’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/amiga/librem5-flash-image/./scripts/librem5-flash-image”, line 519, in
sys.exit(main())
File “/home/amiga/librem5-flash-image/./scripts/librem5-flash-image”, line 455, in main
image_ref = find_image(args.image_job, board, args.variant, args.dist, args.stable)
File “/home/amiga/librem5-flash-image/./scripts/librem5-flash-image”, line 274, in find_image
return find_image_jenkins(jobname, board, variant, dist)
File “/home/amiga/librem5-flash-image/./scripts/librem5-flash-image”, line 223, in find_image_jenkins
info = server.get_job_info(jobname)
File “/usr/lib/python3/dist-packages/jenkins/init.py”, line 462, in get_job_info
response = self.jenkins_open(requests.Request(
File “/usr/lib/python3/dist-packages/jenkins/init.py”, line 564, in jenkins_open
return self.jenkins_request(req, add_crumb, resolve_auth).text
File “/usr/lib/python3/dist-packages/jenkins/init.py”, line 580, in jenkins_request
self.maybe_add_crumb(req)
File “/usr/lib/python3/dist-packages/jenkins/init.py”, line 369, in maybe_add_crumb
response = self.jenkins_open(requests.Request(
File “/usr/lib/python3/dist-packages/jenkins/init.py”, line 564, in jenkins_open
return self.jenkins_request(req, add_crumb, resolve_auth).text
File “/usr/lib/python3/dist-packages/jenkins/init.py”, line 600, in jenkins_request
raise TimeoutException(‘Error in request: %s’ % (e))
jenkins.TimeoutException: Error in request: HTTPSConnectionPool(host=‘arm01.puri.sm’, port=443): Max retries exceeded with url: /crumbIssuer/api/json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f0138b13370>, ‘Connection to arm01.puri.sm timed out. (connect timeout=<object object at 0x7f0139d886e0>)’))
`

I have flashed the phone fine before using the supplied usb-c to usb-c cable, and my own purchased usb-c to usb-c cables from baseus with power delivery usb-c cable with power delivery that work well on librem 5, which i have used to charge the phone with (and hadn’t experienced any issues with before).

The server this script is trying to connect to to download images and bootloader is down right now, sorry about that. It should just start to work once it comes back online.

just decided to reflash due to new sparclan wifi card.

You don’t need to do that at all, all you may have to do is to flash the firmware jail by following the instructions at https://source.puri.sm/Librem5/librem5-fw-jail. The script will attempt to download u-boot from Jenkins which will fail right now, but until that server comes back you can still download it from our GitLab CI job:

wget -Ofiles/u-boot-librem5.imx https://source.puri.sm/Librem5/uboot-imx/-/jobs/406070/artifacts/raw/debian/output/u-boot.imx

Afterwards, write_flash.sh should proceed as usual.

1 Like

I appreciate the quick response and will wait until Jenkins is up and running. There are a few unrelated issues as well for re-flashing i my case: phosh where i didn’t install a dependency from v.0.24 (was trying something out of sequence) and so it wouldn’t show the login screen after boot, so i figured a reflash is good at this point to resolve that, the wifi firmware jail item, and maybe get gps running - which so far hasn’t worked on my device.

Looks like Jenkins server is back up. It is looking for a job artifact file but there is a meta.yml file missing for the job 13545 with error. Is the server busy building still?

sudo ./scripts/librem5-flash-image --udev 2023-02-19 12:42:38 INFO Udev rules '/etc/udev/rules.d/70-librem5-flash-image.rules' already present amiga@amiga:~/Projects/librem5-flash-image$ ./scripts/librem5-flash-image 2023-02-19 12:42:47 INFO Looking for librem5r4 plain byzantium image 2023-02-19 12:42:55 INFO Found disk image Build 13545 'plain librem5r4 byzantium image' from Wed Feb 1 17:37:37 2023 2023-02-19 12:42:56 INFO Found uboot Build 85 from Thu Aug 25 06:22:41 2022 2023-02-19 12:42:56 INFO Downloading to ./tmp_librem5-flash-image_60zn87wf 2023-02-19 12:42:57 INFO Cleaning up. Traceback (most recent call last): File "/home/amiga/Projects/librem5-flash-image/./scripts/librem5-flash-image", line 519, in <module> sys.exit(main()) File "/home/amiga/Projects/librem5-flash-image/./scripts/librem5-flash-image", line 492, in main download_image(urljoin(image_ref['url'], 'artifact/{}.xz').format(IMAGE.format(board)), File "/home/amiga/Projects/librem5-flash-image/./scripts/librem5-flash-image", line 190, in download_image resp.raise_for_status() File "/usr/lib/python3/dist-packages/requests/models.py", line 960, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://arm01.puri.sm/job/Images/job/Image%20Build/13545/artifact/files/meta.yml

Yeah, seems so. Looks like the old image has been already deleted, but the new one is still building. Should fix itself in a matter of hours.

2 Likes

Great news- now the files are available and are downloaded and correctly flashed. However the latest image flashed is a non-encrypted image and therefore the wrong image for my use case, i am not capable enough to do post flashing encryption of the eMMC with LUKS:

    ./scripts/librem5-flash-image
2023-02-19 16:42:01 INFO Looking for librem5r4 plain byzantium image
2023-02-19 16:42:04 INFO Found disk image Build 13563 'plain librem5r4 byzantium image' from Sun Feb 19 13:33:43 2023

Is there a toggle in the script to enable looking for a encrypted image, or could you point me to the correct r4 image with encryption? Or is possible that that image is also still being built in Jenkins?

1 Like

Did you forget to add --variant luks to parameters?

1 Like

you mean the flash script, set image as = ‘plain’ --variant luks or somewhere else?, i probably need to do some reading on where to set that:

JENKINS = 'https://arm01.puri.sm'
BOARD_TYPE = 'librem5r4'
VALID_PHONE_BOARD_TYPES = ['librem5r2', 'librem5r3', 'librem5r4']
VALID_DEVKIT_BOARD_TYPES = ['devkit']
DIST = 'byzantium'
IMAGE = '{}.img'
IMAGE_VARIANT = 'plain'
$ ./librem5-flash-image --help
usage: librem5-flash-image [-h] [--dir DIR] [--dist DIST] [--skip-cleanup] [--skip-flash] [--download-attempts DOWNLOAD_ATTEMPTS] [--variant {plain,luks}] [--board {devkit,librem5r2,librem5r3,librem5r4}]
                           [--stable] [--debug] [--image-job IMAGE_JOB] [--uboot-job UBOOT_JOB] [--udev]

Flash a Librem 5 or Librem 5 Devkit.

options:
(...)
  --variant {plain,luks}
                        Image variant to download ( plain, luks ), default is 'plain'
(...)
1 Like

Awesome. I imagine i could set the flashing script to ‘luks’ too, to always pull those files?

It looks like Jenkins is still busy with that image, i’ll try it again in 3-4 hours and see:

2023-02-19 17:12:27 INFO Cleaning up.
Traceback (most recent call last):
  File "/home/amiga/Projects/librem5-flash-image/./scripts/librem5-flash-image", line 519, in <module>
    sys.exit(main())
  File "/home/amiga/Projects/librem5-flash-image/./scripts/librem5-flash-image", line 492, in main
    download_image(urljoin(image_ref['url'], 'artifact/{}.xz').format(IMAGE.format(board)),
  File "/home/amiga/Projects/librem5-flash-image/./scripts/librem5-flash-image", line 190, in download_image
    resp.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://arm01.puri.sm/job/Images/job/Image%20Build/13548/artifact/files/meta.yml

Its the second image waiting in the queue right now :slight_smile: Image builds take about 45 minutes on average, and the current one has been running for 22 minutes already.

2 Likes

@Captain_Morgan
I ran the command ./scripts/librem5r4-flash-image --variant luks --skip-cleanup to install the LUKS variant. The --skip-cleanup flag keeps the downloaded image on the PC, rather than re-downloading it if the flash should somehow fail.

delta1071

1 Like

all flashed thanks for the patience. Couple observations:

  1. needed to expand partition ssd2 to take up 32GB, known issue i think.
  2. weirdly network manager didnt have proper open vpn packages installed to allow create vpn from import file, i think first time i had this issue with pureos after reflash.
  3. also flashed the sw jail separately since that flash does not appear to be packaged with librem5r4 image.
  4. New sparclan wifi works now with sw jail!!!
  5. GPS appears still not to work for me out of the box, maybe i have an older librem 5 hardware version.

Older devices may need a hardware fix to improve GPS sensitivity. Contact support, they should be able to guide you.

1 Like