OndrejHome / fast-vm

'fast-vm' is a script for defining VMs from images provided in thin LVM pool.
GNU General Public License v3.0
22 stars 14 forks source link

"fast-vm list" keep asking for sudo password #53

Closed jrjeon closed 2 years ago

jrjeon commented 2 years ago

when runing fast-vm list, it errors with sudo password is required. Once, I run the command with sudo, then it stops asking.

$ fast-vm list
sudo: a password is required
VM# Image name      Status       Profile_name    Size( %used )  Activity  Notes
sudo: a password is required
-:1: parser error : Document is empty
/usr/bin/fast-vm: line 208: (1638929036-)/86400: syntax error: operand expected (error token is ")/86400")
 75 rhel-7.5        shut off                                         ago  : 
-:1: parser error : Document is empty
/usr/bin/fast-vm: line 208: (1638929036-)/86400: syntax error: operand expected (error token is ")/86400")
 79 rhel-7.9        shut off                                         ago  : 
-:1: parser error : Document is empty
/usr/bin/fast-vm: line 208: (1638929037-)/86400: syntax error: operand expected (error token is ")/86400")
 88 rhel-8.3        shut off                                         ago  : 
-:1: parser error : Document is empty
/usr/bin/fast-vm: line 208: (1638929037-)/86400: syntax error: operand expected (error token is ")/86400")
 89 rhel-8.3        shut off                                         ago  : 

I'm running fast-vm 1.7

# rpm -q fast-vm
fast-vm-1.7-1.el7.noarch
OndrejHome commented 2 years ago

Hi @jrjeon Jaram,

Thank you for reporting this issue. It seems as if something was missing from sudoers created by fast-vm during setup.

The request for sudo comes from this line - https://github.com/OndrejHome/fast-vm/blob/87f5a2e83d28059d6ff4ffb78b5b49919f47cc6c/fast-vm#L977

  1. Would you be able to run following command on your system to check that it will ask for sudo password?

    # echo 'lvs'|LANG=C sudo -n /usr/libexec/fast-vm-helper.sh
    fastvm-pool 10.00g 0.00 private 
  2. Can you check if you have following fast-vm-sudoers file present on your system?

    # cat /etc/sudoers.d/fast-vm-sudoers 
    ## fast-vm helper script
    %libvirt ALL=(root) NOPASSWD: /usr/libexec/fast-vm-helper.sh
  3. For completeness could you please also provide me with following outputs?

    $ cat /etc/fast-vm.conf
    $ id
    $ id <your_user>

Thank you!

jrjeon commented 2 years ago

Hi Ondrej,

I apology for late update. it looks like there was some issue on sudo configuration, once I clean up the mess, I no longer sees error message. Thanks for the help.