fix(installer): allow wheel users to authenticate polkit prompts
Some checks are pending
ci / test (push) Waiting to run

This commit is contained in:
Phoebus 2026-10-01 07:54:31 -07:00
parent b8152054b6
commit b3dfb79883
7 changed files with 76 additions and 2 deletions

View file

@ -5,6 +5,14 @@ this file is the curated, human-readable summary.
## Unreleased — Fast defaults with user-controlled source builds
- **Desktop administrator authentication (2026-10-01).** Installed systems
now give polkit the same `wheel` administrator group used by sudo. In the
visible disposable VM, the default root-only polkit prompt rejected the
known-good user password because root was locked. After applying the rule
to that VM, a graphical `pkexec /usr/bin/id -u` prompt accepted the user
password and returned `0`. The installer now writes the rule through
`TargetRoot`; the existing ISO predates this fix and needs a new candidate.
- **Installer and desktop reliability work (2026-10-01).** Armed BLS boot
counting only after creating the initial recovery snapshot, corrected the
boot-counter filename parser, and required the upstream failed-unit check

View file

@ -3,6 +3,18 @@
Rolling note between work sessions. **Update this file before you finish**, then
commit it. It should be short and current; use `git log` for detail.
- **Polkit wheel administrator fix (2026-10-01, overlay VM VERIFIED):**
The visible playground exposed a default root-only polkit prompt for
software updates. The installed `phoebus` user's password worked with sudo
but failed there because the installer locks root by default. Added a
generated `49-phoebus-wheel-admin.rules` file in `users_configure` and
installed the same rule in the disposable playground overlay. A graphical
`pkexec /usr/bin/id -u` prompt then accepted the user password and returned
`0`. The source fix is unit-tested; no fresh ISO/install has included it yet.
The previously verified candidate ISO is superseded by this source change:
build and requalify a new candidate before publishing. The visible VM and
host OpenCode relay remain running for the user to explore.
- **Installer/desktop reliability candidate (2026-10-01, VM VERIFIED):**
Rust hardening, recovery-first boot counting, upstream systemd boot
assessment, desktop permissions/audio/DMS startup, live UI fixes and

View file

@ -10,7 +10,7 @@ more interesting. Status vocabulary: **Done**, **Partial**, **Next**, **Later**.
| 3 | Port the deterministic core | Done | `phoebus-core` (config, plan, policy, validation, models) |
| 4 | Port the destructive backend | Done | `phoebus-executor` (storage, LUKS2, Btrfs, Portage, boot, users, services) |
| 5 | **Rust VM boot parity** | Done | Full encrypted UEFI install + boot, zero failed units, 10.7 s |
| 6 | Finish the desktop | Partial | **Mango + DankMaterialShell is the canonical desktop**; installed seat0/DRM login, panel, terminal, spotlight, lock/unlock and logout passed in a VM; physical hardware, idle and polkit prompts remain unverified |
| 6 | Finish the desktop | Partial | **Mango + DankMaterialShell is the canonical desktop**; installed seat0/DRM login, panel, terminal, spotlight, lock/unlock and logout passed in a VM. A graphical polkit prompt accepted the user password after the wheel-admin rule was applied to a disposable overlay; a fresh ISO/install with this fix, physical hardware and idle remain unverified |
| 7 | Finish Flatpak | Partial | `flatpak 1.18.1` installed, flathub configured; bounded typed `flatpak_*` actions added; fast defaults install Calibre/GIMP/Flatseal system-wide from Flathub in the target (unit-tested, fail-closed verification; VM launch/MIME/update checks not run) |
| 8 | Instrument source/binary policy | Done | measured compile times harvested from `emerge.log` (326 entries); resolved-effect previews added |
| 9 | Background update preparation | Partial | distfile fetch VM-verified; `--buildpkgonly` skipped while deps need merging (recorded Ready); activation explicit |

View file

@ -68,6 +68,7 @@ disposable VM; `serial-driver.py recovery` now automates the same check.
| Boot default pins the real kernel (not recovery) | yes | yes | yes | no |
| Recovery BLS entry (rescue.target) | yes | yes | boots (not default) | no |
| Users, passwords, sudo | yes | yes | yes | n/a |
| Polkit administrator identity for wheel | yes | yes (rule contents and permissions) | visible disposable VM overlay: user password accepted by graphical `pkexec /usr/bin/id -u`, returned `0`; installer build with rule not yet ISO-tested | no |
| Locale/timezone/keymap/services | yes | yes | yes | n/a |
| Rust VM boot parity | yes | yes | yes | no |
| Rust TUI | yes | yes | smoke test | no |
@ -86,7 +87,7 @@ disposable VM; `serial-driver.py recovery` now automates the same check.
| Balanced source kernel (`build_balanced_kernel`, broad hardware, bin fallback) | yes | yes (plan/fragment/review, refusal without fallback, separate `phoebus-balanced.conf`, default untouched; two VM-found bugs fixed: exact VDB match, `loader/entries` path) | **started, not completed** (disposable VM 2026-09-29: full distribution-config kernel build exceeded 3 h with 10 jobs, `RC=124`, no system change; needs a multi-hour window) | no |
| Installed first-login welcome (once per user, reopenable, non-blocking) | yes | yes (assets, explicit Mango session launch, QML actions, DMS seed) | fresh candidate installed desktop 30/30; screenshot inspected, Escape creates seen marker | no |
| Install metrics (time, download, peak disk, installed size) | yes | yes (report rendering; orchestration hooks) | yes (Run 13 recorded 588 compile times into target metrics) | no |
| XWayland / polkit agent / kitty / wofi | yes | no | installed, not launched | no |
| XWayland / polkit agent / kitty / wofi | yes | no | polkit agent and kitty launched in visible VM; XWayland and wofi not separately verified | no |
| Package policy + measured history | yes | yes | yes (326 entries) | no |
| Background update preparation | yes | yes | yes (fetch; buildpkgonly skipped) | no |
| Btrfs snapshots + history | yes | yes | yes | no |

View file

@ -3,6 +3,21 @@
This records the first successful end-to-end install and boot of Phoebus OS
against a disposable qcow2 disk. No physical disk was ever touched.
## 2026-10-01 Visible playground polkit correction
The visible playground booted a writable overlay of the verified
`reliability-v7-a.qcow2` install. A software-update polkit dialog rejected the
VM user's correct password while `sudo` accepted it. Root is locked in this
install; the polkit administrator identity was still root. After adding
`/etc/polkit-1/rules.d/49-phoebus-wheel-admin.rules` to the disposable
overlay and restarting polkit, the graphical polkit agent accepted that same
user password for `pkexec /usr/bin/id -u`; the terminal printed `0`.
Screenshots were inspected at
`/var/tmp/phoebus-vm/polkit-before.png` and
`/var/tmp/phoebus-vm/polkit-pkexec-result.png`. No physical disk was touched.
This validates the overlay repair; a newly built ISO and fresh installed
system with the source fix are still unverified.
## 2026-10-01 Reliability candidate
- Final candidate ISO SHA-256

View file

@ -217,6 +217,25 @@ pub fn configure_sudo(exec: &Exec) -> Result<()> {
Ok(())
}
/// Use the same administrator group for desktop authentication as for sudo.
/// Gentoo's default polkit administrator identity is root, which cannot
/// authenticate when the installer leaves the root account locked.
pub fn configure_polkit_admin(exec: &Exec) -> Result<()> {
let target = exec.target();
target.ensure_dir_mode("etc/polkit-1", 0o755)?;
target.ensure_dir_mode("etc/polkit-1/rules.d", 0o755)?;
let path = target.write(
"etc/polkit-1/rules.d/49-phoebus-wheel-admin.rules",
"polkit.addAdminRule(function(action, subject) {\n return [\"unix-group:wheel\"];\n});\n",
)?;
use std::os::unix::fs::PermissionsExt;
std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o644))
.map_err(|e| ExecError::io(path, e))?;
exec.logger
.info("polkit administrator group configured as wheel");
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
@ -338,4 +357,22 @@ mod tests {
"# custom\n"
);
}
#[test]
fn polkit_uses_wheel_for_admin_authentication() {
use std::os::unix::fs::PermissionsExt;
let exec = make_exec(RecordingRunner::new());
configure_polkit_admin(&exec).unwrap();
let path = exec
.root
.join("etc/polkit-1/rules.d/49-phoebus-wheel-admin.rules");
let rule = std::fs::read_to_string(&path).unwrap();
assert!(rule.contains("polkit.addAdminRule"));
assert!(rule.contains("unix-group:wheel"));
assert_eq!(
std::fs::metadata(path).unwrap().permissions().mode() & 0o777,
0o644
);
}
}

View file

@ -803,6 +803,7 @@ impl Installer {
let result: Result<()> = (|| {
users::create(&self.exec, &self.config, user_password, root_password)?;
users::configure_sudo(&self.exec)?;
users::configure_polkit_admin(&self.exec)?;
Ok(())
})();
self.exec.umount_chroot()?;