Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unarchive: Failed to find handler #18

Open
NickVolynkin opened this issue Jun 15, 2017 · 15 comments
Open

unarchive: Failed to find handler #18

NickVolynkin opened this issue Jun 15, 2017 · 15 comments
Labels

Comments

@NickVolynkin
Copy link

Role fails on the "Download fzf" step, which uses the unarchive module.

TASK [viasite-ansible.zsh : Download fzf] **************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to find handler for "/private/var/folders/c6/qyn82s7d2d7dkhzqsl3p5yg80000gn/T/ansible_PEb4Qn/fzf-0.16.8-linux_amd64.tgz". Make sure the required command to extract the file is installed. Command "/usr/bin/tar" detected as tar type bsd. GNU tar required. Command "/usr/bin/unzip" could not handle archive."}

I have both tar and unzip installed:

$ which tar
/usr/bin/tar
$ ls -hal /usr/bin/tar 
lrwxr-xr-x 1 root wheel 6 Jul 16  2015 /usr/bin/tar -> bsdtar
$  which unzip
/usr/bin/unzip
$ ls -hal /usr/bin/unzip
-rwxr-xr-x 2 root wheel 158K May  1  2015 /usr/bin/unzip

OSX, zsh already installed, default playbook, run with ansible-playbook -i 'localhost,' -c local playbook.yml.

I also doubt that https://github.com/junegunn/fzf-bin/releases/download/0.16.8/fzf-0.16.8-linux_amd64.tgz is the correct option for OSX, so I've opened #17. Running the playbook with --extra-vars "zsh_fzf_os={{ ansible_os_family }}" results in using the darwin release, but doesn't fix the problem.

Any ideas on how to debug this further?

@NickVolynkin
Copy link
Author

Heh, I've overlooked the problem. I've got bsdtar, while GNU tar is required. So, brew install gnu-tar solved the problem.

@NickVolynkin
Copy link
Author

Still not sure if this should be handled in the role.

@popstas
Copy link
Contributor

popstas commented Jun 17, 2017

I think that role should be provisioned on clean macOS only with brew installed, but I don't tested it on clean macOS... So you can add brew install gnu-tar and/or brew install fzf to role.

@popstas popstas added the bug label Jun 28, 2017
@gaizeror
Copy link

It is not working because the unarchive module uses /usr/bin/tar and installing gnu-tar does not replace the symlink of tar from bsdtar to gnu-tar

@popstas
Copy link
Contributor

popstas commented Mar 11, 2018

@gaizeror, just replace symlink yourself.

@gaizeror
Copy link

@popstas I am new to macOS, but I get permissions denied (also with sudo)

@popstas
Copy link
Contributor

popstas commented Mar 11, 2018

@gaizeror, try to become root with sudo -i

@gaizeror
Copy link

I tried, so wierd root cant change symlink

@cupen
Copy link

cupen commented Apr 14, 2018

I meet the same problem in my CentOS7, but I have both the /bin/gtar and /bin/unzip.
The odd thing was it works in my Debian9, This is both funny and annoying ……
Then I find this.

$ tar xvf /home/cupen/.ansible/tmp/ansible-tmp-1523707936.0375483-68992850281293/source
tar (child): cannot run bzip2: No such file or directory
tar (child): trying lbzip2
tar (child): lbzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

HOLY SHIT ! OK, run yum install bzip2, then it works.

@gaizeror
Copy link

I installed manually fzf with
brew install fzf

@AjaxOdessa
Copy link

AjaxOdessa commented Oct 23, 2018

@gaizeror Inability to edit /usr/bin on macOS is the result of SIP. Once it is disabled (requires restart & Recovery partition), you can make changes you need.

@kenorb
Copy link

kenorb commented Jul 17, 2023

Got similar error on Ubuntu 22.04:

"msg": "Failed to find handler for \"/tmp/site.tar.gz\". Make sure the required command to extract the file is installed. Command \"/usr/bin/unzip\" could not handle archive. Command \"/usr/bin/tar\" could not handle archive."
      - name: Extract site
        ansible.builtin.unarchive:
          src: /tmp/site.tar.gz
          dest: /var/www/html
          owner: root
          group: root
          mode: '0755'
          remote_src: yes
          extra_opts: "--no-same-owner --no-same-permissions -xz"
$ ansible --version
ansible 2.10.8
  config file = None
  configured module search path = ['/var/lib/jenkins/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0]

$ tar --version
tar (GNU tar) 1.34

$ unzip --version
caution:  both -n and -o specified; ignoring -o
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.

@popstas
Copy link
Contributor

popstas commented Jul 19, 2023

@kenorb , is it relative to project ansible-role-zsh?

@kenorb
Copy link

kenorb commented Jul 24, 2023

Is it relative to project ansible-role-zsh?

It is vanilla Ansible, sorry. But the issue could be related.

@cueedee
Copy link

cueedee commented Dec 14, 2023

To aid any future dwellers who like me landed here when looking for an answer to:

Command /usr/bin/tar could not handle archive: Unable to list files in the archive: /usr/bin/tar: You may not specify more than one -Acdtrux, --delete or --test-label option

In my case the cause turned out to be a mere typo in the extra_opts resulting in a command line option that tar didn't grok.

Similarly, I suspect that the -xz that @kenorb included in their extra_opts could have been the cause for failure if the xz utility needed for this option wasn't installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants