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.26k stars 242 forks source link

[BUG] `crc setup` fails to get current user ID on Fedora CSB #4194

Open ebensh opened 5 months ago

ebensh commented 5 months ago

General information

OS: Fedora Linux 39 (CSB)

KVM, I think

crc setup is actually the part that is failing

Laptop

CRC version

CRC version: 2.34.1+b470b5f6
OpenShift version: 4.15.3
Podman version: 4.4.4

CRC status

DEBU CRC version: 2.34.1+b470b5f6                 
DEBU OpenShift version: 4.15.3                    
DEBU Podman version: 4.4.4                        
DEBU Running 'crc status'                         
crc does not seem to be setup correctly, have you run 'crc setup'?

CRC config

- consent-telemetry                     : no
- preset                                : microshift

Host Operating System

───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /etc/os-release
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ NAME="Fedora Linux"
   2   │ VERSION="39 (Workstation Edition)"
   3   │ ID=fedora
   4   │ VERSION_ID=39
   5   │ VERSION_CODENAME=""
   6   │ PLATFORM_ID="platform:f39"
   7   │ PRETTY_NAME="Fedora Linux 39 (Workstation Edition)"
   8   │ ANSI_COLOR="0;38;2;60;110;180"
   9   │ LOGO=fedora-logo-icon
  10   │ CPE_NAME="cpe:/o:fedoraproject:fedora:39"
  11   │ DEFAULT_HOSTNAME="fedora"
  12   │ HOME_URL="https://fedoraproject.org/"
  13   │ DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f39/system-administrators-guide/"
  14   │ SUPPORT_URL="https://ask.fedoraproject.org/"
  15   │ BUG_REPORT_URL="https://bugzilla.redhat.com/"
  16   │ REDHAT_BUGZILLA_PRODUCT="Fedora"
  17   │ REDHAT_BUGZILLA_PRODUCT_VERSION=39
  18   │ REDHAT_SUPPORT_PRODUCT="Fedora"
  19   │ REDHAT_SUPPORT_PRODUCT_VERSION=39
  20   │ SUPPORT_END=2024-11-12
  21   │ VARIANT="Workstation Edition"
  22   │ VARIANT_ID=workstation
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Steps to reproduce

  1. Run crc setup

Expected

Proceed with crc setup

Actual

$ crc setup
INFO Using bundle path /home/ebenshet/.crc/cache/crc_microshift_libvirt_4.15.3_amd64.crcbundle 
INFO Checking if running as non-root              
INFO Checking if running inside WSL2              
INFO Checking if crc-admin-helper executable is cached 
INFO Checking if running on a supported CPU architecture 
INFO Checking if crc executable symlink exists    
INFO Checking minimum RAM requirements            
INFO Check if Podman binary exists in: /home/ebenshet/.crc/bin/oc 
INFO Checking if Virtualization is enabled        
INFO Checking if KVM is enabled                   
INFO Checking if libvirt is installed             
INFO Checking if user is part of libvirt group    
INFO Adding user to libvirt group                 
Failed to get current user id

Logs

Before gather the logs try following if that fix your issue

$ crc delete -f
Machine does not exist. Use 'crc start' to create it

$ crc cleanup
INFO Removing vsock configuration                 
INFO Removing 'crc' network from libvirt          
INFO Removing /etc/NetworkManager/dispatcher.d/99-crc.sh file 
INFO Removing crc daemon systemd socket units     
INFO Removing crc daemon systemd service          
INFO Removing crc's virtual machine               
INFO Removing crc libvirt storage pool            
INFO Removing CRC Specific entries from user's known_hosts file 
INFO Removing hosts file records added by CRC     
INFO Removing pull secret from the keyring        
INFO Removing older logs                          
Cleanup finished

$ crc setup --log-level debug
DEBU CRC version: 2.34.1+b470b5f6                 
DEBU OpenShift version: 4.15.3                    
DEBU Podman version: 4.4.4                        
DEBU Running 'crc setup'                          
INFO Using bundle path /home/ebenshet/.crc/cache/crc_microshift_libvirt_4.15.3_amd64.crcbundle 
DEBU Checking if systemd-resolved.service is running 
DEBU Running 'systemctl status systemd-resolved.service' 
DEBU systemd-resolved.service is already running  
INFO Checking if running as non-root              
INFO Checking if running inside WSL2              
INFO Checking if crc-admin-helper executable is cached 
DEBU Running '/home/ebenshet/.crc/bin/crc-admin-helper-linux --version' 
DEBU Found crc-admin-helper-linux version 0.5.2   
DEBU crc-admin-helper executable already cached   
INFO Checking if running on a supported CPU architecture 
DEBU GOARCH is amd64 GOOS is linux                
INFO Checking if crc executable symlink exists    
INFO Checking minimum RAM requirements            
DEBU Total memory of system is 67110907904 bytes  
INFO Check if Podman binary exists in: /home/ebenshet/.crc/bin/oc 
INFO Checking if Virtualization is enabled        
DEBU Checking if the vmx/svm flags are present in /proc/cpuinfo 
DEBU CPU virtualization flags are good            
INFO Checking if KVM is enabled                   
DEBU Checking if /dev/kvm exists                  
DEBU /dev/kvm was found                           
INFO Checking if libvirt is installed             
DEBU Checking if 'virsh' is available             
DEBU 'virsh' was found in /usr/bin/virsh          
DEBU Checking 'virsh capabilities' for libvirtd/qemu availability 
DEBU Running 'virsh --readonly --connect qemu:///system capabilities' 
DEBU Found x86_64 hypervisor with 'hvm' capabilities 
INFO Checking if user is part of libvirt group    
DEBU Checking if current user is part of the libvirt group 
DEBU user.Current() failed: user: unknown userid 4200659
DEBU Failed to get current user id                
INFO Adding user to libvirt group                 
DEBU Adding current user to the libvirt group     
DEBU user.Current() failed: user: unknown userid 4200659
Failed to get current user id

This seems to be related to Fedora CSB using Kerberos users, not /etc/passwd type local users.

Golang method failing: https://pkg.go.dev/os/user#Current Source: https://cs.opensource.google/go/go/+/master:src/os/user/user.go;l=70?q=user.go

Maybe this helps: https://cs.opensource.google/go/go/+/master:src/os/user/user.go;l=14-17?q=user.go , where they mention that cgo would use a different library to do the user lookup?

ebensh commented 5 months ago

A workaround was provided for bypassing this specific check:

crc config set skip-check-user-in-libvirt-group true

I'm closing it out.

cfergeau commented 5 months ago

Let's keep this open while we decide if the workaround is the best we can do, or if this can be fixed in crc

gbraad commented 5 months ago

Workaround is not the same as solution; there is still something wrong.

praveenkumar commented 5 months ago

I installed CSB-39 to debug networking issue sometime back but didn't hit this issue. Did you customized something else that your user is not detected but uid ?

ebensh commented 5 months ago

Not that I'm aware of. The laptop might've been delivered to me with CSB-38 or CSB-37 and later upgraded, but I don't think I've customized anything related to my user or authentication methods.

I used to use my personal laptop with Fedora (not CSB) and had set up my own Kerberos authentication path on the VPN there; when I received my refresh laptop with CSB I started using that instead. It seems the CSB laptop logs in directly to a Kerberos user, instead of also having a local user account - for example, there is no user in /etc/passwd at all for me. On my personal laptop, where I had a local user, tools like k9s and crc had no issues.

FWIW, another team member of mine has similar issues with his CSB laptop, and we both first hit it with k9s: https://github.com/derailed/k9s/issues/2175 , but the core issue seems to be the same thing.

porridge commented 5 months ago

FWIW I suppose the problem with k9s in my case might have been that the libc I was using (from nix) is not configured/built with support for the whatever user DB backend is natively used on Fedora CSB.

ebensh commented 5 months ago

@porridge I'm also using nix to install k9s and crc - have you tried installing them via dnf? Do you see the same problem?

porridge commented 5 months ago

and crc - have you tried installing them via dnf?

I haven't.

gbraad commented 5 months ago

Hmmm... so this ran from a nix-shell. Can you in that case try it from a regular bash-shell that runs within the Fedora userspace?

anjannath commented 3 months ago

@ebensh Hi, did you try to run it from a regular bash shell, and did it help?