What Happens If Unrar Is Interrupted by SIGKILL?

When an unrar process is terminated with a SIGKILL signal (signal 9), the operating system immediately halts the process without giving it an opportunity to execute cleanup routines or close files cleanly. Consequently, the source RAR archive remains completely undamaged, but the destination directory is typically left in a dirty, inconsistent state containing partially written, corrupted, or missing files.

The Nature of SIGKILL

Unlike signals such as SIGINT (Ctrl+C) or SIGTERM, SIGKILL cannot be caught, blocked, or handled by any user-space program. When the Linux or Unix kernel receives a SIGKILL directed at unrar:

  • The kernel instantly revokes CPU execution from the process.
  • All allocated virtual memory, file descriptors, and standard handles are reclaimed by the operating system.
  • unrar cannot run any signal handlers, atexit functions, or error-handling routines.

Direct Effects on Extracted Files

Because unrar is denied an exit routine, the extracted output reflects the exact millisecond the kill occurred:

  • Fully extracted files: Any files that completed extraction before the signal was received will remain intact and usable in the destination directory.
  • The active file: The specific file currently being decompressed and written at the moment of termination will remain truncated. It will be incomplete, likely failing file format checks or application reads.
  • Pending files: Any files scheduled for extraction later in the queue will not be created.
  • No automatic cleanup: Under normal conditions or graceful interruption, an extraction tool might attempt to delete the incomplete active file. With SIGKILL, the truncated file is permanently left on disk until manually removed.

State of the Source Archive

The source .rar archive remains completely safe. Extraction is fundamentally a read operation. unrar reads blocks from the archive into memory, decompresses the data, and writes the stream to a separate output path. Because no write or modification operations are directed at the archive file itself, terminating the process—even abruptly via SIGKILL—will not corrupt the original archive.

How to Recover and Clean Up

After an abrupt termination, you must resolve the partial extraction before attempting to extract again:

  1. Verify Archive Integrity: Ensure the archive itself was not the cause of an issue by testing it:
    unrar t archive.rar
  2. Handle Incomplete Files: Manually delete the destination directory or partially extracted files to avoid leaving corrupted artifacts.
  3. Restart the Extraction: Re-run the extraction command. You can pass the overwrite flag to replace any existing partial files automatically:
    unrar x -o+ archive.rar