Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Documentation/admin-guide/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ CLI,需要明确的 ``--disk``、``--boot-directory`` 和根分区身份;
TTY 入口使用相同的后端,并在显示摘要和引导选项后通过 ``y/N`` 确认。

检查过程使用私有 APK 数据库和已安装系统的信任密钥,验证签名索引、完整
软件包归档以及离线依赖。确认后的执行会再次核对磁盘、分区 UUID、索引和
软件包归档以及离线依赖。私有数据库和归档临时存放在启动时挂载的 ``/run``
tmpfs 中,结束后清理,避免占满安装介质的固定大小运行时根文件系统。
确认后的执行会再次核对磁盘、分区 UUID、索引和
已安装包数据库及 world 选择;目标已经变化时需要重新检查。已被其他路径挂载的分区、
无法唯一识别的根分区或 ESP,以及早于已安装系统的介质会在写入前被拒绝。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,17 @@ msgstr ""
" and boot options."

msgid ""
"检查过程使用私有 APK 数据库和已安装系统的信任密钥,验证签名索引、完整 软件包归档以及离线依赖。确认后的执行会再次核对磁盘、分区 "
"检查过程使用私有 APK 数据库和已安装系统的信任密钥,验证签名索引、完整 软件包归档以及离线依赖。私有数据库和归档临时存放在启动时挂载的 ``/run`` "
"tmpfs 中,结束后清理,避免占满安装介质的固定大小运行时根文件系统。 确认后的执行会再次核对磁盘、分区 "
"UUID、索引和 已安装包数据库及 world 选择;目标已经变化时需要重新检查。已被其他路径挂载的分区、 无法唯一识别的根分区或 "
"ESP,以及早于已安装系统的介质会在写入前被拒绝。"
msgstr ""
"Checks use a private APK database and the installed system's trusted keys"
" to verify signed indexes, complete package archives, and offline "
"dependencies. Execution after confirmation rechecks disks, partition "
"dependencies. The private database and archives are stored temporarily in "
"the ``/run`` tmpfs mounted at boot and removed when the operation finishes, "
"so they do not fill the installation medium's fixed-size runtime root "
"filesystem. Execution after confirmation rechecks disks, partition "
"UUIDs, indexes, the installed package database, and world selections; "
"changed targets require a fresh check. Partitions already mounted "
"elsewhere, roots or ESPs that cannot be uniquely identified, and media "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,15 @@ msgstr ""
"パスへのコピー操作は受け付けません。TTY 入口も同じバックエンドを使い、概要と起動オプションの表示後に ``y/N`` で確認します。"

msgid ""
"检查过程使用私有 APK 数据库和已安装系统的信任密钥,验证签名索引、完整 软件包归档以及离线依赖。确认后的执行会再次核对磁盘、分区 "
"检查过程使用私有 APK 数据库和已安装系统的信任密钥,验证签名索引、完整 软件包归档以及离线依赖。私有数据库和归档临时存放在启动时挂载的 ``/run`` "
"tmpfs 中,结束后清理,避免占满安装介质的固定大小运行时根文件系统。 确认后的执行会再次核对磁盘、分区 "
"UUID、索引和 已安装包数据库及 world 选择;目标已经变化时需要重新检查。已被其他路径挂载的分区、 无法唯一识别的根分区或 "
"ESP,以及早于已安装系统的介质会在写入前被拒绝。"
msgstr ""
"確認処理は専用の APK "
"データベースとインストール済みシステムの信頼鍵を使用し、署名済みインデックス、パッケージアーカイブ全体、オフライン依存関係を検証します。確定後の実行時にもディスク、パーティション"
"データベースとインストール済みシステムの信頼鍵を使用し、署名済みインデックス、パッケージアーカイブ全体、オフライン依存関係を検証します。"
"専用データベースとアーカイブは、起動時にマウントされる ``/run`` の tmpfs に一時保存し、処理の終了後に削除します。"
"これにより、インストールメディアの固定サイズの実行用ルートファイルシステムを使い切ることを防ぎます。確定後の実行時にもディスク、パーティション"
" UUID、インデックス、既存パッケージデータベース、world "
"の選択を再確認し、対象が変化していれば再検査が必要です。他の場所にマウント済みのパーティション、一意に識別できないルートや "
"ESP、既存システムより古いメディアは書き込み前に拒否します。"
Expand Down
14 changes: 12 additions & 2 deletions tools/test_installer_update_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def setUpClass(cls):
check=True, capture_output=True)
cls.key.chmod(0o600)
cls.base = cls.work / "base"
for name in ("bin", "usr/sbin", "usr/lib/reliefos", "usr/libexec/reliefos", "sbin", "tmp", "dev", "proc", "oldrepo", "newrepo",
for name in ("bin", "usr/sbin", "usr/lib/reliefos", "usr/libexec/reliefos", "sbin", "tmp", "run", "dev", "proc", "oldrepo", "newrepo",
"target/etc/apk/keys", "target/lib/apk/db", "target/etc/reliefos",
"target/home/test", "target/usr/share/external", "target/bin",
"target/usr/lib/reliefos", "target/var/lib/reliefos"):
Expand Down Expand Up @@ -124,13 +124,16 @@ def target_snapshot(self):
return {str(path.relative_to(target)): hashlib.sha256(path.read_bytes()).hexdigest()
for path in target.rglob("*") if path.is_file() and not path.is_symlink()}

def transaction(self, mode="--check", expected=None, cache_readonly=False):
def transaction(self, mode="--check", expected=None, cache_readonly=False, readonly_tmp=False):
readonly = ('mount --bind "$1/target" "$1/target"; '
'mount -o remount,bind,ro "$1/target"; ') if mode == "--check" else ""
if cache_readonly:
readonly += ('mount --bind "$1/target/usr/share/reliefos/apk/repository" '
'"$1/target/usr/share/reliefos/apk/repository"; '
'mount -o remount,bind,ro "$1/target/usr/share/reliefos/apk/repository"; ')
if readonly_tmp:
readonly += ('mount --bind "$1/tmp" "$1/tmp"; '
'mount -o remount,bind,ro "$1/tmp"; ')
result = subprocess.run([
"unshare", "-Urmp", "--fork", "sh", "-eu", "-c",
'mount --make-rprivate /; mount --bind "$1" "$1"; '
Expand All @@ -156,6 +159,13 @@ def test_signed_preflight_succeeds_with_readonly_target(self):
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertIn("reliefos-fixture", result.stdout)

def test_preflight_does_not_require_writable_runtime_tmp(self):
before = self.target_snapshot()
result = self.transaction(readonly_tmp=True)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertEqual(self.target_snapshot(), before)
self.assertFalse(list((self.runner / "run").glob("reliefos-update.*")))

def test_unsigned_index_is_rejected_before_target_changes(self):
self.index(self.runner / "newrepo", signed=False)
result = self.check()
Expand Down
8 changes: 8 additions & 0 deletions tools/test_installer_update_qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
ROOT = Path(__file__).resolve().parents[1]


def assert_no_user_faults(serial):
faults = [line for line in serial.read_text(errors="replace").splitlines()
if "user page fault signal=" in line]
assert not faults, "User processes faulted during the installer update:\n" + "\n".join(faults)


def installed_state(disk, directory):
table = json.loads(subprocess.check_output(["sfdisk", "--json", str(disk)], text=True))["partitiontable"]
partition = next(part for part in table["partitions"]
Expand Down Expand Up @@ -108,12 +114,14 @@ def main():
try:
probe.click(*probe.footer_point())
wait_page(probe, process, "Review update", args.timeout)
assert_no_user_faults(serial)
assert probe.visible_page(probe.frame("inspection-complete")) == 4
next_page(probe, 8)
wait_page(probe, process, "Review system update", args.timeout)
probe.frame("confirmation")
next_page(probe)
wait_page(probe, process, "was updated on the selected disk", args.timeout)
assert_no_user_faults(serial)
probe.frame("updated")
finally:
(output / "installer.log").write_text(installer_finish_log(
Expand Down
4 changes: 3 additions & 1 deletion userland/storage/reliefos-apk-update
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ index_sha=$(/bin/busybox sha256sum "$repository/packages.adb")
index_sha=${index_sha%% *}
[ -z "$expected_index" ] || [ "$index_sha" = "$expected_index" ] || die 'installation media changed after inspection; check the update again'

temporary=$(/bin/busybox mktemp -d /tmp/reliefos-update.XXXXXX)
# Early init mounts /run as tmpfs. The private database and verified archives
# must not consume the installation medium's fixed-size runtime root.
temporary=$(/bin/busybox mktemp -d /run/reliefos-update.XXXXXX)
update_step=repository update_action=step update_package=- update_status=0
files_done=0 files_total=0 bytes_done=0 bytes_total=0 bytes_reused=0
cache_temporary=
Expand Down