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

kvm: provide solution if user doesn't belong to libvirt group #10712

Merged
merged 2 commits into from
Mar 6, 2021

Conversation

prezha
Copy link
Contributor

@prezha prezha commented Mar 4, 2021

fixes #5617
fixes #10070

for kvm driver, as described in original issues, if user does not belong to libvirt group, we fail with a generic confusing message
here we check that and provide a more descriptive solution message if not

example (after)

❯ id
uid=1000(prezha) gid=100(users) groups=100(users),459(docker)
❯ minikube start --driver=kvm2
😄  minikube v1.18.0 on Opensuse-Tumbleweed
✨  Using the kvm2 driver based on user configuration

🚫  Exiting due to PR_KVM_USER_PERMISSION: libvirt group membership check failed:
user is not a member of the appropriate libvirt group
💡  Suggestion: Ensure that you are a member of the appropriate libvirt group (remember to relogin for group changes to take effect!)
📘  Documentation: https://minikube.sigs.k8s.io/docs/reference/drivers/kvm2/
🍿  Related issues:
    ▪ https://github.com/kubernetes/minikube/issues/5617
    ▪ https://github.com/kubernetes/minikube/issues/10070
❯ minikube start --driver=kvm2 --alsologtostderr -v=9
I0304 01:28:48.201151    1629 out.go:239] Setting OutFile to fd 1 ...
I0304 01:28:48.201206    1629 out.go:291] isatty.IsTerminal(1) = true
I0304 01:28:48.201211    1629 out.go:252] Setting ErrFile to fd 2...
I0304 01:28:48.201215    1629 out.go:291] isatty.IsTerminal(2) = true
I0304 01:28:48.201284    1629 root.go:308] Updating PATH: /home/prezha/.minikube/bin
I0304 01:28:48.201437    1629 out.go:246] Setting JSON to false
I0304 01:28:48.225822    1629 start.go:108] hostinfo: {"hostname":"codex.triplepoint.tech","uptime":7886,"bootTime":1614813443,"procs":416,"os":"linux","platform":"opensuse-tumbleweed","platformFamily":"","platformVersion":"","kernelVersion":"5.10.16-1-default","kernelArch":"x86_64","virtualizationSystem":"kvm","virtualizationRole":"host","hostId":"8fbb1ced-553b-443c-a3a1-fd6724e8ce90"}
I0304 01:28:48.226056    1629 start.go:118] virtualization: kvm host
I0304 01:28:48.237151    1629 out.go:129] 😄  minikube v1.18.0 on Opensuse-Tumbleweed
😄  minikube v1.18.0 on Opensuse-Tumbleweed
I0304 01:28:48.237467    1629 notify.go:126] Checking for updates...
I0304 01:28:48.237777    1629 driver.go:323] Setting default libvirt URI to qemu:///system
I0304 01:28:48.243203    1629 out.go:129] ✨  Using the kvm2 driver based on user configuration
✨  Using the kvm2 driver based on user configuration
I0304 01:28:48.243272    1629 start.go:276] selected driver: kvm2
I0304 01:28:48.243297    1629 start.go:718] validating driver "kvm2" against <nil>
I0304 01:28:48.243335    1629 start.go:729] status for kvm2: {Installed:true Healthy:false Running:true NeedsImprovement:false Error:libvirt group membership check failed:
user is not a member of the appropriate libvirt group Reason:PR_KVM_USER_PERMISSION Fix:Check that libvirtd is properly installed and that you are a member of the appropriate libvirt group (remember to relogin for group changes to take effect!) Doc:https://minikube.sigs.k8s.io/docs/reference/drivers/kvm2/}
I0304 01:28:48.246662    1629 out.go:129]

W0304 01:28:48.246878    1629 out.go:191] 🚫  Exiting due to PR_KVM_USER_PERMISSION: libvirt group membership check failed:
user is not a member of the appropriate libvirt group
🚫  Exiting due to PR_KVM_USER_PERMISSION: libvirt group membership check failed:
user is not a member of the appropriate libvirt group
W0304 01:28:48.247126    1629 out.go:191] 💡  Suggestion: Ensure that you are a member of the appropriate libvirt group (remember to relogin for group changes to take effect!)
💡  Suggestion: Ensure that you are a member of the appropriate libvirt group (remember to relogin for group changes to take effect!)
W0304 01:28:48.247252    1629 out.go:191] 📘  Documentation: https://minikube.sigs.k8s.io/docs/reference/drivers/kvm2/
📘  Documentation: https://minikube.sigs.k8s.io/docs/reference/drivers/kvm2/
W0304 01:28:48.247350    1629 out.go:191] 🍿  Related issues:
🍿  Related issues:
W0304 01:28:48.247497    1629 out.go:191]     ▪ https://github.com/kubernetes/minikube/issues/5617
    ▪ https://github.com/kubernetes/minikube/issues/5617
W0304 01:28:48.247615    1629 out.go:191]     ▪ https://github.com/kubernetes/minikube/issues/10070
    ▪ https://github.com/kubernetes/minikube/issues/10070
I0304 01:28:48.253543    1629 out.go:129]

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 4, 2021
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 4, 2021
pkg/minikube/registry/drvs/kvm2/kvm2.go Outdated Show resolved Hide resolved
@prezha prezha requested review from ilya-zuyev and medyagh March 6, 2021 01:47
@medyagh
Copy link
Member

medyagh commented Mar 6, 2021

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Mar 6, 2021
@kubernetes kubernetes deleted a comment from minikube-pr-bot Mar 6, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: medyagh, prezha

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 6, 2021
@medyagh medyagh merged commit 0f44057 into kubernetes:master Mar 6, 2021
@offlinehacker
Copy link

This check breaks if using libvirt over tcp. I am running libvirt inside docker container and this breaks minikube. It also kinda does not make sense to force this check.

@prezha
Copy link
Contributor Author

prezha commented May 14, 2021

@offlinehacker i think this check has been there for a while now and was asked by users with an idea to prevent a number of issues (eg, #5617)

for your specific setup, did you try --force flag (it should emit an error but not exit then)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
5 participants