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

[BUG] Linux crc dev preview unable to determine group membership #2922

Closed
larsks opened this issue Jan 5, 2022 · 3 comments
Closed

[BUG] Linux crc dev preview unable to determine group membership #2922

larsks opened this issue Jan 5, 2022 · 3 comments

Comments

@larsks
Copy link

larsks commented Jan 5, 2022

General information

  • OS: Linux
  • Hypervisor: KVM
  • Did you run crc setup before starting it (Yes/No)? Yes
  • Running CRC on: Desktop

CRC version

CodeReady Containers version: 1.99.0+c9e2be01
OpenShift version: 4.9.10 (not embedded in executable)

CRC status

level=debug msg="CodeReady Containers version: 1.99.0+c9e2be01\n"
level=debug msg="OpenShift version: 4.9.10 (not embedded in executable)\n"
level=debug msg="Running 'crc status'"
level=debug msg="Checking file: /home/lars/.crc/machines/crc/.crc-exist"
level=debug msg="Checking file: /home/lars/.crc/machines/crc/.crc-exist"
level=debug msg="Found binary path at /home/lars/.crc/bin/crc-driver-libvirt"
level=debug msg="Launching plugin server for driver libvirt"
level=debug msg="Plugin server listening at address 127.0.0.1:42257"
level=debug msg="() Calling .GetVersion"
level=debug msg="Using API Version 1"
level=debug msg="() Calling .SetConfigRaw"
level=debug msg="() Calling .GetMachineName"
level=debug msg="(crc) Calling .GetBundleName"
level=debug msg="(crc) Calling .GetState"
level=debug msg="(crc) DBG | time=\"2022-01-05T14:49:20-05:00\" level=debug msg=\"Getting current state...\""
level=debug msg="(crc) DBG | time=\"2022-01-05T14:49:20-05:00\" level=debug msg=\"Fetching VM...\""
level=debug msg="(crc) Calling .GetIP"
level=debug msg="(crc) DBG | time=\"2022-01-05T14:49:20-05:00\" level=debug msg=\"GetIP called for crc\""
level=debug msg="(crc) DBG | time=\"2022-01-05T14:49:20-05:00\" level=debug msg=\"Getting current state...\""
level=debug msg="(crc) DBG | time=\"2022-01-05T14:49:20-05:00\" level=debug msg=\"IP address: 192.168.130.11\""
level=debug msg="(crc) Calling .GetIP"
level=debug msg="(crc) DBG | time=\"2022-01-05T14:49:20-05:00\" level=debug msg=\"GetIP called for crc\""
level=debug msg="(crc) DBG | time=\"2022-01-05T14:49:20-05:00\" level=debug msg=\"Getting current state...\""
level=debug msg="(crc) DBG | time=\"2022-01-05T14:49:20-05:00\" level=debug msg=\"IP address: 192.168.130.11\""
level=debug msg="Running SSH command: df -B1 --output=size,used,target /sysroot | tail -1"
level=debug msg="Using ssh private keys: [/home/lars/.crc/machines/crc/id_ecdsa /home/lars/.crc/cache/crc_libvirt_4.9.10/id_ecdsa_crc]"
level=debug msg="SSH command results: err: <nil>, output: 32737570816 25746472960 /sysroot\n"
level=debug msg="Unexpected operator status for etcd: RecentBackup"
level=debug msg="Making call to close driver server"
level=debug msg="(crc) Calling .Close"
level=debug msg="Successfully made call to close driver server"
level=debug msg="Making call to close connection to plugin binary"
level=debug msg="(crc) DBG | time=\"2022-01-05T14:49:20-05:00\" level=debug msg=\"Closing plugin on server side\""
CRC VM:          Running
OpenShift:       Running (v4.9.10)
Podman:          
Disk Usage:      25.75GB of 32.74GB (Inside the CRC VM)
Cache Usage:     15.65GB
Cache Directory: /home/lars/.crc/cache

CRC config

- consent-telemetry                     : yes
- pull-secret-file                      : /home/lars/.config/crc/pull-secret.txt
- skip-check-user-in-libvirt-group      : true

Host Operating System

NAME="Fedora Linux"
VERSION="35 (Workstation Edition)"
ID=fedora
VERSION_ID=35
VERSION_CODENAME=""
PLATFORM_ID="platform:f35"
PRETTY_NAME="Fedora Linux 35 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:35"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f35/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=35
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=35
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation

Steps to reproduce

  1. Successfully run crc setup

  2. Attempt to start crc with crc start

  3. Watch crc fail with:

    INFO Checking if user is part of libvirt group
    WARN Preflight checks failed during `crc start`, please try to run `crc setup` first in case you haven't done so yet
    Failed to get the groups user 'lars' belongs to
    

This appears to be caused by building crc with CGO_ENABLED=0. You
can reproduce the problem yourself with this code:

package main

import (
	"fmt"
	"log"
	"os/user"
)

func main() {
	currentUser, err := user.Current()
	if err != nil {
		log.Printf("user.Current() failed: %v", err)
		return
	}

	gids, err := currentUser.GroupIds()
	if err != nil {
		log.Printf("Failed to get the groups user '%s' belongs to", currentUser.Username)
		return
	}

	fmt.Printf("gids: %s\n", gids)
}

With CGO enabled:

$ CGO_ENABLED=1 go build
$ ./example
gids: [1000 10 18 999 983 135]

With CGO disabled:

$ CGO_ENABLED=0 go build
$ ./example
2022/01/05 15:15:59 Failed to get the groups user 'lars' belongs to

Logs

With --log-level debug, the relevant logs are:

INFO Checking if user is part of libvirt group
DEBU Checking if current user is part of the libvirt group
DEBU Failed to get the groups user 'lars' belongs to
WARN Preflight checks failed during `crc start`, please try to run `crc setup` first in case you haven't done so yet
Failed to get the groups user 'lars' belongs to
@larsks larsks added kind/bug Something isn't working status/need triage labels Jan 5, 2022
@gbraad
Copy link
Contributor

gbraad commented Jan 6, 2022

Awkward; we do this exact check:

https://github.com/code-ready/crc/blob/4c866b133cf77e5d4a85f9b390540b60e7998634/pkg/crc/preflight/preflight_checks_linux.go#L197-L222

as this exists since quite long on master. We do not specifically use CGO_ENABLED as we know the implications of this also. We compile as:

go install -ldflags="-X github.com/code-ready/crc/pkg/crc/version.crcVersion=1.37.0 -X github.com/code-ready/crc/pkg/crc/version.bundleVersion=4.9.11 -X github.com/code-ready/crc/pkg/crc/version.commitSha=23a4aaf1 "  ./cmd/crc

and this is the first time we see this report. We will have to investigate this a little more.

@gbraad gbraad added os/linux priority/major points/1 status/need more information Issue needs more information before it will be looked at tags/help wanted Extra attention is needed and removed status/need triage labels Jan 6, 2022
@praveenkumar
Copy link
Member

@larsks I have updated the release artifacts looks like the linux artifact on the release page was from a cross-build on non linux platform and which might caused this issue. https://cs.opensource.google/go/go/+/refs/tags/go1.17.5:src/os/user/lookup_stubs.go might be case which @cfergeau pointed out internal slack discussion.

@gbraad gbraad removed tags/help wanted Extra attention is needed status/need more information Issue needs more information before it will be looked at labels Jan 6, 2022
@praveenkumar
Copy link
Member

I am closing this one since it happened because uploaded build done on non-linux platform and #2922 (comment) explains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants