Opennebula - sudo: no tty present and no askpass program specified

Hi,

I have a problem with Opennebula that I have been trying t o solve for weeks, I have tried many options and have got nowhere.

I have two HP ML115 servers configured to act as opennebula cluster nodes named opennebula01 and opennebula02. I have also installed the Front-end opennebula management deamon on node opennebula01.

To use opennebula I have created a paswordless oneadmin user which seems to be ok because I can ssh to localhost and both nodes without a password.

Using the onehost command I have created two hosts both tehse hosts are running correctly.
See Example1.

Periodically the opennebula monitoring system will fail, the problem I am having is that the logs keep showing the message:
“sudo: no tty present and no askpass program specified”
See example2

I have used the visudo command to change the sudoers Defaults visiblepw option but I just get a “root’s password:root’s password:sudo: pam_authenticate: Conversation error” error.
See Example 3 and Example 4.

I would be grateful for any help to solve the “sudo: no tty present and no askpass program specified” problem.

Example1

oneadmin@opennebula01:/srv/cloud/images/ttylinux> onehost list
ID NAME RVM TCPU FCPU ACPU TMEM FMEM STAT
0 opennebula01 0 0 0 100 0 0 on
1 opennebula02 0 0 0 100 0 0 on

Example 2

Tue Mar 16 23:16:10 GMT 2010
linux@opennebula01:~/Desktop> su oneadmin
Password:
oneadmin@opennebula01:/home/linux/Desktop> tail -f $ONE_LOCATION/var/oned.log

tail: /srv/cloud/one/var/oned.log: file truncated
Tue Mar 16 23:29:44 2010 [VMM]: Loading Virtual Machine Manager drivers.
Tue Mar 16 23:29:44 2010 [VMM]
: Loading driver: vmm_xen (XEN)
Tue Mar 16 23:29:44 2010 [VMM]: Driver vmm_xen loaded.
Tue Mar 16 23:29:44 2010 [InM]
: Loading Information Manager drivers.
Tue Mar 16 23:29:44 2010 [InM]: Loading driver: im_xen
Tue Mar 16 23:29:44 2010 [InM]
: Driver im_xen loaded
Tue Mar 16 23:29:44 2010 [TM]: Loading Transfer Manager drivers.
Tue Mar 16 23:29:44 2010 [VMM]
: Loading driver: tm_ssh
Tue Mar 16 23:29:45 2010 [TM]: Driver tm_ssh loaded.
Tue Mar 16 23:29:45 2010 [VMM]
: Loading driver: tm_nfs
Tue Mar 16 23:29:45 2010 [TM]: Driver tm_nfs loaded.
Tue Mar 16 23:29:45 2010 [VMM]
: Loading driver: tm_lvm
Tue Mar 16 23:29:45 2010 [TM]: Driver tm_lvm loaded.
Tue Mar 16 23:29:45 2010 [HKM]
: Loading Hook Manager driver.
Tue Mar 16 23:29:45 2010 [HKM]: Hook Manager loaded
Tue Mar 16 23:29:53 2010 [ReM][D]: VirtualMachinePoolInfo method invoked
Tue Mar 16 23:30:05 2010 [ReM][D]: HostPoolInfo method invoked
Tue Mar 16 23:30:12 2010 [InM]
: Monitoring host opennebula01 (0)
Tue Mar 16 23:30:12 2010 [InM]: Monitoring host opennebula02 (1)
Tue Mar 16 23:30:13 2010 [InM]
: Command execution fail: ‘mkdir -p /tmp/one-im/; cat > /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f; if “x$?” != “x0” ]; then exit -1; fi; chmod +x /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f; /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f’
Tue Mar 16 23:30:13 2010 [InM]: STDERR follows.
Tue Mar 16 23:30:13 2010 [InM]
: sudo: no tty present and no askpass program specified
Tue Mar 16 23:30:13 2010 [InM]: sudo: no tty present and no askpass program specified
Tue Mar 16 23:30:13 2010 [InM]
: /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f:70: undefined method -' for nil:NilClass (NoMethodError) Tue Mar 16 23:30:13 2010 [InM]*: ExitCode: 1 Tue Mar 16 23:30:13 2010 [InM][D]: Host 0 successfully monitored. Tue Mar 16 23:30:13 2010 [InM]*: Command execution fail: 'mkdir -p /tmp/one-im/; cat > /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f; if "x$?" != "x0" ]; then exit -1; fi; chmod +x /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f; /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f' Tue Mar 16 23:30:13 2010 [InM]*: STDERR follows. Tue Mar 16 23:30:13 2010 [InM]*: sudo: no tty present and no askpass program specified Tue Mar 16 23:30:13 2010 [InM]*: sudo: no tty present and no askpass program specified Tue Mar 16 23:30:13 2010 [InM]*: /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f:70: undefined method -’ for nil:NilClass (NoMethodError)
Tue Mar 16 23:30:13 2010 [InM]: ExitCode: 1
Tue Mar 16 23:30:13 2010 [InM][D]: Host 1 successfully monitored.
Tue Mar 16 23:31:13 2010 [InM]
: Monitoring host opennebula01 (0)
Tue Mar 16 23:31:13 2010 [InM]*: Monitoring host opennebula02 (1)

