Problem with extracting rar files

I’m trying to extract a rar archive on my server. This rar archive is of the following structure:

  • somefolder *
    a_file *
    another_file *


The * means that these files/folders are password protected.

It appears that the rar command line tool is not able to handle such archives. If i try the following:

rar e myarchive.rar

It gives back an error:
RAR 3.30 Copyright © 1993-2004 Eugene Roshal 22 Jan 2004
Shareware version Type RAR -? for help

games.rar is not RAR archive
No files to extract

However, I am able to extract this archive on my Windows Home PC.

On other forums people suggested to use the unrar tool. I need to execute the following command to install that:

apt-get install unrar

Now, i get the following error:
E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Probably, i don’t have sufficient rights to execute this command. Who can tell me who I need to write to to get this tool installed on the server? Or alternatively: how can I solve this problem?


I now tried the same thing on another server. There also the unrar tool wasn’t able to extract the archive. So now it appears to really be a problem with the fact that the rar archive is password protected…

Isn’t there any way that I can extract the contents of a password protected rar archive using the command line?

Do you know the password? If so you could try -hppassword or -ppassword options with rar. Doesn’t it prompt for a password?

You can’t install with apt-get, but DreamHost support might install an application if you ask.

Edit: There is also a chance the file was corrupted in upload; did you use binary?

[color=#00CC00]ANONYMOUS0=>Max Discount[/color] [color=#6600CC]ANONYMOUS2=>Max - $1.[/color] Being mean doesn’t make you look smarter than him. And bigoted remarks are not appreciated on this forum.

I’ve tried to use unzip myarchive.rar and it worked! :slight_smile:

It appears that the package extension was not valid?!

Well thanks for your answers!

That explains a lot! I’m glad you got it worked out, and thanks for sharing with us what the problem was (I had no idea what could be happening) :wink: