Librem 5 Storage Capacity

32 GB was too small even for 2017, and $2k is too much for twice the storage capacity. I just bought a large capacity microSD, and I am going to attempt to make this device usable, storage-wise as my next project. It is a painpoint that this is a project, and not something easily configurable in the GUI settings.

I will try to document the steps I am doing here, and if people have suggestions on how to accomplish it, or other advice, appreciate your contribution.

My goals are:

  • OS: Install ARM PureOS (ideally Crimson), with a single LUKS encryption password at boot that unlocks both the internal and external storage, to the Librem 5
  • Folders: Have the folders under the user mapped somehow to the microSD, such that when I click the folders on the sidepane of the files app (Documents/Downloads/Music/Pictures/Videos), it takes me to the microSD (so internal storage may be /user/shortcuts so that they don’t take up space there, while external may be /user/folders or something. Firefox & Torrents would be remapped to download there.
  • Flatpak Apps: Have flatpaks install by default to the external storage, with desktop shortcuts that appear in the app drawer
  • Waydroid: Install Waydroid on the internal storage for speed, but figure out a way to have apks movable to the external storage
  • App Binaries: Potentially have binaries install there too, including moving over existing programs, but is probably not a good idea to do, and thus not worth the effort considering the complexity & maintenance likely required on top of these not taking up too much space if most apps are installed via flatpak
3 Likes

Crimson is not ideal unless you like missing dependencies, but here are the steps regardless:

There is no LUKS variant for Crimson at the moment, so I suggest using Byzantium with LUKS instead.

1 Like

Also, see these highly relevant resources:

At this point, I am obligated to remind you to externally back up your important files before performing any of these experimental procedures. The last resource requires the latest DAS U-Boot firmware image, which has been included in the above steps to flashing Crimson on the Librem 5.

I forgot all about these over the years, but I have been wanting to do this myself with a slightly different configuration.

2 Likes

Automatic Disk Decryption of microSD
I was able to accomplish this entirely via GUI in the Disks app.

  1. Under SD Card Reader in Disks, format your disk to EXT4, and set it up with LUKS encryption; I used the same decryption password, but you don’t need to for this to work.
  2. Select the EXT4 partition, click the gear icon, then Edit Mount Options
  3. Select Mount at System Startup, and optionally Show in User Interface
  4. Rotate your screen to landscape so you can access and click the OK button
  5. Select the LUKS partition, click the gear icon, then Edit Encryption Options, and enter your login password to authenticate
  6. Select Unlock at System Startup, and do the same screen rotation thing to click OK

Limitations: Currently there is a bug specifically on the Librem 5, where the microSD will become unreadable usually/always after coming out of suspend. The Librem 14 does not suffer from the same issue.

3 Likes

Installation of Flatpaks to the microSD

  1. Create a folder flatpak on the microSD for your flatpaks to go into
  2. Navigate to /etc, and create a new folder called flatpak, and within that a new folder called installations.d
  3. In /etc/flatpak/installations.d, create a new configuration file; I named mine microSD.conf
  4. Paste the following into the file
[Installation "microSD"]
Path=/mnt/microSD_EXT4_UUID/flatpak
DisplayName=microSD Installation
StorageType=sdcard

With the only exception that you replace microSD_EXT4_UUID with the UUID of your physical disk (not the LUKS encrypted UUID). This can be found in the Disks app.

  1. Install your flatpak directory to this disk. In this case, we will be adding Flathub to it via command line. If you have a previous Flathub repo, remove it so that you can install to the microSD by default
flatpak remote-add --if-not-exists --installation=microSD flathub https://dl.flathub.org/repo/flathub.flatpakrepo

This references the .conf file we created earlier, where it associates microSD with the location we want

  1. Go to PureOS store, and all apps from flathub will install to your secondary disk. There is a limitation (I don’t recall with what specifically), where you cannot change it to display differently as System or User, to instead say microSD unfortunately, but so long as the only install of Flathub in this case is to the microSD, system installations should install there. However, if installing from the command line, you can reference this location by name, regardless of where you install your repo to manually install to it, or a different location.

They will automatically appear in your app drawer without any additional steps required.

You can double check it is installing to the right location by checking disk usage on disks, download a big app, and see if there is less space on the microSD. You can also check by looking at the microSD flatpak folder itself too, to see if your app installed there.

This can be repeated for the Purism Flatpaks too if you want, after removing and re-adding it.

5 Likes

Alternatives & Comments
In addition to what was linked above by FranklyFlawless, someone else mentioned that they just have the entire OS running from a microSD, which you could do as well. Then you’d need to hold I think volume down as you boot, to get into that installation. The advantage of this, is it makes it easy to have a secondary OS on the eMMC in the phone that you can use if asked by prying eyes, and a secret one you can use encrypted with your real stuff on there. I’m sure there are other methods different, or that can be used in combination with this as well, such as with the SC.

I haven’t mapped the default Music/Documents/Photos/Videos folders to the microSD, but imagine this could be solved with a symbolic link.

I haven’t noticed any deal-breaking slowdowns from using Flatpaks from the microSD, but I’m sure they run a little slower from doing so, and maybe more noticable with Waydroid if you did the model where your OS is on the microSD. It is too complex a task to have Waydroid on the microSD without having the whole OS there too. The furthest I have gotten with Waydroid, is the ability to access folders on Linux, from the Android Java virtual OS. Perhaps there is a way to “Install to microSD” from Android, such that APKs also install to your microSD. Haven’t explored it in detail yet.

In addition to the issue mentioned above with suspend on the Librem 5, which will either require frequent restarts or keeping your phone from going to suspend (we will need to wait for Purism’s fix), there are also some other issues that I haven’t figured out yet, but might be doable:

  1. Apps that look for flatpaks in their default install location (e.g. Flatseal, and others), don’t recognize the flatpaks installed already. I’m thinking maybe this can be solved with a symbolic link between the two directories so the OS thinks that they are in the default location, but this could equally cause different issues

  2. Apps cannot access libsecret on the eMMC. This means apps like Authenticator, Flare, Fractal, Tuba, etc… that rely on it, are unusable.

I don’t know how to solve these 2 issues yet, but if someone figured them out, please feel free to share (or correct my steps thus-far), with what solution you’ve used.

4 Likes

I have tried following your steps but I am getting hung up at this:

purism@pureos:~$ flatpak remote-add --if-not-exists --installation=microSD flathub https://dl.flathub.org/repo/flathub.flatpakrepo
error: Creating repo: mkdirat: No such file or directory
purism@pureos:~$

Nevermind, figured that out.
Now the problem is it won’t allow me to install anything because of gpg issues.

purism@pureos:~$ flatpak install lugsole
Looking for matches…
F: An error was encountered searching remote ‘flathub’ for ‘lugsole’: Unable to load summary from remote flathub: Signature made Tue 13 Feb 2024 16:19:15 MST using RSA key ID 562702E9E3ED7EE8
Can't check signature: public key not found
error: No remote refs found similar to ‘lugsole’
purism@pureos:~$
1 Like