NationalSecurityAgency/ghidra · error · IOException

Original connection file not present: {}

Error message

Original connection file not present: {}

What it means

Thrown by changeAuthCommand() when '<datadir>/pg_hba.conf.orig' does not exist. This is the backup of the PostgreSQL host-based authentication file, created during 'bsim_ctl start'. Without it changeauth cannot safely restore or rebuild the connection-authentication rules.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java:1298

		if (isServerRunning()) {
			throw new IOException("Cannot modify settings on running server");
		}
		if ((!authConfigPresent || (requestedHostAuth == hostAuthentication &&
			requestedLocalAuth == localAuthentication)) &&
			(requestedPort == -1 || requestedPort == port)) {
			System.out.println("No changes to make");
			return;
		}

		File serverConfigFile = Application.getModuleDataFile("serverconfig.xml").getFile(false);
		File configCopy = new File(dataDirectory, POSTGRES_CONFIGFILE + ".orig");
		if (!configCopy.exists()) {
			throw new IOException(
				"Original configuration file not present: " + configCopy.getAbsolutePath());
		}
		File hbaCopy = new File(dataDirectory, POSTGRES_CONNECTFILE + ".orig");
		if (!hbaCopy.exists()) {
			throw new IOException(
				"Original connection file not present: " + hbaCopy.getAbsolutePath());
		}
		if (requestedPort != -1 && requestedPort != port) {
			port = requestedPort;
			System.out.println("Server will now listen on port " + Integer.toString(port));
		}
		boolean newRemotePki = false;		// Are we newly enabling remote pki
		boolean newLocalPki = false;		// Are we newly enabling local pki

		if (authConfigPresent && requestedLocalAuth != localAuthentication) {
			localAuthentication = requestedLocalAuth;
			System.out.print("New local authentication: ");
			if (localAuthentication == AUTHENTICATION_PASSWORD) {
				System.out.println("password");
			}
			else if (localAuthentication == AUTHENTICATION_PKI) {
				System.out.println("pki");
				newLocalPki = true;

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Confirm the directory was initialized by 'bsim_ctl start', which creates the .orig backups.
  2. Restore the backup manually if the live pg_hba.conf is still pristine: cp <datadir>/pg_hba.conf <datadir>/pg_hba.conf.orig.
  3. Reinitialize the data directory from scratch with 'bsim_ctl start' if the original cannot be recovered.

Example fix

# before (backup missing)
bsim_ctl changeauth /opt/bsim/data --auth password
# after (restore the backup)
cp /opt/bsim/data/pg_hba.conf /opt/bsim/data/pg_hba.conf.orig
bsim_ctl changeauth /opt/bsim/data --auth password
Defensive patterns

Strategy: try-catch

Validate before calling

File orig = new File(dataDirectory, "pg_hba.conf.orig");
if (!orig.exists()) {
    throw new IllegalStateException("Missing pg_hba backup; reinitialize via 'bsim_ctl start'");
}

Try / catch

try {
    bsimControl.run(new String[]{"changeauth", dataDir, "--auth", "password"});
} catch (IOException e) {
    if (e.getMessage().contains("connection file not present")) {
        // restore pg_hba.conf.orig or reinitialize
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Running changeauth when the pg_hba.conf.orig backup file is absent (deleted, or directory was not initialized via 'bsim_ctl start').

Common situations: Same as 702: manual file cleanup, alternate initialization method, or partial restore that dropped .orig files.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/28b7b5243f5153c3. Report an issue: GitHub.