How to solve “tar: invalid magic” error on Linux Alpine

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
8
down vote

favorite
1












I'm installing sqlite on Alpine Linux. I download sqlite-autoconf-3130000.tar.gz but tar could not open it. I tried this answer but it's not working. tar gives this message:



tar: invalid magic
tar: short read


I wrote these commands.



wget https://www.sqlite.org/2015/sqlite-autoconf-3090100.tar.gz
tar -zxvf sqlite-autoconf-3090100.tar.gz









share|improve this question























  • Could you please update your answer with the command (and its arguments) that you tried to run.
    – DarkHeart
    Aug 9 '16 at 6:56






  • 1




    Did the download complete successfully? If it did, ls -l sqlite-autoconf-3090100.tar.gz should tell you that the file is 2284128 bytes in size.
    – Stephen Kitt
    Aug 9 '16 at 7:50










  • Also, is it currently a gzip formatted file? Some browsers do on the fly decompression, meaning that it might still named sqlite-autoconf-3090100.tar.gz but that the contents might actually be sqlite-autoconf-3090100.tar. No idea if wget does equally smart things, but it is easily tested by leaving of the z flag from tar.
    – Hennes
    Jan 25 '17 at 9:06














up vote
8
down vote

favorite
1












I'm installing sqlite on Alpine Linux. I download sqlite-autoconf-3130000.tar.gz but tar could not open it. I tried this answer but it's not working. tar gives this message:



tar: invalid magic
tar: short read


I wrote these commands.



wget https://www.sqlite.org/2015/sqlite-autoconf-3090100.tar.gz
tar -zxvf sqlite-autoconf-3090100.tar.gz









share|improve this question























  • Could you please update your answer with the command (and its arguments) that you tried to run.
    – DarkHeart
    Aug 9 '16 at 6:56






  • 1




    Did the download complete successfully? If it did, ls -l sqlite-autoconf-3090100.tar.gz should tell you that the file is 2284128 bytes in size.
    – Stephen Kitt
    Aug 9 '16 at 7:50










  • Also, is it currently a gzip formatted file? Some browsers do on the fly decompression, meaning that it might still named sqlite-autoconf-3090100.tar.gz but that the contents might actually be sqlite-autoconf-3090100.tar. No idea if wget does equally smart things, but it is easily tested by leaving of the z flag from tar.
    – Hennes
    Jan 25 '17 at 9:06












up vote
8
down vote

favorite
1









up vote
8
down vote

favorite
1






1





I'm installing sqlite on Alpine Linux. I download sqlite-autoconf-3130000.tar.gz but tar could not open it. I tried this answer but it's not working. tar gives this message:



tar: invalid magic
tar: short read


I wrote these commands.



wget https://www.sqlite.org/2015/sqlite-autoconf-3090100.tar.gz
tar -zxvf sqlite-autoconf-3090100.tar.gz









share|improve this question















I'm installing sqlite on Alpine Linux. I download sqlite-autoconf-3130000.tar.gz but tar could not open it. I tried this answer but it's not working. tar gives this message:



tar: invalid magic
tar: short read


I wrote these commands.



wget https://www.sqlite.org/2015/sqlite-autoconf-3090100.tar.gz
tar -zxvf sqlite-autoconf-3090100.tar.gz






tar alpine-linux






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:36









Community♦

1




1










asked Aug 9 '16 at 6:44









daylight

141113




141113











  • Could you please update your answer with the command (and its arguments) that you tried to run.
    – DarkHeart
    Aug 9 '16 at 6:56






  • 1




    Did the download complete successfully? If it did, ls -l sqlite-autoconf-3090100.tar.gz should tell you that the file is 2284128 bytes in size.
    – Stephen Kitt
    Aug 9 '16 at 7:50










  • Also, is it currently a gzip formatted file? Some browsers do on the fly decompression, meaning that it might still named sqlite-autoconf-3090100.tar.gz but that the contents might actually be sqlite-autoconf-3090100.tar. No idea if wget does equally smart things, but it is easily tested by leaving of the z flag from tar.
    – Hennes
    Jan 25 '17 at 9:06
















  • Could you please update your answer with the command (and its arguments) that you tried to run.
    – DarkHeart
    Aug 9 '16 at 6:56






  • 1




    Did the download complete successfully? If it did, ls -l sqlite-autoconf-3090100.tar.gz should tell you that the file is 2284128 bytes in size.
    – Stephen Kitt
    Aug 9 '16 at 7:50










  • Also, is it currently a gzip formatted file? Some browsers do on the fly decompression, meaning that it might still named sqlite-autoconf-3090100.tar.gz but that the contents might actually be sqlite-autoconf-3090100.tar. No idea if wget does equally smart things, but it is easily tested by leaving of the z flag from tar.
    – Hennes
    Jan 25 '17 at 9:06















Could you please update your answer with the command (and its arguments) that you tried to run.
– DarkHeart
Aug 9 '16 at 6:56




Could you please update your answer with the command (and its arguments) that you tried to run.
– DarkHeart
Aug 9 '16 at 6:56




1




1




Did the download complete successfully? If it did, ls -l sqlite-autoconf-3090100.tar.gz should tell you that the file is 2284128 bytes in size.
– Stephen Kitt
Aug 9 '16 at 7:50




Did the download complete successfully? If it did, ls -l sqlite-autoconf-3090100.tar.gz should tell you that the file is 2284128 bytes in size.
– Stephen Kitt
Aug 9 '16 at 7:50












Also, is it currently a gzip formatted file? Some browsers do on the fly decompression, meaning that it might still named sqlite-autoconf-3090100.tar.gz but that the contents might actually be sqlite-autoconf-3090100.tar. No idea if wget does equally smart things, but it is easily tested by leaving of the z flag from tar.
– Hennes
Jan 25 '17 at 9:06




Also, is it currently a gzip formatted file? Some browsers do on the fly decompression, meaning that it might still named sqlite-autoconf-3090100.tar.gz but that the contents might actually be sqlite-autoconf-3090100.tar. No idea if wget does equally smart things, but it is easily tested by leaving of the z flag from tar.
– Hennes
Jan 25 '17 at 9:06










3 Answers
3






active

oldest

votes

















up vote
11
down vote













Try to install the tar package (apk add tar). Busybox tar (default) doesn't support all features.






share|improve this answer
















  • 2




    I ran into the same issue when running a tar command in a Dockerfile and installing tar worked for me. It's kind of confusing because if you run the command in the shell in the container, it works. But not if it's a RUN command in the Dockerfile without having installed tar first. :|
    – 3cheesewheel
    Oct 10 '16 at 12:06


















up vote
0
down vote













tar:invalid magic means that the file is corrupted.



Please check the md5sum if matches...this is what i got:



 md5sum sqlite-autoconf-3090100.tar.gz 
74931054399a2d7acf35637efe8d6f45 sqlite-autoconf-3090100.tar.gz





