crc-org / crc

CRC is a tool to help you run containers. It manages a local OpenShift 4.x cluster, Microshift or a Podman VM optimized for testing and development purposes
https://crc.dev
Apache License 2.0
1.25k stars 236 forks source link

[BUG] failed to expose port 127.0.0.1:2222 -> 192.168.127.2:22: listen tcp 127.0.0.1:2222: bind: An attempt was made to access a socket in a way forbidden by its access permissions. #3122

Closed ciis0 closed 2 years ago

ciis0 commented 2 years ago

General information

CRC version

# Put `crc version` output here
CodeReady Containers version: 2.0.1+f0fcd50e
OpenShift version: 4.10.3
Podman version: 3.4.4

CRC status

# Put `crc status --log-level debug` output here
DEBU CodeReady Containers version: 2.0.1+f0fcd50e
DEBU OpenShift version: 4.10.3
DEBU Podman version: 3.4.4
DEBU Running 'crc status'
DEBU Checking file: C:\Users\A613952\.crc\machines\crc\.crc-exist
DEBU Checking file: C:\Users\A613952\.crc\machines\crc\.crc-exist
DEBU Running 'Hyper-V\Get-VM crc | Select-Object -ExpandProperty State'
CRC VM:          Stopped
OpenShift:       Stopped (v4.10.3)
Podman:
Disk Usage:      0B of 0B (Inside the CRC VM)
Cache Usage:     18.16GB
Cache Directory: C:\Users\A613952\.crc\cache

CRC config

# Put `crc config view` output here
- consent-telemetry                     : no

Host Operating System

# Put the output of `cat /etc/os-release` in case of Linux
# put the output of `sw_vers` in case of Mac
# Put the output of `systeminfo` in case of Windows
Host Name:                 DESKTOP-FL37PIH
OS Name:                   Microsoft Windows 10 Enterprise
OS Version:                10.0.19043 N/A Build 19043
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
Registered Owner:          N/A
Registered Organization:   N/A
Product ID:                00330-53909-71786-AAOEM
Original Install Date:     2 Nov 2021, 15:47:57
System Boot Time:          21 Apr 2022, 09:41:47
System Manufacturer:       LENOVO
System Model:              20TMS06816
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 165 Stepping 2 GenuineIntel ~2712 Mhz
BIOS Version:              LENOVO N30ET39W (1.22 ), 16 Jun 2021
Windows Directory:         C:\WINDOWS
System Directory:          C:\WINDOWS\system32
Boot Device:               \Device\HarddiskVolume1
System Locale:             en-us;English (United States)
Input Locale:              de;German (Germany)
Time Zone:                 (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
Total Physical Memory:     32.521 MB
Available Physical Memory: 23.358 MB
Virtual Memory: Max Size:  37.385 MB
Virtual Memory: Available: 26.092 MB
Virtual Memory: In Use:    11.293 MB
Page File Location(s):     C:\pagefile.sys
Domain:                    <snip>
Logon Server:              \\DESKTOP-FL37PIH
Hotfix(s):                 9 Hotfix(s) Installed.
                           [01]: KB5012117
                           [02]: KB4562830
                           [03]: KB5000736
                           [04]: KB5012599
                           [05]: KB5006753
                           [06]: KB5007273
                           [07]: KB5011352
                           [08]: KB5011651
                           [09]: KB5005699
Network Card(s):           9 NIC(s) Installed.
                           [01]: Zscaler Network Adapter 1.0.2.0
                                 Connection Name: Ethernet 2
                                 Status:          Media disconnected
                           [02]: Wintun Userspace Tunnel
                                 Connection Name: OpenVPN Wintun
                                 Status:          Media disconnected
                           [03]: TAP-Windows Adapter V9
                                 Connection Name: Local Area Connection
                                 DHCP Enabled:    Yes
                                 DHCP Server:     10.8.3.254
                                 IP address(es)
                                 [01]: 10.8.3.236
                                 [02]: fe80::cc42:292:5f4d:990f
                           [04]: Intel(R) Wi-Fi 6 AX201 160MHz
                                 Connection Name: Wi-Fi
                                 DHCP Enabled:    Yes
                                 DHCP Server:     192.168.2.1
                                 IP address(es)
                                 [01]: 192.168.2.114
                                 [02]: fe80::e8b6:cc7:aa46:8e7a
                                 [03]: 2003:eb:6726:65d6:8da0:6c11:508d:5eab
                                 [04]: 2003:eb:6726:65d6:e8b6:cc7:aa46:8e7a
                           [05]: Intel(R) Ethernet Connection (11) I219-LM
                                 Connection Name: Ethernet
                                 Status:          Media disconnected
                           [06]: Bluetooth Device (Personal Area Network)
                                 Connection Name: Bluetooth Network Connection
                                 Status:          Media disconnected
                           [07]: Hyper-V Virtual Ethernet Adapter
                                 Connection Name: vEthernet (nat)
                                 DHCP Enabled:    No
                                 IP address(es)
                                 [01]: 172.25.128.1
                                 [02]: fe80::94d4:8775:2736:3ace
                           [08]: Hyper-V Virtual Ethernet Adapter
                                 Connection Name: vEthernet (Default Switch)
                                 DHCP Enabled:    No
                                 IP address(es)
                                 [01]: 172.17.160.1
                                 [02]: fe80::18bd:8ee:cfc8:d161
                           [09]: Hyper-V Virtual Ethernet Adapter
                                 Connection Name: vEthernet (WSL)
                                 DHCP Enabled:    No
                                 IP address(es)
                                 [01]: 172.29.160.1
                                 [02]: fe80::f06a:4283:496a:b45d
Hyper-V Requirements:      A hypervisor has been detected. Features required for Hyper-V will not be displayed.

Steps to reproduce

  1. crc setup
  2. crc start

Expected

crc starts

Actual

crc start fails

Logs

Before gather the logs try following if that fix your issue

$ crc delete -f
$ crc cleanup
$ crc setup
$ crc start --log-level debug

Please consider posting the output of crc start --log-level debug on http://gist.github.com/ and post the link in the issue.

https://gist.github.com/ciis0/b56dfde9325cdef4439b6fe949e826d0

It seems like the machine in hyper-v does not even have a NIC.

image

praveenkumar commented 2 years ago

@ciis0 bind: An attempt was made to access a socket in a way forbidden by its access permissions. Can you check if some other service is using port 2222 ?

ciis0 commented 2 years ago

yes, no service ist listening:

> netstat -ano | findstr 2222
>
praveenkumar commented 2 years ago

@ciis0 Can you try one of the suggestions mentioned in https://stackoverflow.com/questions/15619921/an-attempt-was-made-to-access-a-socket-in-a-way-forbidden-by-its-access-permissi here?

ciis0 commented 2 years ago

Hi,

aaaah, yes, thank you, this one helped:

Restart-Service hns -f

:)

dobraalkan commented 1 year ago
  1. Go to "Start" --> "Control Panel"
  2. Click on "Windows Firewall"
  3. Inside Windows Firewall, click on "Allow a program or feature through Windows Firewall"
  4. Now inside of Allow Programs, Click on the "Change Settings" button. Once you click on the Change Settings button, the "Allow another program..." button gets enabled.
  5. When you click on the "Allow another program..." button, a new dialog box will appear.
  6. Click "Browse" button and find "crc.exe" and "Add" button.
  7. Click OK, and restart your machine.
EBoiSha commented 1 year ago

The above mentioned links do not solve the issue. They are a workaround in case the port is blocked but the issue is somewhere else. My port 2222 is no where used and I still get the same error

I rather believe it is either a Windows configuration issue

cfergeau commented 1 year ago

Is this a Windows installed managed by your company? Or is this a personal Windows installation?

ciis0 commented 1 year ago

for me it's company managed.

EBoiSha commented 1 year ago

Yes, Windows installed managed by company. I switch the ingress-http-port port to use something else than 80 and after this I was able to apply crc start successfully. However, except that any service using port 80 needs to be called with another port I am unsure about the implications