36

I installed unrar-free, but I cannot extract a multi-file .rar archive (my_archive.part01.rar, my_archive.part02.rar, etc.):

$ ls
my_archive.part01.rar
my_archive.part02.rar
my_archive.part03.rar
$ unrar -x my_archive.part01.rar

unrar 0.0.1  Copyright (C) 2004  Ben Asselstine, Jeroen Dekkers


Extracting from /home/morgan/my_archive.part01.rar

Extracting  my_text_file.txt      Failed
1 Failed

I have read that I need unrar-nonfree to manage multipart archives, but It seems it is not included in the official Raspbian repo.

How can I install unrar-nonfree?

1
  • 1
    This may be different than it was in 2012, but I recently installed runrar-free and the syntax is unrar e -r <filename>.rar and it will recursively extract your files.
    – Blairg23
    Dec 1, 2017 at 9:49

3 Answers 3

61
  1. Uninstall unrar-free.

    $ sudo apt-get remove unrar-free
    
  2. Make sure you have a source repository by editing /etc/apt/sources.list.

    $ cat /etc/apt/sources.list
    # Default repository
    deb http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
    # Source repository to add
    deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
    
  3. Sync the apt database.

    $ sudo apt-get update
    
  4. Create a working directory and move into it. The unrar-nonfree command will be built in this directory.

    $ cd $(mktemp -d)
    
  5. Install the dependencies required by unrar-nonfree.

    $ sudo apt-get build-dep unrar-nonfree
    
  6. Download the unrar-nonfree sources and build the .deb package.

    $ sudo apt-get source -b unrar-nonfree
    
  7. Install the generated .deb package. Its name varies depending on the version of unrar-nonfree.

    $ sudo dpkg -i unrar*.deb
    
  8. The working directory you have created in step 4 will be removed at next boot; there is no use to delete it.

Once installed, you can use either unrar or unrar-nonfree (unrar is a simlink to unrar-nonfree).

Warning: unrar-nonfree and unrar-free options are different. For instance, to extract an archive:

$ # with unrar-free
$ unrar -x my_archive.part01.rar

$ # with unrar-nonfree
$ unrar e my_archive.part01.rar

Please man unrar-nonfree for more details.

6
  • This is a small correction to Morgan's excellent answer. Step 7 should be this: $ sudo dpkg -i unrar_4.1.4-1_armhf.deb Other than this, it's a perfect solution. Tim
    – user3413
    Nov 24, 2012 at 5:53
  • 1
    Turned step #7 into sudo dpkg -i unrar*.deb so it doesn't depend on version number anymore. Aug 25, 2013 at 1:18
  • I followed these steps exactly only to get 'E: You must put some 'source' URIs in your sources.list'. I'm certain I did do that, by adding -src to a duplicate of my existing repository. The error occurred in step five. Can anyone help?
    – BenjaminJB
    Aug 24, 2014 at 14:04
  • You did entered the command sudo apt-get update, right? Is there any error message? Aug 24, 2014 at 15:25
  • Edited the answer with a small fix: remove the compile directories is not possible because we must sudo. Also added the f flag (force) so we are not questioned "are you sure?" for each file.
    – Vini.g.fer
    Mar 23, 2016 at 13:14
6

unrar-nonfree can be installed from Debian armhf repository (it's simply called unrar there). For example, in Raspbian Buster you can run:

wget -qO - https://ftp-master.debian.org/keys/archive-key-10.asc | sudo apt-key add -
echo deb http://deb.debian.org/debian buster main contrib non-free | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install unrar

Don't forget to disable the Debian repository once you're done: it's not recommended to upgrade your system while having a Debian repository as a source.

An alternative is to install 7-zip with RAR support (though it may not work on newer or password-protected archives):

sudo apt install p7zip-full
3
  • 1
    Great answer! Easy and working!
    – anonymous
    May 26, 2020 at 17:08
  • Excellent answer but how to disable the Debian repository once done? thanks
    – Hendry Lim
    Oct 31, 2020 at 1:35
  • 1
    @HendryLim Remove or comment out the deb.debian.org line from sources.list, then run apt-get update. Oct 31, 2020 at 14:03
2

this is my compiled unrar 4.20

unrar_4.20_armhf.deb

eliafino

1
  • 11
    Hi there. This answer will only stay relevant for a short period of time (until unrar) is updated. We usually like answers to be able to stand on their own, which is why teaching how to compile the package is better.
    – Jivings
    Nov 22, 2012 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.