share|improve this answer



























    up vote
    0
    down vote













    This doesn't necessarily mean the Alpine version of tar is incompatible, as Francesco pointed out you should really check your file checksums.



    I ran into this while doing a curl https://github.com/someproject/releases/project-1.1.0.gz | tar -xvzf in my Dockerfile.



    It turns out what I had forgotten was that curl will only follow redirects if you allow it with -L, and so it was never getting to the actual file, it was literally downloading the html telling it there was a redirect. Adding the -L allowed me to save the file without bloating my container with a new tar (beyond the "bloat" added by curl).






    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f302192%2fhow-to-solve-tar-invalid-magic-error-on-linux-alpine%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      11
      down vote













      Try to install the tar package (apk add tar). Busybox tar (default) doesn't support all features.






      share|improve this answer
















      • 2




        I ran into the same issue when running a tar command in a Dockerfile and installing tar worked for me. It's kind of confusing because if you run the command in the shell in the container, it works. But not if it's a RUN command in the Dockerfile without having installed tar first. :|
        – 3cheesewheel
        Oct 10 '16 at 12:06















      up vote
      11
      down vote













      Try to install the tar package (apk add tar). Busybox tar (default) doesn't support all features.






      share|improve this answer
















      • 2




        I ran into the same issue when running a tar command in a Dockerfile and installing tar worked for me. It's kind of confusing because if you run the command in the shell in the container, it works. But not if it's a RUN command in the Dockerfile without having installed tar first. :|
        – 3cheesewheel
        Oct 10 '16 at 12:06













      up vote
      11
      down vote










      up vote
      11
      down vote









      Try to install the tar package (apk add tar). Busybox tar (default) doesn't support all features.






      share|improve this answer












      Try to install the tar package (apk add tar). Busybox tar (default) doesn't support all features.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Aug 9 '16 at 8:56









      Jakub Jirutka

      21017




      21017







      • 2




        I ran into the same issue when running a tar command in a Dockerfile and installing tar worked for me. It's kind of confusing because if you run the command in the shell in the container, it works. But not if it's a RUN command in the Dockerfile without having installed tar first. :|
        – 3cheesewheel
        Oct 10 '16 at 12:06













      • 2




        I ran into the same issue when running a tar command in a Dockerfile and installing tar worked for me. It's kind of confusing because if you run the command in the shell in the container, it works. But not if it's a RUN command in the Dockerfile without having installed tar first. :|
        – 3cheesewheel
        Oct 10 '16 at 12:06








      2




      2




      I ran into the same issue when running a tar command in a Dockerfile and installing tar worked for me. It's kind of confusing because if you run the command in the shell in the container, it works. But not if it's a RUN command in the Dockerfile without having installed tar first. :|
      – 3cheesewheel
      Oct 10 '16 at 12:06





      I ran into the same issue when running a tar command in a Dockerfile and installing tar worked for me. It's kind of confusing because if you run the command in the shell in the container, it works. But not if it's a RUN command in the Dockerfile without having installed tar first. :|
      – 3cheesewheel
      Oct 10 '16 at 12:06













      up vote
      0
      down vote













      tar:invalid magic means that the file is corrupted.



      Please check the md5sum if matches...this is what i got:



       md5sum sqlite-autoconf-3090100.tar.gz 
      74931054399a2d7acf35637efe8d6f45 sqlite-autoconf-3090100.tar.gz





      share|improve this answer
























        up vote
        0
        down vote













        tar:invalid magic means that the file is corrupted.



        Please check the md5sum if matches...this is what i got:



         md5sum sqlite-autoconf-3090100.tar.gz 
        74931054399a2d7acf35637efe8d6f45 sqlite-autoconf-3090100.tar.gz





        share|improve this answer






















          up vote
          0
          down vote










          up vote
          0
          down vote









          tar:invalid magic means that the file is corrupted.



          Please check the md5sum if matches...this is what i got:



           md5sum sqlite-autoconf-3090100.tar.gz 
          74931054399a2d7acf35637efe8d6f45 sqlite-autoconf-3090100.tar.gz





          share|improve this answer












          tar:invalid magic means that the file is corrupted.



          Please check the md5sum if matches...this is what i got:



           md5sum sqlite-autoconf-3090100.tar.gz 
          74931054399a2d7acf35637efe8d6f45 sqlite-autoconf-3090100.tar.gz






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 25 '17 at 8:33









          Francesco Colista

          177110




          177110




















              up vote
              0
              down vote













              This doesn't necessarily mean the Alpine version of tar is incompatible, as Francesco pointed out you should really check your file checksums.



              I ran into this while doing a curl https://github.com/someproject/releases/project-1.1.0.gz | tar -xvzf in my Dockerfile.



              It turns out what I had forgotten was that curl will only follow redirects if you allow it with -L, and so it was never getting to the actual file, it was literally downloading the html telling it there was a redirect. Adding the -L allowed me to save the file without bloating my container with a new tar (beyond the "bloat" added by curl).






              share|improve this answer
























                up vote
                0
                down vote













                This doesn't necessarily mean the Alpine version of tar is incompatible, as Francesco pointed out you should really check your file checksums.



                I ran into this while doing a curl https://github.com/someproject/releases/project-1.1.0.gz | tar -xvzf in my Dockerfile.



                It turns out what I had forgotten was that curl will only follow redirects if you allow it with -L, and so it was never getting to the actual file, it was literally downloading the html telling it there was a redirect. Adding the -L allowed me to save the file without bloating my container with a new tar (beyond the "bloat" added by curl).






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  This doesn't necessarily mean the Alpine version of tar is incompatible, as Francesco pointed out you should really check your file checksums.



                  I ran into this while doing a curl https://github.com/someproject/releases/project-1.1.0.gz | tar -xvzf in my Dockerfile.



                  It turns out what I had forgotten was that curl will only follow redirects if you allow it with -L, and so it was never getting to the actual file, it was literally downloading the html telling it there was a redirect. Adding the -L allowed me to save the file without bloating my container with a new tar (beyond the "bloat" added by curl).






                  share|improve this answer












                  This doesn't necessarily mean the Alpine version of tar is incompatible, as Francesco pointed out you should really check your file checksums.



                  I ran into this while doing a curl https://github.com/someproject/releases/project-1.1.0.gz | tar -xvzf in my Dockerfile.



                  It turns out what I had forgotten was that curl will only follow redirects if you allow it with -L, and so it was never getting to the actual file, it was literally downloading the html telling it there was a redirect. Adding the -L allowed me to save the file without bloating my container with a new tar (beyond the "bloat" added by curl).







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 24 at 23:55









                  dragon788

                  1379




                  1379



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f302192%2fhow-to-solve-tar-invalid-magic-error-on-linux-alpine%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      Peggy Mitchell

                      The Forum (Inglewood, California)

                      Palaiologos