Install unrar on Debian to extract RAR archive files from downloaded software, backup archives, and compressed media collections. The proprietary RARLAB implementation supports modern RAR4 and RAR5 archives (including encrypted and multi-part sets), while the open-source unrar-free package handles only legacy RAR1-RAR3 files. RARLAB’s unrar requires Debian’s non-free repository component; unrar-free is available from the default repositories without changes.
Start by choosing between the full-featured RARLAB build and unrar-free. Then use the workflow for everyday extraction, password-protected archives, integrity checks, and multi-part files.
These instructions cover Debian 13 (Trixie), Debian 12 (Bookworm), and Debian 11 (Bullseye). Commands work the same across supported releases unless noted otherwise. Depending on how your system was installed or upgraded, APT sources may be in DEB822
.sourcesfiles or in the legacy/etc/apt/sources.listformat.
Update Debian Before Installing Unrar
Update your package index and apply pending upgrades first. Refreshing the package cache before installation reduces dependency resolution issues and ensures the newest archive metadata for non-free components.
sudo apt update && sudo apt upgrade
If your user account does not have sudo privileges, refer to the guide on adding a user to sudoers on Debian.
Install Unrar on Debian
Debian ships two RAR extraction packages. Compare their capabilities before choosing:
| Implementation | Package | Binary / Command | Supported RAR Versions | License | Primary Use Case | Limitations |
|---|---|---|---|---|---|---|
| RARLAB Unrar (Recommended) | unrar (non-free) | unrar | RAR1-RAR5 (full support incl. encryption & multi-part) | Freeware (proprietary) | Modern archives from current WinRAR and cross-platform sources | Not open-source; packaged in non-free component; extraction only |
| unrar-free | unrar-free | unrar-free | RAR1-RAR3 only | GPL (open-source) | Auditable extraction of legacy RAR archives | No RAR4/RAR5, no modern encryption, limited feature set |
For most users, RARLAB’s unrar is the better fit because it handles modern RAR formats, supports encryption, and receives upstream security updates. Choose unrar-free only when open-source licensing is required and you work exclusively with legacy archives created before 2013.
Option 1: Install RARLAB Unrar on Debian (Recommended)
RARLAB’s version resides in Debian’s non-free component. Ensure contrib and non-free (and on Debian 12/13 optionally non-free-firmware) are enabled before installing.
Step 1: Enable Debian Repository Components for Unrar
If your system has /etc/apt/sources.list.d/debian.sources, add the required components in the DEB822 file:
sudo sed -i 's/Components: main$/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources
If your system uses /etc/apt/sources.list instead, run this release-aware command:
. /etc/os-release
if [ "$VERSION_ID" = "11" ]; then
sudo sed -i 's/ main$/ main contrib non-free/' /etc/apt/sources.list
else
sudo sed -i 's/ main non-free-firmware$/ main contrib non-free non-free-firmware/; s/ main$/ main contrib non-free non-free-firmware/' /etc/apt/sources.list
fi
This command checks your Debian release automatically. Debian 11 gets contrib non-free, while Debian 12 and 13 also include non-free-firmware.
Do not add
non-free-firmwareon Debian 11. Bullseye only usescontrib non-free.
For detailed step-by-step guidance on enabling these repositories, including manual editing methods and verification steps, refer to the guide on enabling Contrib and Non-Free repositories on Debian.
Step 2: Update APT Metadata for Unrar
After enabling the components, refresh package metadata so APT can see the unrar package in non-free:
sudo apt update
Hit:1 http://deb.debian.org/debian <your-release> InRelease Hit:2 http://security.debian.org/debian-security <your-release>-security InRelease Reading package lists... Done
Step 3: Install RARLAB Unrar on Debian
Install RARLAB’s Unrar (non-free):
sudo apt install unrar
The following NEW packages will be installed: unrar 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Step 4: Verify Unrar Installation on Debian
Verify the installation by running the unrar command without arguments. The tool displays its version and usage information:
unrar
Expected output on Debian 13 (version may differ on older releases):
UNRAR 7.12 freeware Copyright (c) 1993-2025 Alexander Roshal
Usage: unrar <command> -<switch 1> -<switch N> <archive> <files...>
<@listfiles...> <path_to_extract/>
The unrar command does not support a
--versionflag. Running it without arguments shows version and usage. On current Debian releases, Debian 13 reports UNRAR 7.12, Debian 12 reports UNRAR 6.21, and Debian 11 typically reports a 6.0.x build.
This version supports RAR4 and RAR5 (plus legacy formats), encrypted archives, and multi-part sets. It cannot create new RAR archives.
Option 2: Install Open-Source unrar-free on Debian
The
unrar-freepackage does not support RAR4 or RAR5 formats. Commands and functionality also differ from the proprietary version. Only choose this option if you work exclusively with older RAR files and require open-source tools.
Install the open-source alternative from the main repository (no non-free components required):
sudo apt install unrar-free
Verify the installation:
unrar-free --version
Expected output on Debian 13:
unrar-free 0.3.1
Version numbers differ by Debian release: Debian 12 includes unrar-free 0.1.3, and Debian 11 includes version 0.0.1. The binary is always named
unrar-free, notunrar.
Extract RAR Files with Unrar on Debian
After installing your chosen package, use these examples for common tasks (listing, full extraction with path preservation, flat extraction, password prompts, integrity testing, and multi-part handling). For other archive formats see guides on extracting .gz and .tgz files, unzipping directories, or installing 7-Zip on Debian.
Extraction with RARLAB Unrar on Debian
Extract a RAR archive with full directory paths preserved (current directory destination):
unrar x archive.rar
The x command preserves the directory structure. Use e to extract files into the current directory without recreating subdirectories:
unrar e archive.rar
Extract to a specific destination directory:
unrar x archive.rar /path/to/destination/
List archive contents without extracting:
unrar l archive.rar
Extract a password-protected archive (the tool prompts interactively for the password):
unrar x protected-archive.rar
Optional inline password (avoid if shell history retention is a concern):
unrar x -pYOURPASSWORD protected-archive.rar
Inline passwords appear in your shell history. Use interactive password entry for sensitive archives, or prefix the command with a space (in bash with
HISTCONTROL=ignorespace) to prevent history logging.
Test archive integrity without extracting:
unrar t archive.rar
Extract a multi-part set by specifying only the first volume (for example, archive.part01.rar or archive.rar when accompanied by archive.r00, archive.r01):
unrar x archive.part01.rar
Extraction with unrar-free on Debian
If you installed unrar-free, use its binary directly (limited to legacy formats):
unrar-free archive.rar
Extract to a specific destination by first creating and changing to the target directory (unrar-free focuses on simple extraction):
mkdir -p /path/to/destination && cd /path/to/destination && unrar-free /path/to/archive.rar
Handle Untrusted Unrar Archives Safely on Debian
Treat RAR archives from unknown sources cautiously. Malicious archives can contain executable files, path traversal exploits, or symlink attacks. Before extracting untrusted content:
- List the archive contents first with
unrar l archive.rarto inspect file names and paths - Extract to an isolated directory rather than your home folder
- Scan extracted content with a malware scanner if available (for example, ClamAV:
sudo apt install clamavthenclamscan -r extracted_directory)
Fix Common Unrar Errors on Debian
These checks cover the most common unrar failures on Debian: duplicate package setups, encryption-related extraction failures, unsupported archive formats, and missing non-free repository metadata.
Remove Duplicate Unrar Installations on Debian
If you installed both packages, each uses a different binary name: RARLAB’s package installs unrar (technically a symlink to unrar-nonfree), and unrar-free installs unrar-free. There is no direct file conflict, but keeping both is redundant. Remove the one you do not need:
sudo apt remove unrar-free
Or remove the proprietary version if you only need legacy extraction:
sudo apt remove unrar
Fix Unrar Password-Protected Archive Errors on Debian
If an archive fails with a password error, first confirm you are using RARLAB’s Unrar (unrar-free lacks modern encryption support). Re-enter the password carefully when prompted. For RAR5 archives with AES-256 encryption, only RARLAB’s version can decrypt them.
If you receive “CRC failed” or “No files to extract” errors despite entering the correct password, the archive may be corrupted. Test integrity first:
CRC failed in encrypted file. Wrong password?
unrar t protected-archive.rar
Fix “Unsupported RAR Format” Errors with Unrar on Debian
If unrar-free returns “unsupported format,” the archive uses RAR4 or RAR5 features. The open-source version cannot decode these formats. Switch to RARLAB’s implementation:
support for rar4 archive is currently unavailable
sudo apt remove unrar-free && sudo apt install unrar
Fix “No Installation Candidate” Errors for Unrar on Debian
E: Unable to locate package unrar E: Package 'unrar' has no installation candidate
These errors mean APT cannot see unrar in an enabled non-free repository. First check package visibility:
apt-cache policy unrar
unrar: Installed: (none) Candidate: (none) Version table:
Enable contrib non-free (and non-free-firmware on Debian 12/13) with the Step 1 commands, then refresh metadata and recheck:
sudo apt update
apt-cache policy unrar
unrar: Installed: (none) Candidate: 1:6.x.x-... Version table:
When the Candidate value is no longer (none), install unrar again with sudo apt install unrar.
Remove Unrar from Debian
If you no longer need RAR extraction capabilities, remove the installed package and clean up unused dependencies.
Remove RARLAB Unrar on Debian
Use this method if you installed the proprietary RARLAB package and want to remove it completely.
sudo apt remove unrar
sudo apt autoremove
Remove unrar-free on Debian
Use this method if you installed unrar-free and no longer need legacy RAR extraction support.
sudo apt remove unrar-free
sudo apt autoremove
Neither package stores user configuration files in your home directory, so you do not need additional cleanup.
Verify Unrar Removal on Debian
Refresh the package cache and confirm the package is no longer installed:
sudo apt update
apt-cache policy unrar
Expected output after removal (version numbers vary by release):
unrar:
Installed: (none)
Candidate: x.x.x-x
Version table:
x.x.x-x 500
500 http://deb.debian.org/debian <suite>/non-free amd64 Packages
The “Installed: (none)” line confirms successful removal. The Candidate version remains available for future reinstallation.
Frequently Asked Questions
The unrar-free package is available in Debian’s main repository and installs without enabling additional components. RARLAB’s proprietary unrar package is in the non-free component, which is not enabled by default. You must add contrib and non-free to your APT sources before installing it.
Enabling the non-free component does not weaken system security. Packages in non-free go through Debian’s build infrastructure and mirror network. The distinction is licensing: non-free packages do not meet the Debian Free Software Guidelines, so you cannot audit or modify their source code. No non-free packages install automatically; you still choose what to install.
If your system uses /etc/apt/sources.list.d/debian.sources, change the Components line back to main. If your system uses /etc/apt/sources.list, remove contrib non-free from each active deb line. Then run sudo apt update. Already-installed non-free packages remain installed but do not receive updates while non-free is disabled.
The unrar package is in Debian’s non-free repository component. If non-free is not enabled, apt cannot find a candidate version and returns errors such as no installation candidate or unable to locate package. Enable contrib and non-free, run sudo apt update, then confirm with apt-cache policy unrar before installing.
On Debian, unrar (RARLAB) supports modern RAR4 and RAR5 archives, encryption, and multi-part extraction. unrar-free is open-source but limited to older RAR formats and lacks modern encryption support. Use unrar-free only for legacy archives or licensing requirements.
Conclusion
Install unrar on Debian if you need modern RAR support that works reliably from the terminal. The RARLAB package handles RAR4 and RAR5 archives, encrypted files, and multi-part sets without the legacy limits of unrar-free. If you also manage other formats, you can install 7-Zip on Debian or extract .gz and .tgz files on Linux with the same workflow.
(py) 16:18:41al@alsdesk:~$ sudo apt install unrar
Package unrar is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
Error: Package ‘unrar’ has no installation candidate
(py) 16:18:57al@alsdesk:~$ sudo apt install unrar-free
Package unrar-free is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
Error: Package ‘unrar-free’ has no installation candidate
(py) 16:19:06al@alsdesk:~$
Thanks for reporting this, Alfred. You were absolutely right. The article had an incorrect command when you tried it in April. The guide showed
sudo apt-add-repository contrib non-free, which is not a valid Debian command and would have failed silently, leaving your repositories unchanged. This explains why both packages showed “no installation candidate.”The article has been rewritten with the correct repository configuration. For Debian 12 and 13, use this command to enable the non-free components:
Then refresh the package cache and install:
For
unrar-free, no repository changes are needed since it’s in the main component. If it still shows unavailable afterapt update, check your base repository configuration in/etc/apt/sources.list.d/debian.sourcesto ensure the main component is enabled and the URIs point to valid Debian mirrors.Your report helped identify a fundamental error in the original guide. Thank you for taking the time to document what you encountered.