bobthenob1980
Posts: 5
Joined: Sat Jan 04, 2014 2:39 pm

Extracting RAR files

Sat Jan 04, 2014 3:00 pm

Hi all, very new to pi and this is my first post here.

It's been tricky but I've setup the Transmission torrent downloader and webui, and remote access to my pi via a vnc server. It may not seem like much but it's been a great achievement for me!

I'm now stumped on trying to install a utility to extract rar files. I've googled and tried everything I can with unrar and 7zip but I can't get either to work properly from the command line, let alone from my ultimate aim of using them from a GUI in LXDE.

using unrar:

Code: Select all

$ sudo unrar e /mnt/wdmycloud/example.rar
I get the error:

Code: Select all

/usr/bin/unrar: 1: /usr/bin/unrar: Syntax error: word unexpected (expecting ")")
WIth 7zip ven though I am using the full version of I get an 'unsupported method' error. I've tried:

Code: Select all

apt-get install p7z-rar 
as many websites suggest but the package is not available but referred to.

I have also tried downloading peazip and I have the package on my debian desktop but i cant extract it because it gives me the unrar error posted above and if I install from command line I can't find how to open the GUI in LXDE.

Many thanks in advance for any help that anyone can offer.

User avatar
jojopi
Posts: 3109
Joined: Tue Oct 11, 2011 8:38 pm

Re: Extracting RAR files

Sat Jan 04, 2014 4:56 pm

bobthenob1980 wrote:/usr/bin/unrar: 1: /usr/bin/unrar: Syntax error: word unexpected (expecting ")")
How did you install that? Try again with "sudo apt-get install --reinstall unrar-free".

Do you get the same error running the "unrar" and "unrar-free" commands without the "sudo"? (You should not need sudo to extract an archive, unless you are doing it in the wrong place.)

The p7zip-rar method does not work in Raspbian. The package is only available for certain CPU types.

bobthenob1980
Posts: 5
Joined: Sat Jan 04, 2014 2:39 pm

Re: Extracting RAR files

Sun Jan 05, 2014 10:35 am

I tried reinstall command and if I run unrar without sudo I get:

Code: Select all

-bash: /usr/bin/unrar: cannot execute binary file
If I run unrar with sudo I get the same syntax error as before.

However if I run unrar-free with sudo I get this:

[email protected] /mnt/wdmycloud $ sudo unrar-free example.rar

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


Extracting from /mnt/wdmycloud/example.rar

Extracting example/BackPhoto.hx Failed
Extracting example/compile.hxml OK
Extracting example/DS_Note.ttf Failed
Extracting example/Gallery.hx Failed
Extracting example/images/01.jpg Failed
Extracting example/images/02.jpg Failed
Extracting example/images/03.jpg Failed
Extracting example/images/04.jpg Failed
Extracting example/images/05.jpg Failed
Extracting example/library.xml Failed
Extracting example/Main.hx Failed
Extracting example/Photo.hx Failed
11 Failed


If I don't use sudo I get the above but it says failure is because of permissions. Note that one of the above files extracts 'ok'.

It looks lie using unrar-free rather than unrar nearly gets me there but what is causing the failure?

Thanks

User avatar
jojopi
Posts: 3109
Joined: Tue Oct 11, 2011 8:38 pm

Re: Extracting RAR files

Sun Jan 05, 2014 12:32 pm

You did not answer the question of how you installed unrar the first time. Apparently the binary you have is for a different CPU type, so the Pi cannot run it.

(It is dangerous to install Debian packages on Raspbian; they may appear to be compatible but do not run. If you have added any Debian repositories to your apt sources, you must remove them before any libraries are "upgraded" making your system unbootable.)

Sorry, I had not realised the compatibility of unrar-free was quite so bad. To extract that archive you will need to build the nonfree version from source. Procedure is as follows:

Code: Select all

echo "deb-src http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi"| sudo tee /etc/apt/sources.list.d/raspbian-src.list
sudo apt-get update
sudo apt-get build-dep unrar-nonfree
apt-get source -b unrar-nonfree
sudo dpkg -i unrar_*_armhf.deb
You can also try building 7zip unrar support the same way. Repeat the last three steps replacing "unrar-nonfree" with "p7zip-rar", then "sudo apt-get install p7zip-full".

bobthenob1980
Posts: 5
Joined: Sat Jan 04, 2014 2:39 pm

Re: Extracting RAR files

Sun Jan 05, 2014 3:17 pm

Thanks for this, I will try when I get home.

How do I link either unrar or 7zip to Xarchiver or any other GUI frontend?

Thanks

bobthenob1980
Posts: 5
Joined: Sat Jan 04, 2014 2:39 pm

Re: Extracting RAR files

Sun Jan 05, 2014 4:11 pm

OK I have managed to use the unrar-nonfree command to extract a file! I was following a guide that was meant for RPi and had no idea of the errors contained in it so thanks for putting me straight. I have amended sources.list to only contain raspbian sources.

How can I link unrar-free to a GUI like Xarchiver or anything else?

many thanks for all your help.

kreisler
Posts: 23
Joined: Fri Mar 10, 2017 4:08 pm
Location: Germany

Re: Extracting RAR files

Mon Jul 03, 2017 9:42 am

jojopi wrote:

Code: Select all

echo "deb-src http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi"| sudo tee /etc/apt/sources.list.d/raspbian-src.list
sudo apt-get update
sudo apt-get build-dep unrar-nonfree
apt-get source -b unrar-nonfree
sudo dpkg -i unrar_*_armhf.deb
I am on the latest noobs 2.4.0 and followed thru with the above set, the package was
unrar_4.1.4-1+deb7u2_armf.deb
and now my Xarchiver can unrar the multi-volume RAR file thanks!

I must say my UX of Raspbian GUI is horrible, feels more primitive than Win3.11, no offense intended.

Return to “Beginners”