Example 3

sudoers

Comment out the preceding line and uncomment the following one if you need

to use special input methods. This may allow users to compromise the root

account if they are allowed to run commands without authentication.

#Defaults env_keep = “LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER”

#Defaults visiblepw

In the default (unconfigured) configuration, sudo asks for the root password.

This allows use of an ordinary user account for administration of a freshly

installed system. When configuring sudo, delete the two

following lines:

Defaults targetpw # ask for the password of the target user i.e. root
ALL ALL=(ALL) ALL # WARNING! Only use this together with ‘Defaults targetpw’!

Runas alias specification

User privilege specification

root ALL=(ALL) ALL

Uncomment to allow people in group wheel to run all commands

%wheel ALL=(ALL) ALL

Same thing without a password

%wheel ALL=(ALL) NOPASSWD: ALL

Samples

%users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom

%users localhost=/sbin/shutdown -h now

Added for opennebula to allow oneadmin to execute xen commands

%xen ALL=(ALL) NOPASSWD: /usr/sbin/xm *
%xen ALL=(ALL) NOPASSWD: /usr/sbin/xentop *

Example 4

Tue Mar 16 23:49:20 2010 [InM]: Monitoring host opennebula01 (0)
Tue Mar 16 23:49:20 2010 [InM]
: Monitoring host opennebula02 (1)
Tue Mar 16 23:49:21 2010 [InM]: Command execution fail: ‘mkdir -p /tmp/one-im/; cat > /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f; if “x$?” != “x0” ]; then exit -1; fi; chmod +x /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f; /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f’
Tue Mar 16 23:49:21 2010 [InM]
: STDERR follows.
Tue Mar 16 23:49:21 2010 [InM]: root’s password:root’s password:sudo: pam_authenticate: Conversation error
Tue Mar 16 23:49:21 2010 [InM]
: root’s password:root’s password:sudo: pam_authenticate: Conversation error
Tue Mar 16 23:49:21 2010 [InM]: /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f:70: undefined method -' for nil:NilClass (NoMethodError) Tue Mar 16 23:49:21 2010 [InM]*: ExitCode: 1 Tue Mar 16 23:49:21 2010 [InM][D]: Host 0 successfully monitored. Tue Mar 16 23:49:22 2010 [InM]*: Command execution fail: 'mkdir -p /tmp/one-im/; cat > /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f; if "x$?" != "x0" ]; then exit -1; fi; chmod +x /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f; /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f' Tue Mar 16 23:49:22 2010 [InM]*: STDERR follows. Tue Mar 16 23:49:22 2010 [InM]*: sudo: no tty present and no askpass program specified Tue Mar 16 23:49:22 2010 [InM]*: sudo: no tty present and no askpass program specified Tue Mar 16 23:49:22 2010 [InM]*: /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f:70: undefined method -’ for nil:NilClass (NoMethodError)
Tue Mar 16 23:49:22 2010 [InM]
: ExitCode: 1
Tue Mar 16 23:49:22 2010 [InM][D]: Host 1 successfully monitored.
Tue Mar 16 23:49:42 2010 [VMM]: --Mark–
Tue Mar 16 23:49:51 2010 [InM]
: --Mark–
Tue Mar 16 23:50:21 2010 [InM]: Monitoring host opennebula01 (0)
Tue Mar 16 23:50:22 2010 [InM]
: Command execution fail: ‘mkdir -p /tmp/one-im/; cat > /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f; if “x$?” != “x0” ]; then exit -1; fi; chmod +x /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f; /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f’
Tue Mar 16 23:50:22 2010 [InM]: STDERR follows.
Tue Mar 16 23:50:22 2010 [InM]
: root’s password:root’s password:sudo: pam_authenticate: Conversation error
Tue Mar 16 23:50:22 2010 [InM]: root’s password:root’s password:sudo: pam_authenticate: Conversation error
Tue Mar 16 23:50:22 2010 [InM]
: /tmp/one-im//one_im-0ed949a4bd6f9d3a8e845559ac44e11f:70: undefined method `-’ for nil:NilClass (NoMethodError)
Tue Mar 16 23:50:22 2010 [InM]*: ExitCode: 1

Example 5

oneadmin@opennebula01:/home/linux/Desktop> cd /tmp/one-im/
oneadmin@opennebula01:/tmp/one-im> ls -l
total 16
-rwxr-xr-x 1 oneadmin cloud 3121 2010-03-16 23:56 one_im-0ed949a4bd6f9d3a8e845559ac44e11f
-rwxr-xr-x 1 oneadmin cloud 170 2010-03-16 23:56 one_im-2b966ff3406441e176e9c1d82d536763
-rwxr-xr-x 1 oneadmin cloud 38 2010-03-16 23:56 one_im-34d4a5b5a67817fa9d403fa4be5a8493
-rwxr-xr-x 1 oneadmin cloud 32 2010-03-16 23:56 one_im-91090fd8b53b1cf7ce51f3e4215506e3

Example 6

oneadmin@opennebula01:/tmp/one-im> cat one_im-0ed949a4bd6f9d3a8e845559ac44e11f
#!/usr/bin/env ruby

--------------------------------------------------------------------------

Copyright 2002-2009, Distributed Systems Architecture Group, Universidad

Complutense de Madrid (dsa-research.org)

Licensed under the Apache License, Version 2.0 (the “License”); you may

not use this file except in compliance with the License. You may obtain

a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an “AS IS” BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

#--------------------------------------------------------------------------- #

require “pp”

XENTOP_PATH="/usr/sbin/xentop"
XM_PATH="/usr/sbin/xm"

xentop_text=sudo #{XENTOP_PATH} -bi2
xm_text=sudo #{XM_PATH} info

xentop_text.gsub!(/^xentop.^xentop.?$/m, “”) # Strip first top output
xentop_text.gsub!(“no limit”, “no_limit”)

xentop_text=xentop_text.split("
“)
xentop_text.reject! {|l| l.strip==”" } # Take out empty lines

domain_info_line=xentop_text[0]
memory_info_line=xentop_text[1]
domains_info=xentop_text[3…-1]

Getting information from xm info

memory_info=Hash.new
cpu_info=Hash.new

free_memory=nil
max_free_memory=nil

xm_text.each_line {|line|
columns=line.split(":").collect {|c| c.strip }

case columns[0]
when 'total_memory'
    memory_info:total]=columns[1].to_i*1024
when 'max_free_memory'
    max_free_memory=columns[1].to_i*1024
when 'free_memory'
    free_memory=columns[1].to_i*1024
when 'nr_cpus'
    cpu_info:total]=columns[1].to_f*100
when 'cpu_mhz'
    cpu_info:speed]=columns[1]
end

}

if max_free_memory
memory_info:free]=max_free_memory
else
memory_info:free]=free_memory
end

memory_info:used]=memory_info:total]-memory_info:free]

DOMAINS LINES

vm_info=Hash.new
vm_info:cpu]=0.0
vm_info:nettx]=0
vm_info:netrx]=0

domains_info.each {|line|
l=line.strip.split
vm_info:cpu]+=l[3].to_f
vm_info:nettx]+=l[10].to_i
vm_info:netrx]+=l[11].to_i
}

WRITE INFO

puts “HYPERVISOR=xen”
puts “TOTALCPU=” + cpu_info:total].round.to_s
puts “CPUSPEED=” + cpu_info:speed]
puts “TOTALMEMORY=” + memory_info:total].to_s
puts “FREEMEMORY=” + memory_info:free].to_s
puts “USEDMEMORY=” + memory_info:used].to_s
puts “USEDCPU=” + vm_info:cpu].round.to_s
puts “FREECPU=” + (cpu_info:total]-vm_info:cpu]).round.to_s
puts “NETTX=” + vm_info:nettx].to_s
puts “NETRX=” + vm_info:netrx].to_s
oneadmin@opennebula01:/tmp/one-im>

================
END
================******************************************************

Hi,
I have the same problem as you. And I tried to solve it, but I couldn’t.
Did you finish it? Can you help me?
I can’t find out your email or web profile. My email address is [removed for obvious reasons], can you send mail to me?

You should not publish your e-mail address in the open on the Internet, unless you want to be swamped by spam. In any case we do not want to be intstrumental in that.

You could PM other members of the forum, but as the meaning of these forums is that everybody can in the open find solutions for problems, please discuss them in the thread, else nobody can understand in a few monthes what is was all about.