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

Failed to download registry archive on alpine linux #1601

Open
2 tasks done
cnt0 opened this issue Jan 15, 2024 · 4 comments · May be fixed by #1829
Open
2 tasks done

Failed to download registry archive on alpine linux #1601

cnt0 opened this issue Jan 15, 2024 · 4 comments · May be fixed by #1829

Comments

@cnt0
Copy link

cnt0 commented Jan 15, 2024

I've searched open issues for similar requests

  • Yes

I've recently downloaded the latest plugin version of mason.nvim

  • Yes

Problem description

Hello. I'm trying to run :Mason command in neovim installed in alpine linux system, and getting an error mentioned in title. I've actually found the cause of this problem, so TLDR:

Mason falls back to using wget command because there's no curl installed. However, wget provided by alpine linux out of box is not the "default" wget, and it expects different command line args (see attached logs). So it fails because of that. Indeed, I easily fixed the problem by installing curl, but nonetherless, this error is confusing.
Also, as shown by healthcheck, there might be similar problems with other commands like unzip as well (but I have yet to face such problems)

Expected behavior

:Mason works with no errors

Affected packages

All

Mason output

No response

Installation log

[DEBUG Mon Jan 15 09:09:27 2024] ...ocal/share/nvim/lazy/mason.nvim/lua/mason-core/spawn.lua:80: "curl" is not executable
[DEBUG Mon Jan 15 09:09:27 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="wget", spawn_opts={
  args = { "--header=Accept: application/vnd.mason-registry.v1+json; q=1.0, application/json; q=0.8", "--header=User-Agent: mason.nvim v1.9.0 (+https://github.com/williamboman/mason.nvim)", "-nv", "-o", "/dev/null", "-O", "-", "--timeout=30", "--method=GET", "https://api.mason-registry.dev/api/github/mason-org/mason-registry/releases/latest" }
}
[DEBUG Mon Jan 15 09:09:27 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 13558
[DEBUG Mon Jan 15 09:09:27 2024] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=13558 exited with exit_code=1, signal=0
[ERROR Mon Jan 15 09:09:27 2024] ...e/nvim/lazy/mason.nvim/lua/mason-core/providers/init.lua:80: Provider "github" "get_latest_release" failed: spawn: wget failed with exit code 1 and signal 0. wget: unrecognized option: method=GET
BusyBox v1.36.1 (2023-12-20 14:59:51 UTC) multi-call binary.

Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header STR]
	[--post-data STR | --post-file FILE] [-Y on/off]
	[-P DIR] [-U AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

	--spider	Only check URL existence: $? is 0 if exists
	--header STR	Add STR (of form 'header: value') to headers
	--post-data STR	Send STR using POST method
	--post-file FILE	Send FILE using POST method
	-c		Continue retrieval of aborted transfer
	-q		Quiet
	-P DIR		Save to DIR (default .)
	-S    		Show server response
	-T SEC		Network read timeout is SEC seconds
	-O FILE		Save to FILE ('-' for stdout)
	-o LOGFILE	Log messages to FILE
	-U STR		Use STR for User-Agent header
	-Y on/off	Use proxy

Neovim version (>= 0.7)

NVIM v0.9.4
Build type: MinSizeRel
LuaJIT 2.1.0-beta3

Operating system/version

Linux alpine 6.7.0-0-edge #1-Alpine SMP PREEMPT_DYNAMIC Thu, 11 Jan 2024 15:05:06 +0000 x86_64 Linux

Healthcheck

==============================================================================
mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.9.0
- OK PATH: skip
- OK Providers: 
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-01-15-easy-singer` is installed.

mason.nvim [Core utils] ~
- WARNING unzip: not available
  - ADVICE:
    - spawn: unzip failed with exit code 1 and signal 0. BusyBox v1.36.1 (2023-12-20 14:59:51 UTC) multi-call binary.
      
      Usage: unzip [-lnojpqK] FILE[.zip] [FILE]... [-x FILE]... [-d DIR]
      
      Extract FILEs from ZIP archive
      
      -l	List contents (with -q for short form)
      -n	Never overwrite files (default: ask)
      -o	Overwrite
      -j	Do not restore paths
      -p	Write to stdout
      -t	Test
      -q	Quiet
      -K	Do not clear SUID bit
      -x FILE	Exclude FILEs
      -d DIR	Extract into DIR
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code 1 and signal 0. wget: unrecognized option: version
      BusyBox v1.36.1 (2023-12-20 14:59:51 UTC) multi-call binary.
      
      Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header STR]
      [--post-data STR | --post-file FILE] [-Y on/off]
      [-P DIR] [-U AGENT] [-T SEC] URL...
      
      Retrieve files via HTTP or FTP
      
      --spider	Only check URL existence: $? is 0 if exists
      --header STR	Add STR (of form 'header: value') to headers
      --post-data STR	Send STR using POST method
      --post-file FILE	Send FILE using POST method
      -c		Continue retrieval of aborted transfer
      -q		Quiet
      -P DIR		Save to DIR (default .)
      -S    		Show server response
      -T SEC		Network read timeout is SEC seconds
      -O FILE		Save to FILE ('-' for stdout)
      -o LOGFILE	Log messages to FILE
      -U STR		Use STR for User-Agent header
      -Y on/off	Use proxy
- ERROR curl: not available
  - ADVICE:
    - spawn: curl failed with exit code - and signal -. curl is not executable
- ERROR gzip: not available
  - ADVICE:
    - spawn: gzip failed with exit code 1 and signal 0. gzip: unrecognized option: version
      BusyBox v1.36.1 (2023-12-20 14:59:51 UTC) multi-call binary.
      
      Usage: gzip [-cfkdt123456789] [FILE]...
      
      Compress FILEs (or stdin)
      
      -1..9	Compression level
      -d	Decompress
      -c	Write to stdout
      -f	Force
      -k	Keep input files
      -t	Test integrity
- OK tar: `tar (GNU tar) 1.35`
- OK bash: `GNU bash, version 5.2.21(1)-release (x86_64-alpine-linux-musl)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Ruby: not available
  - ADVICE:
    - spawn: ruby failed with exit code - and signal -. ruby is not executable
- WARNING RubyGem: not available
  - ADVICE:
    - spawn: gem failed with exit code - and signal -. gem is not executable
- OK Go: `go version go1.21.6 linux/amd64`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: `Python 3.11.6`
- OK node: `v21.5.0`
- OK java: `openjdk version "11.0.21" 2023-10-17`
- OK javac: `javac 11.0.21`
- OK npm: `10.3.0`
- OK pip: `pip 23.3.2 from /usr/lib/python3.11/site-packages/pip (python 3.11)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 14. Remaining: 4986. Limit: 5000. Reset: Mon Jan 15 09:32:12 2024.

Screenshots

No response

@pedrohgmacedo
Copy link

It fails on Windows too (using busybox-w32).

mason.nvim [Core utils] ~
- WARNING unzip: not available
  - ADVICE:
    - spawn: unzip failed with exit code 1 and signal 0. BusyBox v1.37.0-FRP-5236-g7dff7f376 (2023-12-06 10:31:32 GMT)
      
      Usage: unzip [-lnojpqK] FILE[.zip] [FILE]... [-x FILE]... [-d DIR]
      
      Extract FILEs from ZIP archive
      
      -l	List contents (with -q for short form)
      -n	Never overwrite files (default: ask)
      -o	Overwrite
      -j	Do not restore paths
      -p	Write to stdout
      -t	Test
      -q	Quiet
      -K	Do not clear SUID bit
      -x FILE	Exclude FILEs
      -d DIR	Extract into DIR
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code 1 and signal 0. BusyBox v1.37.0-FRP-5236-g7dff7f376 (2023-12-06 10:31:32 GMT)
      
      Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header STR]
      [--post-data STR | --post-file FILE] [-Y on/off]
      [-P DIR] [-U AGENT] URL...
      
      Retrieve files via HTTP or FTP
      
      --spider	Only check URL existence: $? is 0 if exists
      --header STR	Add STR (of form 'header: value') to headers
      --post-data STR	Send STR using POST method
      --post-file FILE	Send FILE using POST method
      -c		Continue retrieval of aborted transfer
      -q		Quiet
      -P DIR		Save to DIR (default .)
      -S    		Show server response
      -O FILE		Save to FILE ('-' for stdout)
      -o LOGFILE	Log messages to FILE
      -U STR		Use STR for User-Agent header
      -Y on/off	Use proxy
      wget: unknown option -- version
- OK curl: `curl 8.4.0 (Windows) libcurl/8.4.0 Schannel WinIDN
`
- WARNING gzip: not available
  - ADVICE:
    - spawn: gzip failed with exit code 1 and signal 0. BusyBox v1.37.0-FRP-5236-g7dff7f376 (2023-12-06 10:31:32 GMT)
      
      Usage: gzip [-cfkdt123456789] [FILE]...
      
      Compress FILEs (or stdin)
      
      -1..9	Compression level
      -d	Decompress
      -c	Write to stdout
      -f	Force
      -k	Keep input files
      -t	Test integrity
      gzip: unknown option -- version
- OK tar: `bsdtar 3.6.2 - libarchive 3.6.2 zlib/1.2.5.f-ipp liblzma/5.2.5 bz2lib/1.0.8 libzstd/1.5.4 
`
- OK pwsh: `7.4.1 Microsoft Windows 10.0.22631 Win32NT
`
- WARNING 7z: not available
  - ADVICE:
    - spawn: 7z failed with exit code - and signal -. 7z is not executable

@UnderGrounder96
Copy link

The issue is most of these is that checking for "version" is not supported in Alpine binaries.

λ docker run -it alpine

/ # gzip version
gzip: version: No such file or directory
/ # gzip --version
gzip: unrecognized option: version
BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.

Usage: gzip [-cfkdt123456789] [FILE]...

Compress FILEs (or stdin)

	-1..9	Compression level
	-d	Decompress
	-c	Write to stdout
	-f	Force
	-k	Keep input files
	-t	Test integrity

/ # wget version
wget: bad address 'version'
/ # wget --version
wget: unrecognized option: version
BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.

Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header STR]
	[--post-data STR | --post-file FILE] [-Y on/off]
	[-P DIR] [-U AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

	--spider	Only check URL existence: $? is 0 if exists
	--header STR	Add STR (of form 'header: value') to headers
	--post-data STR	Send STR using POST method
	--post-file FILE	Send FILE using POST method
	-c		Continue retrieval of aborted transfer
	-q		Quiet
	-P DIR		Save to DIR (default .)
	-S    		Show server response
	-T SEC		Network read timeout is SEC seconds
	-O FILE		Save to FILE ('-' for stdout)
	-o LOGFILE	Log messages to FILE
	-U STR		Use STR for User-Agent header
	-Y on/off	Use proxy

Assuming used flags are universal,
I propose using which command instead and achieve the exact same effect:

λ docker run -it alpine

/ # which gzip
/bin/gzip
/ # echo $?
0
/ # which wget
/usr/bin/wget
/ # echo $?
0
/ # which not_present_command
/ # echo $?
1

@UnderGrounder96
Copy link

Hmmm... Seems "--help" could also work:

λ docker run -it alpine
/ # gzip --help
BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.

Usage: gzip [-cfkdt123456789] [FILE]...

Compress FILEs (or stdin)

	-1..9	Compression level
	-d	Decompress
	-c	Write to stdout
	-f	Force
	-k	Keep input files
	-t	Test integrity
/ # echo $?
0

/ # wget --help
BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.

Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header STR]
	[--post-data STR | --post-file FILE] [-Y on/off]
	[-P DIR] [-U AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

	--spider	Only check URL existence: $? is 0 if exists
	--header STR	Add STR (of form 'header: value') to headers
	--post-data STR	Send STR using POST method
	--post-file FILE	Send FILE using POST method
	-c		Continue retrieval of aborted transfer
	-q		Quiet
	-P DIR		Save to DIR (default .)
	-S    		Show server response
	-T SEC		Network read timeout is SEC seconds
	-O FILE		Save to FILE ('-' for stdout)
	-o LOGFILE	Log messages to FILE
	-U STR		Use STR for User-Agent header
	-Y on/off	Use proxy
/ # echo $?
0

Also consistency is needed, some commands use "--help" and others "--version":
https://github.com/williamboman/mason.nvim/blob/main/lua/mason/health.lua

@PIG208
Copy link

PIG208 commented Sep 29, 2024

I can confirm that this still happens to mason.nvim v1.10.0.

I also get the error wget: unrecognized option: method=GET when installing an LSP server package. Because the busybox version of wget is functionally different than what you would expect, we need to perhaps distinguish the busybox wget from the regular one, in addition to fixing the version check.

wget --help would work.

@fredrikfoss fredrikfoss linked a pull request Dec 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs triage
Development

Successfully merging a pull request may close this issue.

4 participants