Running PostmarketOS on My Librem 5

Well, that was unexpected…

Running “sudo apt-get install ./librem5_2022.10-librem5.1_arm64.deb“ from the L5 terminal, context “Downloads” directory, I got:

E: Unsupported file ./librem5_2022.10-librem5.1_arm64.deb given on commandline

“ls” does show the file there.

1 Like

Try apt instead of apt-get ?

2 Likes

I just double checked this at my end, downloaded the file ran sudo apt-get install ./u-boot-librem5_2022.10-librem5.1_arm64.deb and it installed just fine, no complaints, warnings or errors. Perhaps the file was corrupted during transmission, try redownloading.

1 Like

In case it helps, I just downloaded it.

size: 423820
sha256sum: 5eebaee15d76ec0707d3d093ec1b97fa26076e44b4e80c5a18b0dd7deca2be28

Do those match for you?

1 Like

This looks like an error on my part, I did not provide the full file name in the example code I gave previously.

the command should be…

sudo apt-get install ./u-boot-librem5_2022.10-librem5.1_arm64.deb

note the “u-boot-" in front of the previously used file name.

1 Like

Did… same.

1 Like

Not corrupted… I missed the first part (u-boot_) in my copy/paste. :man_facepalming:

.deb installed…

Flash complete…

Booting from SD…

Success! I got CRIMSON! :collision: :joy:

You guys ROCK!

3 Likes

:folded_hands:

@Loki is incredible.

2 Likes

Not that you are worried now but that is a fairly terrible error message then. I presume this is a case of Software Stack Error Burial. Some routine deep inside some library knows what the actual error was (presumably errno ENOENT 2 No such file or directory) but by the time it percolates up to the top of the software stack all useful detail is gone. :frowning:

2 Likes

get a cheap used motorola and install iodéOS on it for banks and etc.

2 Likes

I do have an intel mac bu it is failing, I have got a mac mini m1 and for now would like to be flash the phone from that. I have heard of homebrew but never needed it before, if you could share the guide for this option that would be great.

1 Like

I’ve never used apt-get to install a .deb file, but I have used dpkg -i to do so many times. No idea whether that would work in this case.

3 Likes

I have provided a rough guide below, this is taken from my notes from going through this process on macOS Sonoma a little while back, I’m not aware of any changes to newer versions that would require additional steps, but if you do encounter any problems note down the exact error message(s) and let me know.

I have assumed that you have little to no knowledge/experience of working within the Terminal so apologies in advance if this is not the case.

The quick overview of the steps are…

  1. Install Homebrew package manager (which will install Command Line Tools for Xcode as part of it process)
  2. Install uuu
  3. Download the librem5-flash-image script
  4. Install the librem5-flash-image script Python module dependencies
  5. (Optionally) Install librem5-flash-image script
  6. Go flash

There are some additional minor operations throughout the process (creating directories etc,.) but I think it’s reasonably straightforward. Everything will be done from the command line within a Terminal window so open the Terminal application from either Finder → Applications → Utilities → Terminal or Launchpad → Other → Terminal

First, Install Homebrew, the install process will make a number of checks including whether or not sudo is available so you may be prompted to enter your user password. The installer will then present the details of everything it will be doing and will wait for you to confirm by pressing enter. From the terminal, enter the follwoing install command…

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 

Hopefully the install completes without errors, note the last few lines of output, it is likely to ask you to enter a few lines of code into the terminal, the lines add the package manager to the terminal environment and are required, the lines are likely to start with echo or eval, each line should be entered separately.

Optionally turn off Homebrew’s analytics by entering brew analytics off

Next, install uuu

brew install uuu 

Next, create and change into a direcotry where the librem5-flash-image script will be downloaded and stored.

mkdir -p ~/.tools/librem5
cd ~/.tools/librem5

Next, download the librem5-flash-image script code repository

git clone --depth 1 https://source.puri.sm/Librem5/librem5-flash-image.git

Next, change into the script repository directory and install the librem5-flash-image script dependencies (Python modules). You will see some warning messages (one for each module being installed) regarding the modules being installed in a location outside of your PATH, these can be safely ignored, you may also see a notice about an newer version of pip being available, this can also be safely ignored.

cd librem5-flash-image
pip3 install -r requirements.txt

