[orbit] prevent deb package installs from hanging (#31269)

This commit is contained in:
Dan Fuhry 2025-07-29 14:41:39 -04:00 committed by GitHub
parent 314bbb0e8e
commit 20519adb0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -0,0 +1,2 @@
- Orbit now sets `DEBIAN_FRONTEND=noninteractive` by default when installing Debian packages. This prevents package installation from hanging for debconf questions. Administrators may override this in install scripts if desired.
- Note that installs can still hang when a configuration file differs from the version originally installed by the package. You'll need to include `--force-confdef` (or `confnew` or `confold`) in the `dpkg` command (wrap with `-o Dpkg::Options='...'` if installing using `apt`) to prevent dpkg from hanging in these cases.

View file

@ -322,7 +322,7 @@ func (r *Runner) installSoftware(ctx context.Context, installID string, logger z
if strings.HasSuffix(installerPath, ".tgz") || strings.HasSuffix(installerPath, ".tar.gz") {
logger.Info().Msg("detected tar.gz archive, extracting to subdirectory")
extractDestination := filepath.Join(tmpDir, extractionDirectoryName)
err := os.Mkdir(extractDestination, 0700)
err := os.Mkdir(extractDestination, 0o700)
if err != nil {
logger.Err(err).Msg("failed to create directory for .tar.gz extraction")
// Using download failed exit code here to indicate that installer extraction failed
@ -424,6 +424,12 @@ func (r *Runner) runInstallerScript(ctx context.Context, scriptContents string,
env := os.Environ()
installerPathEnv := fmt.Sprintf("INSTALLER_PATH=%s", installerPath)
env = append(env, installerPathEnv)
if strings.HasSuffix(installerPath, ".deb") {
// On Debian and Ubuntu systems, packages sometimes ask the user questions
// during installation. This will cause package installation to hang
// indefinitely. Setting this envvar prevents that.
env = append(env, "DEBIAN_FRONTEND=noninteractive")
}
output, exitCode, err := execFn(ctx, scriptPath, env)
if err != nil {