NationalSecurityAgency/ghidra · error · IOException
PostgreSQL pg_ctl command not found: {}
Error message
PostgreSQL pg_ctl command not found: {} What it means
Thrown by discoverPostgresInstall when Application.getOSFile(POSTGRES) located a postgres root directory but bin/pg_ctl is not a regular file there. The install bundle is present but incomplete or corrupt, so the control binary cannot be invoked.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java:784
}
else {
loadLibraryVar = "LD_LIBRARY_PATH";
}
File postgresLibrary = new File(postgresRoot, "lib");
loadLibraryValue = postgresLibrary.getAbsolutePath();
}
/**
* Locate the "pg_ctl" executable within the PostgreSQL installation. Unpack the installation
* if it is not already.
* @throws IOException if postgres folder cannot be determined
*/
private void discoverPostgresInstall() throws IOException {
try {
postgresRoot = Application.getOSFile(POSTGRES); // find PostgreSQL build for os
postgresControl = new File(postgresRoot, "bin/pg_ctl");
if (!postgresControl.isFile()) {
throw new IOException("PostgreSQL pg_ctl command not found: " + postgresControl);
}
setupPostgresSharedLibrary();
}
catch (OSFileNotFoundException e) {
throw new IOException("PostgreSQL not found and must be built (see " +
POSTGRES_BUILD_SCRIPT + ", view script for details)");
}
}
/**
* Recover the parameter settings from a previously initialized server
* @param configFile is main configuration file: port, adminPassword, hostAuthentication
* @param hbaFile is the connection file
* @throws IOException if the server port is invalid
*/
private void recoverConfigurationParameters(File configFile, File hbaFile) throws IOException {
ServerConfig serverConfig = new ServerConfig();
serverConfig.addKey("port", "");View on GitHub (pinned to d5f144c24d)
Solutions
- Re-extract or rebuild the postgres bundle so bin/pg_ctl is present.
- Verify bin/pg_ctl exists and is executable for the current OS/arch.
- Confirm the bundle matches the host platform (Application.getOSFile selects per-OS).
Defensive patterns
Strategy: validation
Validate before calling
// Verify pg_ctl exists in the postgres bundle before invoking the tool.
File pgCtl = new File(postgresRoot, "bin/pg_ctl");
if (!pgCtl.isFile()) {
System.err.println("bin/pg_ctl missing under " + postgresRoot + "; re-extract the bundle.");
return;
} Try / catch
try {
launchable.discoverPostgresInstall();
} catch (IOException e) {
if (e.getMessage().startsWith("PostgreSQL pg_ctl command not found:")) {
System.err.println("Postgres bundle incomplete; rebuild/re-extract it.");
}
throw e;
} Prevention
- After extracting the postgres bundle, verify bin/pg_ctl is present and executable.
- Use the OS/arch-matching bundle (Application.getOSFile selects per platform).
- Re-extract if files appear missing or corrupted.
When it happens
Trigger: The OS-specific postgres bundle exists under the application layout, yet `new File(postgresRoot, "bin/pg_ctl").isFile()` is false, firing at line 784.
Common situations: Partial/corrupted extraction of the postgres bundle, wrong platform bundle for the host OS/arch, or files removed after extraction.
Related errors
- PostgreSQL not found and must be built (see {}, view script
- Error initializing postgres database
- Could not start postgres server process
- Could not create database:
- Cannot find Python source for {name}. If this is a remote s
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/38658a114c6972de.
Report an issue: GitHub.