Skip to content

Linux + iPhone Continuity / iMessage / SMS

fix(container): simplify Ubuntu upgrade after review

Nick Pisani54ec347812b1
diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml
index 2713c29..dcb27aa 100644
--- a/.github/workflows/container.yml
+++ b/.github/workflows/container.yml
@@ -39,18 +39,6 @@ jobs:
--build-arg TETHER_VERSION="$(git describe --tags --always)" \
--target runtime -f packaging/container/Dockerfile -t tether-runtime:ci . \
2>&1 | tee "$RUNNER_TEMP/tether-runtime.log"
- - name: Package gate and authenticated effective distro source evidence
- shell: bash
- run: |
- docker run --rm --network none --entrypoint bash -v "$PWD:/src:ro" tether-runtime:ci \
- /src/scripts/test-obex-package.sh 2>&1 | tee "$RUNNER_TEMP/tether-package.log"
- version=$(docker run --rm --network none --entrypoint dpkg-query tether-runtime:ci -W -f='${Version}' bluez-obexd)
- docker run --rm --platform '${{ matrix.platform }}' -v "$PWD:/src:ro" \
- -e "EXPECTED_OBEX_VERSION=$version" ubuntu:26.04 bash -ec '
- apt-get update
- apt-get install -y --no-install-recommends python3
- bash /src/scripts/test-obex-source-evidence.sh
- ' 2>&1 | tee "$RUNNER_TEMP/tether-source.log"
- name: Smoke test without host hardware or services
shell: bash
run: |
diff --git a/docs/CONTAINER.md b/docs/CONTAINER.md
index 265db96..ff26f7d 100644
--- a/docs/CONTAINER.md
+++ b/docs/CONTAINER.md
@@ -31,8 +31,10 @@ needs a Wayland session and is not available here.
and [README prerequisites](../README.md#bluetooth-for-messages-and-notifications).
In particular, configure the experimental bearer API and adapter class **on
the host before pairing**, then enable the iPhone's Messages/Contacts permissions.
- Upstream currently recommends BlueZ 5.86+ on the host; the Ubuntu 24.04 image
- has its own packaged OBEX client (currently 5.72). Record both versions when testing.
+ Upstream currently recommends BlueZ 5.86+ on the host. The Ubuntu 26.04 image
+ uses its own distro-packaged OBEX client, which includes the upstream RX/TX MTU
+ correction. Updating the image does not update the host's `bluetoothd`.
+ Record both versions when testing.
2. Run Avahi and the system bus on the host. Open inbound 5134/tcp and mDNS
5353/udp on the trusted local network; see the README's firewall instructions.
3. Verify the host settings, then set `TETHER_BLUEZ_SECURE_CONNECTIONS=1` in
@@ -198,6 +200,10 @@ requires handling that host's bonds separately.
- The supervisor checks the host bus, starts its session bus and OBEX with bounded
readiness waits, then starts `tetherd`. If any managed child exits, its siblings
are terminated and the container exits nonzero.
+- The image makes root-owned `/run/systemd` inaccessible to the non-root OBEX
+ process (mode `0700`). Without a logind session, this selects OBEX's built-in
+ login-monitor failure fallback, which treats the user as active. It does not
+ grant access to host login sessions or require running OBEX as root.
- SIGTERM stops the children within the 15-second Compose grace period. Docker
manages restart/backoff (`unless-stopped`); permanent setup errors remain
visible in logs rather than gaining permissions automatically.
diff --git a/packaging/container/Dockerfile b/packaging/container/Dockerfile
index 543a60f..3e34465 100644
--- a/packaging/container/Dockerfile
+++ b/packaging/container/Dockerfile
@@ -33,8 +33,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libwayland-client0 libavahi-client3 libssl3t64 libglib2.0-0t64 libsecret-1-0 libnotify4 \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /usr/local/libexec /data /downloads /run/tether-runtime /run/systemd/users \
- # Headless OBEX must use its built-in login-monitor failure fallback. Never
- # import a host login session or fabricate an active user/seat in the image.
+ # Deny the non-root OBEX login monitor access to /run/systemd/users so it
+ # uses its active-user fallback; no logind session exists in this container.
&& chmod 700 /run/systemd \
&& obexd="$(dpkg -L bluez-obexd | grep '/obexd$')" \
&& test -x "$obexd" && "$obexd" --help | grep -q -- '--nodetach' \
diff --git a/scripts/test-obex-package.sh b/scripts/test-obex-package.sh
deleted file mode 100755
index d7a11ab..0000000
--- a/scripts/test-obex-package.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-# Package boundary: reject distro OBEX releases predating the RX/TX MTU fix.
-set -euo pipefail
-version=$(dpkg-query -W -f='${Version}' bluez-obexd)
-printf 'bluez-obexd package version: %s\n' "$version"
-if ! dpkg --compare-versions "$version" ge 5.84; then
- printf 'FAIL: bluez-obexd must be >= 5.84 (RX/TX MTU fix)\n' >&2
- exit 42
-fi
-binary=$(dpkg -L bluez-obexd | grep '/obexd$')
-test -x "$binary"
-dpkg-query -S "$binary"
-"$binary" --help | grep -F -- '--nodetach'
-sha256sum "$binary"
-if [[ -L /usr/local/libexec/tether-obexd ]]; then
- [[ $(readlink -f /usr/local/libexec/tether-obexd) == "$binary" ]]
- test ! -e /usr/share/dbus-1/services/org.bluez.obex.service
- [[ $(stat -c '%u:%a' /run/systemd) == '0:700' ]]
- test ! -r /run/systemd
- printf 'PASS: non-root headless runtime cannot inherit logind seats\n'
-fi
-printf 'PASS: packaged OBEX version and executable provenance\n'
diff --git a/scripts/test-obex-source-evidence.sh b/scripts/test-obex-source-evidence.sh
deleted file mode 100755
index a6d32d8..0000000
--- a/scripts/test-obex-source-evidence.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env bash
-# Run only inside a disposable Ubuntu container, never on the host.
-set -euo pipefail
-: "${EXPECTED_OBEX_VERSION:?Supply the tested runtime package version}"
-python3 - <<'PY'
-from pathlib import Path
-p = Path('/etc/apt/sources.list.d/ubuntu.sources')
-p.write_text(p.read_text().replace('Types: deb\n', 'Types: deb deb-src\n'))
-PY
-apt-get update
-apt-get install -y --no-install-recommends dpkg-dev ca-certificates
-mkdir -p /evidence
-cd /evidence
-apt-get source "bluez=$EXPECTED_OBEX_VERSION"
-source_dir=$(printf '%s\n' bluez-*/)
-[[ $(dpkg-parsechangelog -l "$source_dir/debian/changelog" -S Version) == "$EXPECTED_OBEX_VERSION" ]]
-[[ $EXPECTED_OBEX_VERSION == 5.85-* ]]
-printf 'Authenticated Ubuntu source version: %s\n' "$EXPECTED_OBEX_VERSION"
-printf 'Applied distro patches:\n'
-cat "$source_dir/debian/patches/series"
-python3 /src/scripts/test-obex-source.py "$source_dir/obexd/src/obex.c"
-# A real-source mutation must fail for the intended assertion, not setup errors.
-sed 's/g_obex_new(io, type, rx_mtu, tx_mtu)/g_obex_new(io, type, tx_mtu, rx_mtu)/' \
- "$source_dir/obexd/src/obex.c" > reversed-obex.c
-set +e
-python3 /src/scripts/test-obex-source.py reversed-obex.c > mutation.log 2>&1
-status=$?
-set -e
-[[ $status == 1 ]]
-grep -F 'RX/TX MTU ordering regression' mutation.log
-printf 'PASS: source gate rejects reversed asymmetric RX/TX MTUs\n'
diff --git a/scripts/test-obex-source.py b/scripts/test-obex-source.py
deleted file mode 100755
index cde02d6..0000000
--- a/scripts/test-obex-source.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python3
-"""Check the effective, distro-patched source's asymmetric MTU contract."""
-import hashlib
-import pathlib
-import re
-import sys
-
-source = pathlib.Path(sys.argv[1])
-text = source.read_text()
-# Public entry accepts TX first, RX second; GObex's constructor accepts RX first.
-assert re.search(r"int\s+obex_session_start\(GIOChannel\s*\*io,\s*uint16_t\s+tx_mtu,\s*uint16_t\s+rx_mtu,", text), "unexpected session MTU signature"
-start = text.index("int obex_session_start(")
-body = text[start:text.index("\n}\n", start)]
-assert re.search(r"g_obex_new\(io,\s*type,\s*rx_mtu,\s*tx_mtu\)", body), "RX/TX MTU ordering regression"
-assert not re.search(r"g_obex_new\(io,\s*type,\s*tx_mtu,\s*rx_mtu\)", body), "reversed MTUs"
-print(f"source SHA256: {hashlib.sha256(source.read_bytes()).hexdigest()} {source}")
-print("PASS: effective distro source retains g_obex_new(io, type, rx_mtu, tx_mtu)")