LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-22-2009, 07:36 AM   #1
smecherel
Member
 
Registered: Jun 2008
Posts: 43

Rep: Reputation: 15
How to extract .bin files in Ubuntu 8.10?


Hello,
I have an Cisco IOS image - a bin file, that a want to extract. I manage to do that in Windows with winrar, but i don't know how to do it in Ubuntu 8.10.
In winXP:
Filename before extraction: c3745-adventerprisek9-mz.124-15.T7.bin
Filename after extraction (still a bin file): C3745-AD.BIN

Does anyone know how to extract such a file on Ubuntu?
 
Old 04-22-2009, 07:59 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

If the file is actually compressed, you could try using unrar (WIKI).

Most (linux) bin files I encountered are just executable files, most of the time the only thing you need to do before running it is setting the correct permissions (must be able to execute: chmod 750 file.bin).

Hope this helps.
 
Old 04-22-2009, 09:07 AM   #3
smecherel
Member
 
Registered: Jun 2008
Posts: 43

Original Poster
Rep: Reputation: 15
Yeah...what you say is generally true, i have read allready about that. But still the question remains. How can winrar from windows extract that file type, but his equivalent on Ubuntu cannot?

cosmin@Dell:~$ unrar x Second/Cisco/IOS/3660/c3660-p-mz.122-40.bin
UNRAR 3.80 beta 2 freeware Copyright (c) 1993-2008 Alexander Roshal
Second/Cisco/IOS/3660/c3660-p-mz.122-40.bin is not RAR archive
No files to extract


And i did test more images, all of them can be exatrcted on windows, but not on Ubuntu, or at least i dont know how
 
Old 04-22-2009, 09:14 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Maybe the problem is reverse: Windows should not be able to extract them......

Anyway, what does: file c3660-p-mz.122-40.bin tell you?

Most (linux) bin files I encounter are bash files with a payload inside them, try head -5 c3660-p-mz.122-40.bin. If this is an archive you will see gibberish as output (and possibly a messed up terminal).

Hope this gets you going again.
 
Old 04-22-2009, 10:00 AM   #5
smecherel
Member
 
Registered: Jun 2008
Posts: 43

Original Poster
Rep: Reputation: 15
cosmin@Dell:~$ file Second/Cisco/IOS/3660/c3660-p-mz.122-40.bin
Second/Cisco/IOS/3660/c3660-p-mz.122-40.bin: ELF 32-bit MSB executable, Motorola Coldfire, version 1 (SYSV), statically linked, stripped

Those images are CISCO IOS Images. And a cisco router usually stores them in flash, and at bootup it decompress that image and it loads it in RAM...I use gns3 to emulate this behavior and dont want to waste time and resources on CPU when it decompress every image that it loads up. Thats why i want to decompress them before.
On windows this works great. On linux thow, there are problems. I dont want to quit linux just for that, but i realy need this to work.

Whith head -5 is just some rubbish like you guessed.
cosmin@Dell:~$ head -5 Second/Cisco/IOS/3660/c3660-p-mz.122-40.bin
ELF4��4T 4 (D��������gDD��D�!��D@)�@��`/�
���/�
���T<�g���<��=L<��?P<��$T<��%X<��&\<��'`<��0d<��1h<�

So...does anyone has any ideas about that?
 
Old 04-22-2009, 10:11 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi again,

Both the file and head output tell you that this is an (elf) executable. You should be able to execute it. I'm not sure what the executable will do (does the file have a payload? will the payload be extracted? ......).

Did you try to execute it (after a possible chmod 750)?
 
Old 04-23-2009, 01:22 AM   #7
smecherel
Member
 
Registered: Jun 2008
Posts: 43

Original Poster
Rep: Reputation: 15
OK...let me explain to you what is with this images.

Cisco routers needs an operating sistem to work. This operating system, is ussualy compresed into bin images like this: c3745-adventerprisek9-mz.124-15.T7.bin and it is stored in flash. When it boots up, the CPU of the router decompres this image (cat take even minutes depending on size and CPU) and then, the decompressed image which is C3745-AD.BIN is loaded int-o RAM. This is the operating sistem that contains all the implementation of the commands like ping, telnet.
So, for those of you who used GNS3 (a program that can emulate a few Cisco router), you know that for every router in the topology used, the PC must extract and load every routers associated image into RAM - and if that image is uncompressed, first it must decompress it. If you have a topology with, let say 10 routers, times tens of seconds for each image to decompress, you do the math and see how long must i wait for a topology to load.

Like i have already said, it apears that the implementation of WinRar aplication under windows already knows how read and extract those bin images, so i can load the directly int-o ram.
Since i'm not a linux guru (i wish i was) i got a hint and a good reference for this forum, and i hope to get an answer. I dont like to switch to windows just for doing a decompress, and then switch back to linux for everything else.

PS: sorry about my english, it is not my native language.
 
Old 04-23-2009, 01:25 AM   #8
smecherel
Member
 
Registered: Jun 2008
Posts: 43

Original Poster
Rep: Reputation: 15
And regarding the execution of that file...it does nothing since it is an operating sistems for cisco routers

cosmin@Dell:~/Second/Cisco/IOS/3660$ ./c3660-p-mz.122-40.bin
bash: ./c3660-p-mz.122-40.bin: cannot execute binary file
cosmin@Dell:~/Second/Cisco/IOS/3660$ sudo ./c3660-p-mz.122-40.bin
./c3660-p-mz.122-40.bin: 1: Syntax error: "(" unexpected
cosmin@Dell:~/Second/Cisco/IOS/3660$ ls -l c3660-p-mz.122-40.bin
-rwx------ 1 cosmin cosmin 10543112 2007-02-26 11:45 c3660-p-mz.122-40.bin
 
Old 04-23-2009, 03:48 PM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi again,

I just downloaded c7200-adventerprisek9-mz.124-15.T6.bin, if this file has the same structure as yours then I found your answer:

unzip c3745-adventerprisek9-mz.124-15.T7.bin should do the trick.

Found the answer by running strings with c3745-adventerprisek9-mz.124-15.T7.bin as input. It mentioned pkzip and zip error messages.

Hope this helps.
 
Old 04-24-2009, 01:51 AM   #10
smecherel
Member
 
Registered: Jun 2008
Posts: 43

Original Poster
Rep: Reputation: 15
Hello. I feel so stupid, how couldnt i think of using unzip...it works like you said, thanks a lot man. I knew that linux will not let me down
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu will not open any .bin files. WDSnav Linux - General 4 12-21-2006 11:43 PM
can not extract bin files Cichlid Fedora 2 04-05-2006 09:16 PM
Can Linux extract a Bin containging img and bin mpthor Linux - Software 0 12-08-2005 08:38 AM
extract bin files?? yowwww Linux - Software 19 03-19-2004 08:44 AM
Why can not execute or extract *.bin files in redhat 9.0 and 8.0 littlecap Linux - Software 1 04-09-2003 03:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration