dbpass.py draws its password box on the terminal, not in the hook's pipe #20

Merged
marcos-mendez merged 2 commits from fix/dbpass-draws-on-the-terminal into main 2026-09-30 01:29:51 -03:00
marcos-mendez commented 2026-09-30 01:15:44 -03:00 (Migrated from github.com)

An interactive first boot of any appliance with MariaDB (keel-wordpress 19.0-3 on Proxmox, 2026-09-30) froze at the MariaDB password. firstboot.d/35mysqlpass reads bin/dbpass.py's standard output for DB_PASS=, and dialog draws on standard output: the hung dialog's fd 1 was a pipe, so the box was drawn into the hook and the console showed a frozen screen. The root password worked because 30rootpass does not capture setpass.py's output.

Fix: dbpass.py keeps a duplicate of the pipe for the KEY=value answers and points standard output, which dialog inherits, at /dev/tty. The hook is unchanged.

Tests: tests/dbpass.bats runs the script as the hook does, output redirected, inside a real pseudo terminal (script(1)), with a libinithooks stand-in whose dialog refuses to draw anywhere but a terminal; it fails on the old code and passes on the new. Also checked on the test LXC with the real dialog and libinithooks: the box appears on the screen and the hook receives DB_PASS.

An interactive first boot of any appliance with MariaDB (keel-wordpress 19.0-3 on Proxmox, 2026-09-30) froze at the MariaDB password. `firstboot.d/35mysqlpass` reads `bin/dbpass.py`'s standard output for `DB_PASS=`, and dialog draws on standard output: the hung dialog's fd 1 was a pipe, so the box was drawn into the hook and the console showed a frozen screen. The root password worked because 30rootpass does not capture setpass.py's output. Fix: dbpass.py keeps a duplicate of the pipe for the KEY=value answers and points standard output, which dialog inherits, at /dev/tty. The hook is unchanged. Tests: `tests/dbpass.bats` runs the script as the hook does, output redirected, inside a real pseudo terminal (script(1)), with a libinithooks stand-in whose dialog refuses to draw anywhere but a terminal; it fails on the old code and passes on the new. Also checked on the test LXC with the real dialog and libinithooks: the box appears on the screen and the hook receives DB_PASS.
Sign in to join this conversation.
No description provided.