Reflashing the Librem 5, Up-to-Date Tutorial

I believe you don’t even need the udev rules if you prefix the use of the script when doing the actual reflash with sudo which is what I did.

2 Likes

Are you aware of any updated tutorials for making sure your firmware is all updated?

1 Like

You are already aware of it:

I am certain there are more unlisted firmware, but instructions for updating them to their latest versions on the Librem 5 are not available.

2 Likes

Thank you. I could not build all of the dependencies from your previous helpful post. Therefore the “instructions” are incomplete or possibly inaccurate, from my perspective.

1 Like

Create a separate topic and I will address your issue.

1 Like

I am not aware of one. Unless you are actually experiencing a problem, it may not be a good idea to change firmware, particularly if you won’t be able to go backwards. In other words, your starting point would be to download the version that you currently have.

dos gave you two more.

I would be inclined to drop uboot off that list. Running the reflashing script should automatically get you the latest uboot and no further action is required.

The firmware jail is more complex if you have an original phone i.e. there is no firmware jail, and that isn’t the way to mess with the Redpine firmware. By contrast, if you have a phone that came with or was upgraded to a SparkLAN card then you have a firmware jail and that is the way to update the SparkLAN firmware. If you have an original phone then with care you may be able to create the firmware jail and make the necessary changes so that it is used with Redpine (but I haven’t bothered).

The BM818 firmware is only on that list theoretically, since Purism has not made any information public as to how you get an updated firmware file and how you get it into the modem.

So here would be my updated list:

  1. Smartcard Reader
  2. USB PD controller
  3. SparkLAN card (/ alternatively maybe the Redpine card if certain conditions are met)
  4. Touchscreen controller
  5. GNSS module

I have only tackled the first two on my phone.

1 Like

This was one of my very first posts on the Purism community forums, and has lost its ability to edit a long time ago. Maybe the post edit window could be extended to a more generous duration or changed to indefinite.

The instructions have been unofficially disseminated since:

Not by me it can’t. I don’t have that level of administrative access. I would recommend just making an updated post in that topic.

1 Like

None of this worked for me!


