Cygwin: fix error: GnuTLS: The request is invalid


Example error:

$ apt-cyg install poppler
Installing poppler
--2024-02-18 11:42:34--  https://mirrors.163.com/cygwin//x86_64/release/poppler/poppler-21.01.0-1.tar.xz
Resolving mirrors.163.com (mirrors.163.com)... 60.191.80.15
Connecting to mirrors.163.com (mirrors.163.com)|60.191.80.15|:443... connected.
GnuTLS: The request is invalid.
Unable to establish SSL connection.
poppler-21.01.0-1.tar.xz: FAILED
sha512sum: WARNING: 1 computed checksum did NOT match

Fix:

Step 1: change mirror site to http eg http://cygwin.mirror.constant.com/

$ apt-cyg mirror "http://cygwin.mirror.constant.com/"
Mirror set to http://cygwin.mirror.constant.com/.

Or

$ apt-cyg --mirror "http://cygwin.mirror.constant.com/" install gnutls
--2024-02-18 12:01:13--  http://cygwin.mirror.constant.com//x86_64/setup.bz2
Resolving cygwin.mirror.constant.com (cygwin.mirror.constant.com)... 108.61.5.83
Connecting to cygwin.mirror.constant.com (cygwin.mirror.constant.com)|108.61.5.83|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4348579 (4.1M) [application/octet-stream]
Saving to: ‘setup.bz2’

setup.bz2           100%[===================>]   4.15M   108KB/s    in 34s

2024-02-18 12:01:49 (123 KB/s) - ‘setup.bz2’ saved [4348579/4348579]

Updated setup.ini
Installing --mirror
Unable to locate package --mirror

Step 2: now you can install package with apt-cyg

$ apt-cyg install gnutls
Installing gnutls
--2024-02-18 12:02:55--  http://cygwin.mirror.constant.com//x86_64/release/gnutls/gnutls-3.6.9-1.tar.xz
Resolving cygwin.mirror.constant.com (cygwin.mirror.constant.com)... 108.61.5.83
Connecting to cygwin.mirror.constant.com (cygwin.mirror.constant.com)|108.61.5.83|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 740112 (723K) [application/octet-stream]
Saving to: ‘gnutls-3.6.9-1.tar.xz’

gnutls-3.6.9-1.tar. 100%[===================>] 722.77K   128KB/s    in 9.8s

2024-02-18 12:03:05 (73.6 KB/s) - ‘gnutls-3.6.9-1.tar.xz’ saved [740112/740112]

gnutls-3.6.9-1.tar.xz: OK
Unpacking...
Package gnutls installed

Leave a Reply