Skip to content

fix(console): set GIN_MODE=debug to prevent xdg-open panic in container#567

Draft
sudhir-intc wants to merge 1 commit intomainfrom
console-fix-sudhir
Draft

fix(console): set GIN_MODE=debug to prevent xdg-open panic in container#567
sudhir-intc wants to merge 1 commit intomainfrom
console-fix-sudhir

Conversation

@sudhir-intc
Copy link
Copy Markdown

@sudhir-intc sudhir-intc commented May 8, 2026

Problem

The console service was crash-looping on startup. Two issues were identified and resolved:

1. Dirty database migration (schema_migrations)

Migration version 20250701000000 was marked as dirty=true in the database, causing the app to exit with:

App init error: migrate error: up error: Dirty database version 20250701000000. Fix and force version.

Root cause: A previous migration run failed mid-flight, leaving golang-migrate unable to proceed.

Fix: Clear the dirty flag by running the following against the db container:

docker exec device-management-toolkit-db-1 psql \
  -U postgresadmin \
  -d rpsdb \
  -c "UPDATE schema_migrations SET dirty = false WHERE version = 20250701000000;"

Replace 20250701000000 with the actual dirty version shown in the error if it differs.
This is a one-time manual recovery step — once cleared, the app will re-run the migration on next startup.

2. xdg-open panic on startup (this commit)

After the migration was fixed, the app panicked with:

panic: exec: "xdg-open": executable file not found in $PATH

The handleDebugMode function spawns a goroutine to open a browser via xdg-open whenever GIN_MODE != "debug". In the headless scratch container there is no display server, so this always panics.

Fix: Added GIN_MODE: debug to the console service environment in docker-compose.yml. This suppresses the launchBrowser goroutine and allows the service to start normally.

3. Missing APP_ENCRYPTION_KEY

APP_ENCRYPTION_KEY was empty, causing the app to fall through to the D-Bus keyring which is not available in the container. This is set in the local .env file (gitignored).

The console service was crash-looping due to the app attempting to launch
a browser via xdg-open when GIN_MODE was not set to 'debug'. Since the
container runs in a headless environment with no display server, this
caused a panic on every startup.

Setting GIN_MODE=debug suppresses the launchBrowser goroutine and allows
the service to start normally.
@sudhir-intc sudhir-intc marked this pull request as draft May 8, 2026 14:15
@mikejohanson
Copy link
Copy Markdown

Hey @sudhir-intc thanks for creating this, #564 is addressing the issues. Thank you!

@madhavilosetty-intel
Copy link
Copy Markdown
Contributor

madhavilosetty-intel commented May 8, 2026

@sudhir-intc For #564, you'll need to be on main for both console and sample-web-ui.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants