RAR archives still appear in Windows-created backups, game mods, split downloads, and older software bundles, but Debian does not always expose the full extractor until the right archive component is enabled. If you need to install unrar on Debian for current encrypted or multi-part RAR files, the proprietary RARLAB package is the practical default; the open-source unrar-free package stays in Debian’s default main component but has release-specific limits.
Debian 13 (Trixie), Debian 12 (Bookworm), and Debian 11 (Bullseye) all provide both package names, but the repository components differ. Debian 13 and 12 use main contrib non-free non-free-firmware when non-free software is enabled. Debian 11 uses main contrib non-free because non-free-firmware did not exist as a separate component in Bullseye.
Install Unrar on Debian
Debian offers two RAR extraction paths. Start with the package that matches the archive type you expect to handle, because the command syntax and feature coverage are not identical.
Choose Between Unrar and unrar-free
| Package | Command | Debian Component | Best For | Trade-Offs |
|---|---|---|---|---|
| unrar | unrar | non-free | Modern RAR4/RAR5 archives, encrypted archives, password prompts, multi-part sets, and RARLAB-compatible command behavior. | Proprietary freeware license, extraction only, and requires enabling Debian’s non-free component. |
unrar-free | unrar-free | main | Open-source extraction from Debian’s default package source. Debian 13 and 12 can extract plain RAR5 archives through libarchive. | Encrypted RAR5 archives fail with Encryption is not supported. Debian 11’s older build only handles plain RAR 2.0-era archives reliably. |
Most desktop and server users should install RARLAB’s unrar package because it handles the archives people usually receive today: password-protected downloads, split archives such as .part01.rar, and RAR5 files created by current WinRAR/RAR releases. Use unrar-free when you need a DFSG-free tool and your archives are plain, unencrypted files that your Debian release can read.
Install RARLAB Unrar from Debian non-free
RARLAB’s extractor is packaged as unrar in Debian’s non-free component. APT cannot install it while only main is enabled, which is why apt may report “no installation candidate” on otherwise healthy Debian systems.
Check the Active Debian Source Format
Debian systems can use a DEB822 source file, the older /etc/apt/sources.list format, or both after upgrades and custom installs. Identify the active format before editing package sources.
if [ -f /etc/apt/sources.list.d/debian.sources ]; then
printf '%s\n' "DEB822 sources: /etc/apt/sources.list.d/debian.sources"
else
printf '%s\n' "Legacy sources list: /etc/apt/sources.list"
fi
If both files exist and contain active Debian mirror lines, keep them consistent or use the fuller walkthrough for enabling Contrib and Non-Free repositories on Debian. Duplicate or mixed source layouts can make APT harder to troubleshoot later.
Enable Debian Components in a DEB822 Source File
Use this path when your Debian base repositories are stored in /etc/apt/sources.list.d/debian.sources. The command creates a .bak backup, then normalizes every Components: line in that Debian source file to the correct component set for your release.
. /etc/os-release
if [ "$VERSION_ID" = "11" ]; then
components="main contrib non-free"
else
components="main contrib non-free non-free-firmware"
fi
sudo LC_DEBIAN_COMPONENTS="$components" perl -i.bak -pe 's/^Components:.*/Components: $ENV{LC_DEBIAN_COMPONENTS}/' /etc/apt/sources.list.d/debian.sources
Enable Debian Components in sources.list
Use this path when your Debian base repositories are stored in /etc/apt/sources.list. The command creates /etc/apt/sources.list.bak, preserves the Debian mirror URI and suite, skips active CD-ROM entries, and replaces only the component list on active deb lines.
. /etc/os-release
if [ "$VERSION_ID" = "11" ]; then
components="main contrib non-free"
else
components="main contrib non-free non-free-firmware"
fi
sudo LC_DEBIAN_COMPONENTS="$components" perl -i.bak -pe 's{^(\s*deb\s+(?:\[[^\]]+\]\s+)?(?!cdrom:)\S+\s+\S+\s+).*$}{$1$ENV{LC_DEBIAN_COMPONENTS}}' /etc/apt/sources.list
Only use these source-edit commands for Debian-owned base repository files. If
/etc/apt/sources.listalso contains vendor repositories, custom mirrors, testing/unstable suites, or hand-edited pinning workflows, edit the Debian base lines manually or use the dedicated Debian repository-component guide first.
Refresh APT Metadata for Unrar
Refresh package metadata after changing archive components so APT can consume the newly enabled non-free indexes.
sudo apt update
Confirm that APT now sees the unrar candidate from Debian’s non-free component.
apt-cache policy unrar
The candidate version differs by release. Current Debian package metadata shows these versions for amd64 systems:
| Debian Release | unrar Candidate | Component |
|---|---|---|
| Debian 13 Trixie | 1:7.1.8-1 | non-free |
| Debian 12 Bookworm | 1:6.2.6-1+deb12u1 | non-free |
| Debian 11 Bullseye | 1:6.0.3-1+deb11u3 | non-free |
Install RARLAB Unrar
Install the full RARLAB extractor after the Candidate field is no longer (none).
sudo apt install unrar
These commands use sudo because package installation and source-file edits require root privileges. If your account cannot use sudo, add administrative access first with the Debian sudoers workflow: add a user to sudoers on Debian.
Verify RARLAB Unrar
The RARLAB binary prints version and usage information when it is launched without arguments. The command does not use a normal --version flag.
unrar
Debian 13 example output begins with these lines:
UNRAR 7.12 freeware Copyright (c) 1993-2025 Alexander Roshal
Usage: unrar <command> -<switch 1> -<switch N> <archive> <files...>
<@listfiles...> <path_to_extract/>
The packaged command version is tied to the Debian release. Debian 13 currently reports UNRAR 7.12, Debian 12 reports UNRAR 6.21, and Debian 11 reports UNRAR 6.00.
Install Open-Source unrar-free from Debian main
The unrar-free package installs from Debian’s main component, so no non-free repository change is needed. This is the cleanest option when you only want a free-software extractor and your archives are plain, unencrypted files.
sudo apt update
sudo apt install unrar-free
Verify the installed binary:
unrar-free --version
Current Debian package metadata for amd64 systems shows behavior that differs enough to matter:
| Debian Release | unrar-free Candidate | Important Behavior |
|---|---|---|
| Debian 13 Trixie | 1:0.3.1-1 | Can extract a plain RAR5 archive through libarchive; encrypted RAR5 archives fail with Encryption is not supported. |
| Debian 12 Bookworm | 1:0.1.3-1 | Can extract a plain RAR5 archive through libarchive; encrypted RAR5 archives fail with Encryption is not supported. |
| Debian 11 Bullseye | 1:0.0.1+cvs20140707-4+b1 | Uses the older implementation and reports unknown archive type, only plain RAR 2.0 supported against a current RAR5 archive. |
If a RAR archive came from a current WinRAR/RAR workflow, starts with a password prompt, or arrives as a split set, install the RARLAB
unrarpackage. The open-source package is useful, but it is not a drop-in replacement for every RARLAB command or every archive feature.
Get Started with RAR Archives on Debian
RAR extraction is safer and easier to undo when you work inside a dedicated directory instead of extracting unknown files into your home folder, Downloads directory, or a system path. The examples use ~/rar-work as a disposable workspace.
Create a Working Directory for Extraction
Create a workspace and move into it before extracting files you have not inspected yet.
mkdir -p ~/rar-work
cd ~/rar-work
Copy or move the archive into that directory, or reference the archive by its full path when extracting. For ZIP, 7z, tar.gz, and tgz workflows, use the closest archive-specific handoff: install 7-Zip on Debian, unzip a directory in Linux, or extract .gz and .tgz files in Linux.
List RAR Contents Before Extracting
List the archive first when you do not fully trust the source. Look for absolute paths, unexpected scripts, duplicate filenames, or files that would overwrite existing work.
unrar l archive.rar
With unrar-free, use its list option instead:
unrar-free -t archive.rar
Extract Files with RARLAB Unrar
The x command preserves the directory structure stored inside the archive. This is usually the right choice for software bundles, backups, project folders, and multi-directory downloads.
unrar x archive.rar
Extract into a specific destination by ending the command with a directory path. The trailing slash makes the destination intent clear.
mkdir -p ~/rar-work/extracted
unrar x archive.rar ~/rar-work/extracted/
The e command flattens the archive by placing files in the current directory without recreating subdirectories. Use it only when you know filenames will not collide.
unrar e archive.rar
Test archive integrity without extracting files:
unrar t archive.rar
Extract Password-Protected RAR Archives
For sensitive archives, let unrar prompt for the password interactively. This avoids storing the password in shell history.
unrar x protected-archive.rar
An inline password works for automation or disposable test archives, but it exposes the secret to shell history and possibly process listings while the command runs.
unrar x -pYOURPASSWORD protected-archive.rar
Use interactive password entry for real private archives. If you must use an inline password in Bash, check whether
HISTCONTROL=ignorespaceis active before relying on a leading space to keep the command out of history.
Extract Multi-Part RAR Archives
Multi-part archives need all parts in the same directory. Start extraction from the first volume, not from a middle part.
unrar x archive.part01.rar
Older sets may use names such as archive.rar, archive.r00, and archive.r01. In that layout, start with archive.rar.
unrar x archive.rar
Extract Files with unrar-free
The unrar-free command extracts by default. On Debian 13 and 12, plain RAR5 archives created by current RAR tools can extract successfully; encrypted RAR5 archives still need RARLAB unrar.
unrar-free archive.rar
Place the destination directory after the optional file list. Create the destination first so the result is predictable.
mkdir -p ~/rar-work/free-extract
unrar-free archive.rar ~/rar-work/free-extract
Flatten directories with --extract-no-paths when you intentionally want all files in the current directory.
unrar-free --extract-no-paths archive.rar
Handle Untrusted RAR Archives Safely
Unknown archives can contain unexpected executable files, confusing paths, duplicate filenames, or content that overwrites something important. Use a small safety routine before extracting content from untrusted sources.
- List contents first with
unrar l archive.rarorunrar-free -t archive.rar. - Extract into a dedicated directory, then inspect the result before moving files elsewhere.
- Avoid
sudofor normal extraction into your home directory. Elevated extraction can create root-owned files and make cleanup harder. - Scan extracted files with your existing malware scanner when the archive came from an unknown sender, a public upload, or another operating system.
Update Unrar on Debian
Both packages update through APT. Use the package name you installed.
sudo apt update
sudo apt install --only-upgrade unrar
For the open-source package, target unrar-free instead:
sudo apt update
sudo apt install --only-upgrade unrar-free
If you remove non-free after installing RARLAB unrar, the package can remain installed, but APT will no longer receive its normal candidate metadata from Debian’s non-free component.
Remove Unrar from Debian
Remove the package that matches your install method. Package removal does not delete RAR files or extracted files in your home directory.
Remove RARLAB Unrar
sudo apt remove unrar
Confirm that no installed-package line remains:
dpkg -l unrar | grep '^ii' || printf '%s\n' "unrar is not installed"
Remove unrar-free
sudo apt remove unrar-free
Confirm the removal:
dpkg -l unrar-free | grep '^ii' || printf '%s\n' "unrar-free is not installed"
Revert Debian non-free Components
Only revert the repository-component change if you enabled non-free solely for unrar and no longer need proprietary Debian packages, drivers, firmware, or utilities from that component.
Restoring an old source-file backup overwrites later source edits. Check the backup first if you changed mirrors, suites, comments, or components after installing
unrar.
For DEB822 sources, restore the backup created by the install workflow and refresh APT metadata:
sudo cp /etc/apt/sources.list.d/debian.sources.bak /etc/apt/sources.list.d/debian.sources
sudo apt update
For legacy sources.list systems, restore the matching backup:
sudo cp /etc/apt/sources.list.bak /etc/apt/sources.list
sudo apt update
Fix Common Unrar Errors on Debian
Most failures come from one of four causes: non-free is not enabled, the wrong extractor is being used for the archive type, a multi-part set is incomplete, or extraction is happening in the wrong directory.
Fix No Installation Candidate for Unrar
E: Unable to locate package unrar E: Package 'unrar' has no installation candidate
This error means APT cannot see unrar in an enabled non-free package index. Check the candidate first:
apt-cache policy unrar
If the candidate is (none), verify the active source lines and look for non-free beside your Debian suites.
grep -R --line-number -E '^(deb |Components:)' /etc/apt/sources.list /etc/apt/sources.list.d/*.sources 2>/dev/null
Enable the release-appropriate components, refresh metadata with sudo apt update, and recheck apt-cache policy unrar. A visible candidate from non-free means the install command can proceed.
Fix unrar-free RAR5 and Encryption Errors
Debian 13 and 12 can extract a plain RAR5 archive with unrar-free, but encrypted RAR5 archives still fail with a direct encryption message:
unrar-free: Encryption is not supported
Debian 11’s older unrar-free build fails earlier against a current RAR5 archive:
unknown archive type, only plain RAR 2.0 supported(normal and solid archives), SFX and Volumes are NOT supported!
Switch to RARLAB unrar when either message appears, or when the archive is password-protected, split across multiple parts, or created by a current WinRAR/RAR release.
sudo apt install unrar
unrar x archive.rar
Fix CRC Failed or Wrong Password Errors
CRC failed in encrypted file. Wrong password?
This message can mean a wrong password, a corrupted archive, or a missing part from a split set. Test the archive with RARLAB unrar before extracting again.
unrar t protected-archive.rar
If the archive is split, place every part in the same directory and retest from the first volume. If the integrity test still fails with the correct password and all parts present, download or copy the archive again.
Fix No Files to Extract or Missing File Errors
RAR commands read archive-internal paths, not shell globs from your current directory. List the archive first, then extract either the full archive or the exact internal file path you need.
unrar l archive.rar
unrar x archive.rar docs/readme.txt
When extracting to a protected system location such as /opt, use a staging directory under your home folder first. Review the files, then move only the content you trust with the appropriate administrative command.
Fix Both Packages Being Installed
The packages do not use the same binary name on Debian: RARLAB’s package provides unrar, while the free package provides unrar-free. Keeping both is usually unnecessary, but it does not create a direct command conflict.
command -v unrar
command -v unrar-free
Remove the package you do not need. Keep RARLAB unrar for modern encrypted or split archives; keep unrar-free only when the open-source package covers your archive set.
Conclusion
Debian is ready to extract RAR archives with the package that matches the file type: RARLAB unrar for modern encrypted and split sets, or unrar-free for simpler open-source extraction. Keep the extraction workspace separate, list unknown archives first, and leave non-free enabled when RARLAB package updates matter.


(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:~$
Good catch, Alfred. You were right: the older article used
sudo apt-add-repository contrib non-free, which is not a valid Debian archive-component command and would leave APT unable to seeunrarinnon-free.The article now separates DEB822 sources from legacy
/etc/apt/sources.listsystems and uses release-aware component sets: Debian 13/12 usemain contrib non-free non-free-firmware, while Debian 11 usesmain contrib non-free.After enabling the right components and refreshing metadata,
apt-cache policy unrarshould show a candidate fromnon-free. Forunrar-free, no non-free component is needed; if that package is still missing, the main Debian source is disabled, stale, or pointing at an invalid mirror.Thanks again for flagging the bad command. Your report helped catch the exact failure path for systems where
unraris missing becausenon-freewas never enabled.