Optionally, install the librem5-flash-image script, this is not an absolute requirement but by installing/linking the script to a location in your PATH (/usr/local/bin is in the PATH by default) you can envoke the script without having to specify the path to the script or as most do, be in the same directory as the script. Using sudo here, you may be prompted for your user password.

sudo install -m 755 -d /usr/local/bin
sudo ln -s $(pwd)/scripts/librem5-flash-image /usr/local/bin/librem5-flash-image
exec zsh

Everything you have done so far installs and sets up all the tools/utilities required to flash the Librem 5 from within macOS, the set up is now done, the above steps do not need to be repeated for subsequent flashing operations.

You are now ready to flash, as mentioned earlier in the thread, I do this as a two step process, I first download the files using librem5-flash-image then I flash the Librem 5 using uuu directly. This is due to uuu requiring to be envoked with elevated privileges so to download and flash in a single operation requires envoking librem5-flash-image with sudo and I prefer to limit my use of sudo to the minimum.

You have some options (you should refer to official documentation for all options) when it comes to which image you flash to the Librem 5, you can choose an encrypted image (LUKS) or plain by adding --variant LUKS or --variant plain respectively you can choose to install the current testing/alpah release (crimson) by adding --dist crimson omitting the --dist argument will cuase the script to choose the latest build of the current release (byzantium), you can add --stable to choose the current stable build of the current release. I am choosing to use the encrypted (LUKS) variant of the testing build (crimson) here

librem5-flash-image --dir ~/Downloads/Librem5/images/crimson/alpha --skip-flash --skip-cleanup --variant luks --dist crimson

Next, change into the directory where the files have been downloaded and flash the Librem 5 with uuu, you can choose to put the Librem 5 into download mode either before or after envoking uuu it doesn’t matter (refer to the Reflashing guide you linked to previously for instructions to set the Librem 5 into download mode). Note that during the flashing process the Librem 5 changes it’s USB device identity so your machine may ask you if you want to allow access to device twice, the phone should reboot once the flashing process completes. Before envoking uuu I would resize the terminal window, at least increase it’s width, it not absolutely required, however, the current release version of uuu has an issue which will result in it throwing an exception when run in a terminal of default width (80 characters), it doesn’t affect the flashing process but does throw a notice error and ends up producing a lot of output which, if you’re not expecting it, can be a little disturbing.

cd ~/Downloads/Librem5/images/crimson/alpha
sudo uuu flash_librem5r4.lst

The Librem 5 should now be flashed with it’s new image, you can choose to keep the downloaded images files or remove them, if removing them, change out of the directory and remove it

cd ~
rm -rf ~/Downloads/Librem5
2 Likes

Thank you @Loki, following this guide I have flashed my phone from my mac mini m1!

My phone had byzantium and I flashed it to crimson then back to byzantium then back to crimson ha ha. Then with the first guide I flashed it to postmarketos.

I have flashed my phone a few times before but with help from a friend who knows more about linux than I do and I had to use their pc too, this is way easier than what I was doing so thank you again. I have used the terminal before but not much and with help so the detail you shared is very helpful.

I did see some warning when installing the python modules like you said, there were a lot should I be worried about them?

1 Like

I used pmbootstrap to build my current installation of postmarketos. I think that in the process, I might have accidentally omitted the GPS module. I currently appear to have GPS working. Pure maps works to show my current location on the map. But there is nowhere in the settings to configure, or turn on and off GPS. Does anyone else here have a missing settings GUI for GPS in postmarketos?

1 Like

In this case, the warnings can be safely ignored. You should only see the warnings when installing the modules, if I’m recalling the warning correctly it just means that you wouldn’t be able to call the module directly. These modules are called, imported or referenced from within the librem5-flash-image script when run through Python and Python should be able to locate the modules without them being on/in the PATH.

I should note that if you followed the guide and installed the modules with the same pip3 install … command then the modules will be installed for the user that installed them so if you log in under a different username then you would have to install those modules again under that user if that user also wanted to use the librem5-flash-image script. The alternative is to install the modules globally (a.k.a “site-wide”) so all users would be able to use them without having to install their own copies individually, my preference tends to lean towards installing most modules for individual users as was done in guide.

1 Like