LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-22-2020, 02:25 PM   #16
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026
Blog Entries: 3

Rep: Reputation: 133Reputation: 133

Quote:
Originally Posted by auge View Post
When you have "thunar-archive-plugin" installed.
I just ran a live Ubuntu - the "Extract Here.." option was available on the right click menu - It's installed as a default. See attachment. I did this with a live usb stick on my machine.

You can try it for yourself at distrotest:

https://distrotest.net/Ubuntu
Attached Thumbnails
Click image for larger version

Name:	ExtractHere.png
Views:	10
Size:	121.9 KB
ID:	34973  

Last edited by GPGAgent; 12-22-2020 at 05:14 PM.
 
Old 12-22-2020, 05:50 PM   #17
25wood25
LQ Newbie
 
Registered: Dec 2020
Posts: 10

Original Poster
Rep: Reputation: Disabled
Utec on the 12th dec sent the correct Command lines from my original post that was confusing me re:-
unzip g935fxxxxxxxxxxx.zip –d firmware && cd firmware for f in *.tar; do tar xf $f; done .
The first line works OK and produces 5 meta.tar files. I have tried to uzip those in a terminal but get the error that the Ubuntu decompression cannot work with the file. The instructions I have stipulate that these meta.tar files have to be decompressed with the liblz4 tool from snap which I have installed, but unfortunately the second command line does not work as it returns the error 'bash: syntax error near unexpected token 'do'. Any further ideas will help but these files are so compressed I doubt standard 7zip type archivers can be used.

The command you pasted is 2 command line arguments, the first is
Code:

unzip g935fxxxxxxxxxxx.zip –d firmware

which is unzipping the file 935fxxxxxxx.zip into a directory it will make named 'firmware'.
The "&&" is a Unix command tha runs the next command
Code:

cd firmware for f in *.tar; do tar xf $f; done

which will change directory to the newly made fireware, and then run the bash code
Code:

for f in *.tar; do tar xf $f; done

which will go through the directory looking for *.tar files and then extracting them with
Code:

tar xf $f

were $f is the file name.
 
Old 12-22-2020, 06:07 PM   #18
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
After the unzip, there are two commands on one line, with no delimiter. They should be done as follows:
[code]cd firmware]then press the Enter key.
Code:
for f in *.tar do tar xf $f; done
Or else you can do it in one go, with
Code:
cd firmware; for f in *.tar; do tar xf $f; done
Notice the semicolon after firmware, that is essential. You put it in the wrong place. It is also essential that firmware is the directory directly below the current directory. That's why the first method I posted is better. If you don't get into the firmware directory via the cd command, then you have to find the correct directory which contains the extracted files. You cannot blindly follow instructions without understanding what they do, and how! If you don't understand what you're doing, you can totally bork your system and/or your phone. If you cannot read and understand, you should not be doing any of these things. That's why I fear for your phone. You can brick it if you aren't careful.
 
Old 12-22-2020, 10:39 PM   #19
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: Ubuntu based stuff for the most part
Posts: 1,172

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
So the problem is that the meta.tar files were made using the lz4 compression library. Looking at the info about lz4 it looks like this command should work to decompress the files:
Code:
lz4 -d -v meta.tar
 
Old 12-23-2020, 03:07 AM   #20
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Wink

Quote:
Originally Posted by sgosnell View Post
After the unzip, there are two commands on one line, with no delimiter. They should be done as follows:
[code]cd firmware]then press the Enter key.
Code:
for f in *.tar do tar xf $f; done
Or else you can do it in one go, with
Code:
cd firmware; for f in *.tar; do tar xf $f; done
Notice the semicolon after firmware, that is essential. You put it in the wrong place. It is also essential that firmware is the directory directly below the current directory. That's why the first method I posted is better. If you don't get into the firmware directory via the cd command, then you have to find the correct directory which contains the extracted files. You cannot blindly follow instructions without understanding what they do, and how! If you don't understand what you're doing, you can totally bork your system and/or your phone. If you cannot read and understand, you should not be doing any of these things. That's why I fear for your phone. You can brick it if you aren't careful.
You left out the semi colon
Code:
for f in *.tar do tar xf $f; done
The command should be
Code:
for f in *.tar; do tar xf $f; done
It's a good idea to post a command that will work, or was it deliberate so people can't just blindly follow tips

Last edited by GPGAgent; 12-23-2020 at 03:08 AM.
 
Old 12-23-2020, 10:51 AM   #21
25wood25
LQ Newbie
 
Registered: Dec 2020
Posts: 10

Original Poster
Rep: Reputation: Disabled
I understood this site was for newby's,i.e for people who are learning from scratch !! It is unlikely that anyone decribed as such will understand immediately what all the contributors are saying especially as no one seems to agree entirely between themselves what the command strutures should be. The meta.tar files seem to be unlikely to be decompressed with the default decopression software that comes with 'Ubuntu live' that I have. The liblz4 tool I downloaded from 'snap' does not appear in the apps list but I know that it is installed by trying to re down load it with the message afferming that it is already present on the system. If liblz4 tool does not show then I cannot make it default the only way I can think of to do so is to de-activate the standard compression software that comes with Ubutu. How to do that?? With regard to 'bricking the phone' that is unlikely as the Heimdall software that is used to flash the samsung phones is very good at recognising corrupt files and images that are part of the firmware and there is always the option to wipe the 'nand' and get back to square one. I have the firmwares in the desktop directory so there should be little problem in pointing the commands there if I open the terminal on the desktop. What I need is a set of commands for decomression of the meta.tar files using the liblz4 tool as the DEFAULT software that all the experts agree on. Trust you can help me.
 
Old 12-23-2020, 11:55 AM   #22
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by 25wood25 View Post
I understood this site was for newby's,i.e for people who are learning from scratch !! It is unlikely that anyone decribed as such will understand immediately what all the contributors are saying especially as no one seems to agree entirely between themselves what the command strutures should be. The meta.tar files seem to be unlikely to be decompressed with the default decopression software that comes with 'Ubuntu live' that I have. The liblz4 tool I downloaded from 'snap' does not appear in the apps list but I know that it is installed by trying to re down load it with the message afferming that it is already present on the system. If liblz4 tool does not show then I cannot make it default the only way I can think of to do so is to de-activate the standard compression software that comes with Ubutu. How to do that?? With regard to 'bricking the phone' that is unlikely as the Heimdall software that is used to flash the samsung phones is very good at recognising corrupt files and images that are part of the firmware and there is always the option to wipe the 'nand' and get back to square one. I have the firmwares in the desktop directory so there should be little problem in pointing the commands there if I open the terminal on the desktop. What I need is a set of commands for decomression of the meta.tar files using the liblz4 tool as the DEFAULT software that all the experts agree on. Trust you can help me.
Haven't really chimed in as yet, but seen this thread continue to percolate up with new updates. That said, it's fairly lengthy now and a lot of updates. Perhaps what would be best is a clear detailing of what you type and what the results are.

Results now versus way back in the beginning, because I'm assuming you've progressed somewhat with extracting some of the files.

It is far easier for persons to review your posts if you enclosed commands typed and results obtained in a [code] block, which is either able to be done using the bracket and also a closing bracket [/same-word from the start] resulting in:
Code:
this is code
or in advanced edit mode there is a widget which can be used to enclosed quotes or code in the same manner.

You wrote "meta.tar", which by extension should be a tar file, not anything else.

There is a command "file" as in "file meta.tar" which will output for you the characteristics of the file it was passed.

Why do this? Because file extensions can be anything, they shouldn't be, but sometimes people rename them, and thus they really appear to be one thing, but may be another thing.

Here is an example of the file command used on a real tar file and the resultant output:
Code:
$ ls *.tar
test.tar
$ file test.tar
test.tar: POSIX tar archive (GNU)
If you see something different, then it is likely not a tar archive file.

tar if you look up the command's description, means "Tape ARchive" and a tar file is merely a smart concatenation of files with a summary block to describe the files, so that it literally can be archived onto magnetic tape, a'la 25-30+ years ago in technology. And by the way, if you make a tar file of a bunch of text files, you can literally "cat" the tarfile and see the contents of the archived text files. As I say, it is an archive and a concatenated archive of files. It will concatenate binary files too, where you'll see the various non-printable output as you'd see if you cat'ed a binary file.

The next step is that compression can be used, but typically the resultant file will have an added extension, such as .GZ or something else to the whole name.

The first thing you should do is determine if this file is only a tar file, or something else. By using the file command. Once you have that output, please post it.

I think I see way back that you have the right things for extracting a tar file, but my personal, mind cribnotes for tar are that (1) I always do the same things, and (2) there's about 3 forms of tar which I use:

tvf
xvf
cvf

The 'v' is for verbose output
The 'f' is to follow sub-directories - may be redefined but it's always served me and I don't bother looking it up much these days

The first letter controls what you want tar to do:
't' for test, or list the contents of the tar file
'x' for extract, extract the tar file
'c' for create, to create a tar file, requires a tarfile name and the directory or files you wish to put into the archive

Given your apparent frustration, I wouldn't seek a "one command" to solve this all. Start with the top file or files and go from there. I'm assuming that some you can decompress and view, but eventually you reach a point where you're stuck. So please describe where you're stuck, versus try to contend with some optimal command to do it all in one swipe.

Once again the best thing to do here is to illustrate output as in:
Code:
$ tar xvf some-name.tar
<output - either some error, or the tar file extraction process occurring and listing files>
 
Old 12-23-2020, 02:10 PM   #23
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by rtmistler View Post
It is far easier for persons to review your posts if ...
I will add that structuring text into paragraphs also helps a lot.
Compare e.g. rtmistlers (albeit lengthy) last post and yours, 25wood25. The latter is almost unreadable to me.
 
Old 12-23-2020, 02:40 PM   #24
25wood25
LQ Newbie
 
Registered: Dec 2020
Posts: 10

Original Poster
Rep: Reputation: Disabled
I am somewhat embarrassed at your having to put so much effort in replying to my post.
The files I am trying to extract are stock firmware for Samsung phones which are readily downloaded off the net as zip files containing tar.md5 files of about 2.5 gig which decompress into bin and img files which are inserted into a partition information table to be flashed into the nand memory of a mobile phone .
The instructions I was following are contained in this document pages 4 to 6 off the net. Which will detail the process.

https://ar.al/2018/07/15/flashing-st...sing-heimdall/

My original post was for someone on the forum to explain how to use the following as a command to extract the firmware I down loaded (foot of page 4 of the https document.

unzip g935fxxxxxxxxxxx.zip –d firmware && cd firmware for f in *.tar; do tar xf $f; done

Member UTEC explained on the 12th where I was going wrong but the second command line he put in did not work as it returned the error :- bash: syntax error near unexpected token 'do'.
Since that time I have not moved forward as I am getting multiple ideas from many contributors on how to proceed , each of them having a different explanation.
All I think I need is an explanation of how to circumvent the ‘bash’ error so I can go to the third command line detailed in Utec’s first post and unpack the bin and img files.
My apologies for any confusion I may have caused. Kind Regards
 
Old 12-23-2020, 03:18 PM   #25
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by 25wood25 View Post
unzip g935fxxxxxxxxxxx.zip –d firmware && cd firmware for f in *.tar; do tar xf $f; done
I think you've been told at least twice (now thrice) that there's one or more semicolons missing, yet you keep pasting the same erroneous code again and again.
Is that copy-pasted straight from that turorial? Not a good idea to execute that without understanding it.
Anyhow, try this:
Code:
unzip g935fxxxxxxxxxxx.zip –d firmware && cd firmware; for f in *.tar; do tar xf $f; done
 
Old 12-23-2020, 03:36 PM   #26
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
If you have problems with a documented or recommended command flow given by someone who cited how to extract this all, I would seek out assistance from that person who wrote that information and get more details or assistance from them, if possible. There does seem to be an email link at the top of the page for the author.

Your fellow LQ members can explain bash syntax and why things like a for loop encountered errors, and maybe that is enough. However at this time it does not seem to be sufficient, the problem continues to have additional descriptions come up for it, or insufficient feedback isn't being provided for members to be able to help you effectively.

I'm not seeing a specific error excepting one post where you wrote that it showed this:
Quote:
Originally Posted by 25wood25 View Post
now getting error tar: *.tar: cannot open: no such file or directory tar: Eroor is not recoverable: exiting now.
What that error is telling you is that a tar command was invoked and no .tar file was found. There can be many reasons for this, such as incorrect directory, or something earlier didn't work and thus any expected tar files were not extracted in an earlier step, so it finally failed. What would've been useful there would be more output which occurred prior to that final failure point and some diagnosis of things at that point. Or enabling verbose debug output on your bash prompt, set -xv before running the bash command(s).

I feel that utek was providing some guidance based on your original post to aid you to follow a process to extract the files and also explain how the complex command originally recommended was intended to work. (That was on the 18th, the first day of this thread)

One option for you to do is to contact the author of that article and determine if they can help you further.

Or perhaps you ought to consider using the same Linux distribution which they are using, which is not Ubuntu, but you also should pay some attention to their big red warning and disclaimer:
Quote:
These instructions are specific to my unique setup. You might have to adapt them to yours. Flashing firmware carries the risk of potentially bricking your device. Needless to say, proceed at your own risk.
Once again, I'd bear in mind 2 points:
  1. Your fellow members on this site are not here to literally give a complex instruction to extract an archive which came from somewhere else, is an unknown item to people here, and instead people are here to help you understand Linux and Linux commands and help you work out how to ultimately unravel the file, but not necessarily in line with the exact command posted by the author of that article.
  2. From our LQ Rules page, this item comes to mind, it is more a guideline versus a rule:
    Quote:
    We would like to stress that you should fully understand what a recommended change may do to your system.
    That's not the entire quote, but it's the relevant portion where you need to be wary of what certain commands may do to your system, and also your phone.
 
Old 12-23-2020, 04:08 PM   #27
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,342

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by 25wood25 View Post
I am somewhat embarrassed at your having to put so much effort in replying to my post.
The files I am trying to extract are stock firmware for Samsung phones which are readily downloaded off the net as zip files containing tar.md5 files of about 2.5 gig which decompress into bin and img files which are inserted into a partition information table to be flashed into the nand memory of a mobile phone .
The instructions I was following are contained in this document pages 4 to 6 off the net. Which will detail the process.

https://ar.al/2018/07/15/flashing-st...sing-heimdall/

My original post was for someone on the forum to explain how to use the following as a command to extract the firmware I down loaded (foot of page 4 of the https document.

unzip g935fxxxxxxxxxxx.zip –d firmware && cd firmware for f in *.tar; do tar xf $f; done

Member UTEC explained on the 12th where I was going wrong but the second command line he put in did not work as it returned the error :- bash: syntax error near unexpected token 'do'.
Since that time I have not moved forward as I am getting multiple ideas from many contributors on how to proceed , each of them having a different explanation.
All I think I need is an explanation of how to circumvent the ‘bash’ error so I can go to the third command line detailed in Utec’s first post and unpack the bin and img files.
My apologies for any confusion I may have caused. Kind Regards
If you follow the instructions of ondoho, and pay attention to what rmistler said things might work out.

I would add that the tar command has several options as well that you may need to experiment with. Specifically, a file with a .tar extension should be an uncompressed tar file that can be extracted using the command as given
Code:
 tar xf meta.tar
. However it can also be compressed and someone used the standard .tar extension instead of the normal compressed tar extension such as .tgz which clearly tells you it is a gz compressed tar file. If that is the case then you might need to tell tar to look for compression and unpack it with
Code:
 tar xzf meta.tar
.

Another way to do that would be to read the given command properly and parse it into discrete lines. Then enter those command lines one at a time.
Code:
unzip g935fxxxxxxxxxxx.zip –d firmware
cd firmware 
for f in *.tar; do tar xf $f; done
Following the suggestions about learning how to use the bash shell and familiarizing yourself with common commands is very important to prevent making an error that can turn something valuable (your phone) into a brick.
 
Old 12-23-2020, 05:22 PM   #28
25wood25
LQ Newbie
 
Registered: Dec 2020
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thank you all for your help I have printed out all your post to make it easier for me to follow your guidance. I must however make the point that you are all extremely familiar with the codes and commands you use and SOME of you have probably forgotten what it was like when you knew nothing about linux or its characters and their meanings. It might be worth while my making a simile of Tutankhamun chastising the explorers of the early 1920s for not understanding or decyphering hieroglyphics.A litle humility might be in point, but thanks for those who replied. Kind regards.
 
Old 12-23-2020, 07:49 PM   #29
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,342

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by 25wood25 View Post
Thank you all for your help
I have downloaded the firmware you noted and unzipped the file.
It creates 5 tar files that are named XXXXXX.tar.md5 which clearly shows why your tar command is failing.
Changing the tar command you posted
Code:
 tar xf meta.tar
to
Code:
 tar xf meta.tar.md5
will extract them.

This then gives a group of xxxxx.lz4 compressed files that probably do not need extraction before loading them on the phone. I do not know how heimdal works so cannot be certain, so what you do from there is up to you.

If you do need to extract the .lz4 files then it can be done following the lz4 tutorial which I located by a simple google search for "how to unpack an lz4 file on linux".

Since you seem upset that people are giving you hints as to what to do but not guiding you through every step, even though you have not given full details of the issue, this is the full process needed to
1. extract the zip file
2. untar the files
3. IF NEEDED, extract the lz4 files.
Code:
1.
unzip xxxxxxx.zip -d firmware
cd firmware

2. 
for f in *.tar.md5 ; do tar xf $f ; done

3. (only if needed)
for L in *.lz4 ; do lz4 $L ; done
While you claim to be a newbie it would help if you took advice given and experimented with it. Most people learn to use computer languages and programs by hands on rather than being told what to do. The knowledge sticks longer that way.

It also would help if you were to do online searches and tried to answer your questions that way before you ask on the forum. If you do that and tell us what you have tried that did not work as well as giving us the full details instead of getting upset when we try to answer the question with incomplete information things will go better. The commands suggested were based on the information given about the file names needing to be untarred, and of course those commands did not work because you gave us the wrong file extension (.tar vs .tar.md5). Simple logic should have told you that .tar and .tar.md5 were different and maybe you should try it differently, or at least look at why the .tar files did not exist.

I believe peoples attitudes in their answers was because at least some of us saw that you gave no feedback about attempting to follow any of the suggestions freely given.

Last edited by computersavvy; 12-23-2020 at 07:59 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] How can I have zip -d file.zip "__MACOSX*" work on all zip files in directory? thomwblair Linux - Newbie 10 10-08-2018 02:30 PM
Cannot zip a mutli-part archive, zip -FF command failing with out of memory error sanchit.sharma Linux - Newbie 8 05-21-2018 06:47 AM
How to find out a file in a WAR which in a zip without unzip the zip-file? thomas2004ch Linux - Software 3 09-30-2011 03:06 PM
Decompress .zip files on AIX system namdn AIX 4 08-23-2004 09:35 AM
Decompress .zip files on AIX system namdn Linux - General 3 07-28-2004 06:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:24 PM.

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