NationalSecurityAgency/ghidra · error · IOException
Cannot modify settings on running server
Error message
Cannot modify settings on running server
What it means
Thrown by changeAuthCommand() after recoverConfigurationParameters() if isServerRunning() returns true. BSim deliberately refuses to rewrite postgresql.conf and pg_hba.conf while the PostgreSQL server process is active, because changes would not take effect and could corrupt the live state. The IOException tells the operator to stop the server first.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java:1281
* @throws InterruptedException if the postgres installation cannot be found
* @throws SAXException if the {@link #tuneConfig(File, File, File, File, File)} call fails
* @throws GeneralSecurityException if there is no Distinguished Name supplied
*/
private void changeAuthCommand()
throws IOException, InterruptedException, SAXException, GeneralSecurityException {
discoverPostgresInstall();
File configFile = new File(dataDirectory, POSTGRES_CONFIGFILE);
File hbaFile = new File(dataDirectory, POSTGRES_CONNECTFILE);
if (!configFile.exists()) {
throw new IOException("Data directory not initialized: run \"bsim_ctl start\" first");
}
int requestedLocalAuth = localAuthentication;
int requestedHostAuth = hostAuthentication;
int requestedPort = port;
port = -1;
recoverConfigurationParameters(configFile, hbaFile);
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());View on GitHub (pinned to d5f144c24d)
Solutions
- Stop the server with 'bsim_ctl stop <datadir>' and confirm it is down with 'bsim_ctl status <datadir>'.
- If stop fails, use 'bsim_ctl stop <datadir> --force' to terminate the process.
- Re-run 'bsim_ctl changeauth <datadir>' once status confirms the server is stopped.
Example fix
# before (server still running) bsim_ctl changeauth /opt/bsim/data --auth password # after (stop first, verify, then change) bsim_ctl stop /opt/bsim/data bsim_ctl status /opt/bsim/data bsim_ctl changeauth /opt/bsim/data --auth password
Defensive patterns
Strategy: try-catch
Validate before calling
// Confirm the server is stopped before reconfiguring:
if (bsimControl.isServerRunning(dataDirectory)) {
throw new IllegalStateException("Stop the server before changing auth settings");
} Try / catch
try {
bsimControl.run(new String[]{"changeauth", dataDir, "--auth", "password"});
} catch (IOException e) {
if (e.getMessage().contains("running server")) {
bsimControl.run(new String[]{"stop", dataDir});
bsimControl.run(new String[]{"changeauth", dataDir, "--auth", "password"});
} else {
throw e;
}
} Prevention
- Always stop the BSim server before changeauth.
- Verify server status with 'bsim_ctl status' as part of reconfiguration scripts.
- Automate stop-before-change sequencing in deployment scripts.
When it happens
Trigger: Running 'bsim_ctl changeauth <datadir>' while the PostgreSQL BSim server process for that datadir is still running.
Common situations: Operator forgets to stop the server before reconfiguring; a previous 'bsim_ctl stop' failed or was skipped; a background service manager auto-restarted the server.
Related errors
- Data directory not initialized: run "bsim_ctl start" first
- Original configuration file not present: {}
- Original connection file not present: {}
- PKI authentication requested, but certificate authority file
- {} is not a valid certification authority
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/27019eed22ce002d.
Report an issue: GitHub.