Looking for librem5r4 luks byzantium image
Traceback (most recent call last):
  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 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 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 483, in send
    timeout = TimeoutSauce(connect=timeout, read=timeout)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/util/timeout.py", line 119, in __init__
    self._connect = self._validate_timeout(connect, "connect")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/util/timeout.py", line 156, in _validate_timeout
    raise ValueError(
ValueError: Timeout value connect was <object object at 0x7c18af9444d0>, but it must be an int, float or None.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/librem5-flash-image/./scripts/librem5-flash-image", line 538, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/librem5-flash-image/./scripts/librem5-flash-image", line 464, in main
    image_ref = find_image(args.image_job, board, args.variant, args.dist, args.stable)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/librem5-flash-image/./scripts/librem5-flash-image", line 275, in find_image
    return find_image_jenkins(jobname, board, variant, dist)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/librem5-flash-image/./scripts/librem5-flash-image", line 224, in find_image_jenkins
    info = server.get_job_info(jobname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/jenkins/__init__.py", line 475, in get_job_info
    raise JenkinsException(
jenkins.JenkinsException: Could not parse JSON info for job[Images/Image Build]

If I use --stable it’s the same only preceded by:

Found disk image Build “stable” ‘Last stable librem5r4 build’ from Fri Jun 23 22:21:4
0 2023

before the output listed above. Even --skip-download and pointing to the home directory for manually installing the librem5r4.img alongside u-boot-librem5.imx and STILL yields the same results.

To note I am using Ubuntu but have also tried the suggested PureOS live USB option after much unrelated trouble getting balena-etcher to work only to find out there are no Wi-Fi drivers (not referenced in the suggested instructions) so that option is out the window (if it even makes a difference) unless I can figure out how to download/install drivers.

1 Like

What version?

I use Ubuntu and I have successfully reflashed my phone. At this exact moment I have Ubuntu 22.04 LTS but it is badgering me for the official upgrade jump to 24.04 LTS as of the last few days.

1 Like

Ubuntu Studio 24.04.1 LTS

2 Likes

Use Debian 12 ‘Bookworm’ instead on a USB drive and let us know if it makes any difference.

1 Like

Thank you! I had the ISO downloaded anticipating I could give it a go. I re-imaged the USB drive and it worked without a hitch!! I would note that in addition to the python3-jenkins and python3-tqdm uuu will also need to ensure python3-yaml is installed as well for anyone who needs to do the same.

Feels great to finally have my Librem 5 up and running again!

4 Likes

Why does the script fail to find any image at all???

xxx@xxx:~/librem5-flash-image$ ./scripts/librem5-flash-image --skip-cleanup
2024-09-30 08:05:11 INFO Looking for librem5r4 plain byzantium image
2024-09-30 08:05:21 ERROR No matching image found

xxx@xxx:~/librem5-flash-image$ ./scripts/librem5-flash-image --variant luks --skip-cleanup
2024-09-30 08:06:05 INFO Looking for librem5r4 luks byzantium image
2024-09-30 08:06:15 ERROR No matching image found

xxx@xxx:~/librem5-flash-image$ ./scripts/librem5-flash-image --variant plain --skip-cleanup
2024-09-30 08:06:40 INFO Looking for librem5r4 plain byzantium image
2024-09-30 08:06:50 ERROR No matching image found

I’ve got everything installed on the computer according to the instructions, and I’ve already reflashed this way on this computer a couple of times in the past.

EDIT: And using the --stable argument results in:

xxx@xxx:~/librem5-flash-image$ ./scripts/librem5-flash-image --variant luks --stable
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}]
                           [--debug] [--image-job IMAGE_JOB]
                           [--uboot-job UBOOT_JOB] [--udev]
librem5-flash-image: error: unrecognized arguments: --stable
1 Like

Sorry. You probably know this but are you actually in the “librem5-flash-image” folder when you execute the script?

2 Likes

xxx@xxx:~/librem5-flash-image$ ./scripts/librem5-flash-image --variant luks --skip-cleanup

1 Like

Are you sure the Github repo is correct? (I am trying to be helpful).

2 Likes

I am pretty sure that the last time I did it, I used one of these images:

No, the Byzantium image being fetched from storage.puri.sm has an old timestamp:

Index of /librem5/images/byzantium/2023.06/librem5r4/luks/artifact/

There are a few newer Byzantium images with LUKS, but by default they are not fetched by the script:

https://storage.puri.sm/librem5/images/byzantium/2024.04/librem5r4/luks/artifact/

https://storage.puri.sm/librem5/images/byzantium/latest/librem5r4/luks/artifact/

1 Like

I followed the instructions, even though I knew I had already installed everything previously:

xxx@xxx:~$ sudo apt install git
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
git is already the newest version (1:2.34.1-1ubuntu1.11).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

xxx@xxx:~$ git clone https://source.puri.sm/Librem5/librem5-flash-image.git
fatal: destination path 'librem5-flash-image' already exists and is not an empty directory.

xxx@xxx:~$ cd librem5-flash-image

xxx@xxx:~/librem5-flash-image$ sudo add-apt-repository universe

xxx@xxx:~/librem5-flash-image$ sudo apt install uuu
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
uuu is already the newest version (1.4.193-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

xxx@xxx:~/librem5-flash-image$ sudo apt build-dep .
Note, using directory '.' to get the build dependencies
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

xxx@xxx:~/librem5-flash-image$ sudo ./scripts/librem5-flash-image --udev
2024-09-30 08:04:14 INFO Udev rules '/etc/udev/rules.d/70-librem5-flash-image.rules' already present
1 Like

I believe I simply extracted this link Index of /librem5/images/byzantium/2024.04/librem5r4/luks/artifact/ and placed the compressed image into the “librem5-flash-image” folder. I just copied and pasted it. I then ran the script:

./scripts/librem5-flash-image --variant plain --stable

I can DM you my the folder and image I used, if you like.

EDIT: I just remembered I installed the non-LUKS variant. You probably don’t want mine.

1 Like