openSUSE / opi

OBS Package Installer (CLI)
GNU General Public License v3.0
233 stars 20 forks source link

opi - connection refused - another exception occurred #177

Closed marcoczen closed 5 months ago

marcoczen commented 5 months ago

Guys, is OPI broken ?

I tried it today. This is what i got ?


opi apache2
    Searching repos for: apache2
    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 160, in _new_conn
        (self._dns_host, self.port), self.timeout, **extra_kw
      File "/usr/lib/python3.6/site-packages/urllib3/util/connection.py", line 84, in create_connection
        raise err
      File "/usr/lib/python3.6/site-packages/urllib3/util/connection.py", line 74, in create_connection
        sock.connect(sa)
    ConnectionRefusedError: [Errno 111] Connection refused

    During handling of the above exception, another exception occurred:

Any workarounds ?

nobkd commented 5 months ago

Sorry. I can't reproduce that.

Do you maybe have some software / proxy / ... interfering? Can you share OS / system / OPI version details? What was the command you tried to run? opi apache2?

marcoczen commented 5 months ago

Hi.

Sorry. I can't reproduce that.

Noted.

Do you maybe have some software / proxy / ... interfering?

There is a pfsense firewall. Outbound connections are allowed. Is there any specific port that needs attention ?

Can you share OS / system

# cat /etc/*release

NAME="openSUSE Leap"
VERSION="15.5"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.5"
PRETTY_NAME="openSUSE Leap 15.5"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.5"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap"
LOGO="distributor-logo-Leap"

/OPI version details?

# opi -v

opi version 4.4.0

What was the command you tried to run? opi apache2?

Yes. opi apache2

marcoczen commented 5 months ago

The full error message;

# opi apache2

Searching repos for: apache2
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/lib/python3.6/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/lib/python3.6/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 678, in urlopen
    chunked=chunked,
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 983, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 309, in connect
    conn = self._new_conn()
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 172, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f7a5a3c53c8>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 728, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/lib/python3.6/site-packages/urllib3/util/retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='opi-proxy.opensuse.org', port=443): Max retries exceeded with url: /?obs_api_link=https%3A%2F%2Fapi.opensuse.org%2Fsearch%2Fpublished%2Fbinary%2Fid%3Fmatch%3Dcontains-ic%2528%2540name%252C%2B%2527apache2%2527%2529%2Band%2Bpath%252Fproject%253D%2527openSUSE%253ALeap%253A15.5%2527%26limit%3D0&obs_instance=openSUSE (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7a5a3c53c8>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/opi", line 146, in <module>
    repo_query(args.query)
  File "/usr/bin/opi", line 72, in repo_query
    packages.extend(opi.search_published_packages('openSUSE', query))
  File "/usr/lib/python3.6/site-packages/opi/__init__.py", line 500, in search_published_packages
    r = requests.get(PROXY_URL, params={'obs_api_link': url, 'obs_instance': obs_instance})
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 544, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 657, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='opi-proxy.opensuse.org', port=443): Max retries exceeded with url: /?obs_api_link=https%3A%2F%2Fapi.opensuse.org%2Fsearch%2Fpublished%2Fbinary%2Fid%3Fmatch%3Dcontains-ic%2528%2540name%252C%2B%2527apache2%2527%2529%2Band%2Bpath%252Fproject%253D%2527openSUSE%253ALeap%253A15.5%2527%26limit%3D0&obs_instance=openSUSE (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7a5a3c53c8>: Failed to establish a new connection: [Errno 111] Connection refused',))
asdil12 commented 5 months ago

What does curl -v https://opi-proxy.opensuse.org/ output? If you can reach it, it should return something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>The browser (or proxy) sent a request that this server could not understand.</p>

So your filewall would need to allow https connections on port 443 to opi-proxy.opensuse.org

marcoczen commented 5 months ago

If you can reach it, it should return something like this:

Hi ... As below;

# nc -v opi-proxy.opensuse.org 443
nc: connect to opi-proxy.opensuse.org port 443 (tcp) failed: Connection refused
nc: connect to opi-proxy.opensuse.org port 443 (tcp) failed: Network is unreachable

# nc -v download.opensuse.org 443
Connection to download.opensuse.org 443 port [tcp/https] succeeded!

# nc -v google.com 443
Connection to google.com 443 port [tcp/https] succeeded!

Also;

# nmap -v -Pn -sS -sU opi-proxy.opensuse.org

Scanning opi-proxy.opensuse.org (195.135.223.50) [1000 ports]
Discovered open port 53/tcp on 195.135.223.50
Completed SYN Stealth Scan at 08:09, 0.03s elapsed (1000 total ports)
Initiating UDP Scan at 08:09
Scanning opi-proxy.opensuse.org (195.135.223.50) [1000 ports]
Discovered open port 53/udp on 195.135.223.50
Discovered open port 123/udp on 195.135.223.50
Completed UDP Scan at 08:09, 0.03s elapsed (1000 total ports)

Nmap scan report for opi-proxy.opensuse.org (195.135.223.50)
Host is up (0.00028s latency).

Other addresses for opi-proxy.opensuse.org (not scanned): 2a07:de40:b27e:1204::10
rDNS record for 195.135.223.50: legacy-ip.atlas.opensuse.org
Not shown: 999 closed tcp ports (reset), 998 filtered udp ports (port-unreach)

PORT    STATE SERVICE
53/tcp  open  domain
53/udp  open  domain
123/udp open  ntp

Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 0.22 seconds
           Raw packets sent: 2015 (90.927KB) | Rcvd: 2015 (115.162KB)
asdil12 commented 5 months ago

Port 443 on opi-proxy.opensuse.org needs to be allowed, but that doesn't seem to work from your system.

It works for me, though. Both via IPv4 and IPv6.

marcoczen commented 5 months ago

Hi. I uninstalled and reinstalled opi. It doesnt show any errors now.

I ran opi apache2 and got a list of output. I havent figured out how to make it show info about each package and how to install though.

asdil12 commented 5 months ago

just select the number of the entry you want as shown here:

image

marcoczen commented 5 months ago

Ok. Looks like I didnt get the lower portion of the output - back to the drawing board for me then .... Thanks mate !!! Closed

marcoczen commented 5 months ago

Closed