NationalSecurityAgency/ghidra · error · IOException

Unable to delete password file: {}

Error message

Unable to delete password file: {}

What it means

Thrown by cleanupPasswordData when File.delete() returns false for the temporary password file during scrubbing. The tool scrubs the temp file holding the admin password; a failed delete means sensitive material may remain on disk, so it raises rather than silently continuing.

Source

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

			if (repeatPass[i] != password[i]) {
				return false;
			}
		}
		return true;
	}

	/**
	 * Make sure password data, stored either in the heap or in a temporary file, is scrubbed
	 * @throws IOException if the password file cannot be deleted
	 */
	private void cleanupPasswordData() throws IOException {

		clearPasswordData(adminPasswordData);
		adminPasswordData = null;

		if (passwordFile != null) {
			if (!passwordFile.delete()) {
				throw new IOException(
					"Unable to delete password file: " + passwordFile.getAbsolutePath());
			}
			passwordFile = null;
		}
	}

	/**
	 * Servers that allow SSL connections are required to have a certificate that allows it to
	 * authenticate itself to users.  The BSim server does not authenticate itself to clients, but
	 * a certificate must still be present.  We generate a self-signed certificate.
	 * @param certFile will hold the public portion of the generated certificate
	 * @param passFile will hold the private portion
	 * @throws IOException if the password file cannot be opened for writing
	 * @throws GeneralSecurityException if the keystore cannot be created
	 */
	private void generateSelfSignedCertificate(File certFile, File passFile)
			throws IOException, GeneralSecurityException {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Ensure no other process (postgres init, AV, indexer) holds the temp file open.
  2. Verify delete permission on the temp directory (java.io.tmpdir).
  3. Manually remove the leftover temp file (bsim*.dat) if scrub failed, to avoid leaving the password on disk.
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure the temp dir is writable/deletable before starting password setup.
File tmp = new File(System.getProperty("java.io.tmpdir"));
if (!tmp.canWrite()) {
    System.err.println("Temp dir not writable; password scrub may fail: " + tmp);
    return;
}

Try / catch

try {
    launchable.cleanupPasswordData();
} catch (IOException e) {
    if (e.getMessage().startsWith("Unable to delete password file:")) {
        // Scrub failed: locate and manually remove the bsim*.dat file to avoid leaving secrets.
        log.warn("Manual cleanup required: " + e.getMessage());
    }
    throw e;
}

Prevention

When it happens

Trigger: The temp password file cannot be removed because another process holds it open, permissions were changed, or it was already deleted (line 536).

Common situations: Concurrent process holding the file, antivirus/indexer locking files on Windows, restrictive temp-dir permissions, or the file removed out-of-band.

Related errors


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