summaryrefslogtreecommitdiff
path: root/posts/librem5:crimson-daily-driver.md
blob: 4c38a501620440f2dc1687468d87cb115353b9e9 (plain)
    1 Librem5: Crimson Daily Driver
    2 =============================
    3 
    4 If you have a Librem 5 phone and are like me, you are eagerly anticipating the
    5 release of Crimson, because you're stuck on Byzantium which has a super old
    6 version of just about every package, but most notably, phosh and chatty.
    7 
    8 A few weeks ago, I finally decided to try Crimson as a daily driver, and that
    9 caused me some great headache a couple of times. I am still using it as a daily
   10 driver however, but there are still some pretty sizeable issues which I have
   11 accepted for the tie being. The issues:
   12 
   13 The issues
   14 ----------
   15 
   16 ### No camera support yet
   17 
   18 Pretty self explanatory here. I imagine this has something to do with the
   19 libcamera api that is being worked on.
   20 
   21 ### No SD card support yet
   22 
   23 ...so if you use your SD card for your home directory, you'll have to rsync to
   24 internal storage and use that. In my case, I have too much on my card, so I had
   25 to be selective about what I put on internal storage.
   26 
   27 ### You can have bluetooth audio, or phone call audio, but not both
   28 
   29 Essentially, the current config for _pulseaudio_ doesn't work with bluetooth,
   30 but audio generally works fine everywhere else. If you try switching to
   31 _pipewire_, bluetooth audio works mostly well (switching audio outputs has to
   32 be done manually from the settings), but you won't have any audio, microphone
   33 or earpiece, on phone calls. This is because of [a
   34 bug](https://gitlab.com/mobian1/callaudiod/-/issues/35) in _callaudiod_. This
   35 issue is fixed in version `1.1.10`, but Crimson currently releases with
   36 `0.1.9`, so pipewire support is broken as of 2024.10.22.
   37 
   38 
   39 ### Installing upgrades is too perilous
   40 
   41 ![Monty Python No, it's too perilous](/files/monty-python-peril.jpg)
   42 
   43 This actually isn't strictly true for me anymore. You just have to be diligent
   44 when installing updates. Currently, the package `libgl1-mesa-dri` wants to
   45 upgrade `24.2.4-1`, which breaks `phosh`, causing a crash loop. The only way to
   46 fix it is to plug in a keyboard, `ctrl + alt + f2`, then `sudo apt install -y
   47 libgl1-mesa-dri=22.3.6-1+deb12u1` to downgrade to `22.3.6-1`. Of course, while
   48 you're doing this, phosh is continuing to launch and crash every 5 seconds, so
   49 you have to keep doing the `ctrl + alt + f2` sequence as systemd takes you back
   50 to `tty1`. `<sarcasm>Isn't systemd great?</sarcasm>`
   51 
   52 To avoid the above shenanigans, every time you run `sudo apt upgrade`, _be
   53 absolutely sure_ to also run `sudo apt install
   54 libgl1-mesa-dri=22.3.6-1+deb12u1` before you reboot the phone, or you'll end up
   55 in a crash loop of phosh.
   56 
   57 
   58 I'll update this post with other caveats as they come to me. If you're fine
   59 with the above issues though, 
   60 
   61 
   62 Hacks to get running
   63 --------------------
   64 
   65 Because I want to easily rebuild this phone if I need to, without following a
   66 long checklist of shell commands, I put all this in a clean shell script which
   67 handles everything for me/you.
   68 
   69 I do recommend putting this in its own directory, as it has to download and
   70 extract some of its own artifacts (alsa-ucm-conf) to complete.
   71 
   72 In short, the following script:
   73 
   74 * Overrides the system alsa-ucm-conf ucm2 directories with those from upstream
   75   latest.
   76 
   77 * Adds a few additional apt repos to bring in "unstable" packages so the phone
   78   can actually be updated.
   79 
   80 
   81 **~/crimson/fixup.sh**
   82 
   83 ```
   84 #!/usr/bin/env bash
   85 
   86 set -euo pipefail
   87 export IFS=$'\n\t'
   88 
   89 # Deploy updated alsa-ucm-conf profiles.
   90 #
   91 # Solution discovered by [Kyle Evans]
   92 # https://source.puri.sm/Librem5/OS-issues/-/issues/346#note_264442)
   93 #
   94 fix_alsa_ucm() {
   95   local name='alsa-ucm-conf'
   96   local version='1.2.12'
   97   local src="https://github.com/alsa-project/${name}/archive/refs/tags/v${version}.tar.gz"
   98 
   99   if [ ! -f v${version}.tar.gz ]; then
  100     printf 'Downloading %s version %s\n' "${name}" "${version}"
  101     curl -o ".v${version}.tar.gz.tmp" -L -# "${src}"
  102     mv ".v${version}.tar.gz.tmp" "v${version}.tar.gz"
  103   fi
  104   tar -xf "v${version}.tar.gz"
  105 
  106   printf 'Deploying updated ucm2 profiles\n'
  107   if [ -d /usr/share/alsa/ucm2 ]; then
  108     sudo mv -v /usr/share/alsa/ucm2{,.$(date +%F)}
  109   fi
  110   sudo cp -r "${name}-${version}/ucm2" "/usr/share/alsa/ucm2"
  111 }
  112 
  113 # By default Crimson comes with the crimson repos, which is very broken last I
  114 # checked.
  115 # This adds landing, crimson-security, crimson-updates, and
  116 # crimson-updates-proposed repos. These might make things unstable in the long
  117 # run, but for now this is required to get things up and running.
  118 #
  119 apt_set_repos() {
  120   sudo tee /etc/apt/sources.list <<EOF
  121 deb http://repo.pureos.net/pureos landing main
  122 deb http://repo.pureos.net/pureos crimson main
  123 deb http://repo.pureos.net/pureos crimson-security main
  124 deb http://repo.pureos.net/pureos crimson-updates main
  125 deb http://repo.pureos.net/pureos crimson-updates-proposed main
  126 EOF
  127 }
  128 
  129 fix_alsa_ucm
  130 apt_set_repos
  131 ```
  132 
  133 Run that and most of the issues should be resolved.

Generated by cgit