ProcessExecutionError when running parted command. "sudo: no tty present..."

Asked by iz

Hi -

I ran into an issue when trying to boot an instance via the "nova boot" command. I followed the instructions here:
http://wiki.openstack.org/XenServerDevelopment

Below is the log of running the following command:
~$nova boot lucid --flavor 2 --image <some_id>

##### start log
2011-11-12 11:48:55,119 DEBUG nova.virt.xenapi.vm_utils [-] Writing partition table 63 1024062 to /dev/xvdb... from (pid=917) _write_partition /usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py:1028
2011-11-12 11:48:55,119 DEBUG nova.utils [-] Running cmd (subprocess): sudo parted --script /dev/xvdb mklabel msdos from (pid=917) execute /usr/lib/pymodules/python2.6/nova/utils.py:150
2011-11-12 11:48:55,279 DEBUG nova.utils [-] Result was 1 from (pid=917) execute /usr/lib/pymodules/python2.6/nova/utils.py:166
2011-11-12 11:48:55,279 DEBUG nova.virt.xenapi.vm_utils [-] Destroying VBD for VDI OpaqueRef:ec785c26-1de1-bde4-9801-61fbc051d977 ... from (pid=917) with_vdi_attached_here /usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py:946
2011-11-12 11:48:56,327 DEBUG nova.virt.xenapi.vm_utils [-] VBD.unplug successful first time. from (pid=917) vbd_unplug_with_retry /usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py:961
2011-11-12 11:48:56,376 DEBUG nova.virt.xenapi.vm_utils [-] Destroying VBD for VDI OpaqueRef:ec785c26-1de1-bde4-9801-61fbc051d977 done. from (pid=917) with_vdi_attached_here /usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py:949
2011-11-12 11:48:56,377 ERROR nova.compute.manager [K1Z20MMQXU-UJSI9-LVT user myproject] Instance '11' failed to spawn. Is virtualization enabled in the BIOS?
(nova.compute.manager): TRACE: Traceback (most recent call last):
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/compute/manager.py", line 234, in run_instance
(nova.compute.manager): TRACE: self.driver.spawn(instance_ref)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi_conn.py", line 188, in spawn
(nova.compute.manager): TRACE: self._vmops.spawn(instance)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi/vmops.py", line 117, in spawn
(nova.compute.manager): TRACE: vdi_uuid = self._create_disk(instance)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi/vmops.py", line 113, in _create_disk
(nova.compute.manager): TRACE: instance.image_id, user, project, disk_image_type)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py", line 386, in fetch_image
(nova.compute.manager): TRACE: access, image_type)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py", line 541, in _fetch_image_glance
(nova.compute.manager): TRACE: session, instance_id, image, access, image_type)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py", line 456, in _fetch_image_glance_disk
(nova.compute.manager): TRACE: lambda dev:
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py", line 944, in with_vdi_attached_here
(nova.compute.manager): TRACE: return f(dev)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py", line 458, in <lambda>
(nova.compute.manager): TRACE: virtual_size, image_file))
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py", line 1013, in _stream_disk
(nova.compute.manager): TRACE: _write_partition(virtual_size, dev)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py", line 1033, in _write_partition
(nova.compute.manager): TRACE: execute('sudo', 'parted', '--script', dest, 'mklabel', 'msdos')
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/virt/xenapi/vm_utils.py", line 1031, in execute
(nova.compute.manager): TRACE: return utils.execute(*cmd, **kwargs)
(nova.compute.manager): TRACE: File "/usr/lib/pymodules/python2.6/nova/utils.py", line 173, in execute
(nova.compute.manager): TRACE: cmd=' '.join(cmd))
(nova.compute.manager): TRACE: ProcessExecutionError: Unexpected error while running command.
(nova.compute.manager): TRACE: Command: sudo parted --script /dev/xvdb mklabel msdos
(nova.compute.manager): TRACE: Exit code: 1
(nova.compute.manager): TRACE: Stdout: ''
(nova.compute.manager): TRACE: Stderr: 'sudo: no tty present and no askpass program specified\n'
###### end log

I commented the "Defaults requiretty" line in the sudoers file and that didn't work. I also added the "Defaults visiblepw" line to no avail (per http://www.f15ijp.com/2009/11/30/sudo-no-tty-present-and-no-askpass-program-specified/)

Here's my setup:
- XCP 1.1, single node
- The VM on which I installed openstack is ubuntu lucid (10.04).

Via XenCenter, I'm able to see that running "nova boot" adds the virtual disk to local storage named "Glance image <id>", but of course, because of the error above, it's unable to spawn the vm.

Any help will be greatly appreciated, while I myself go out and try to find a solution to this in parallel.

-Ignacio

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
iz
Solved:
Last query:
Last reply:
Revision history for this message
Chris Behrens (cbehrens) said :
#1

It looks like you need to set up /etc/sudo.conf to allow your nova user to run 'parted' without asking for a password.

Revision history for this message
iz (iz-o) said :
#2

Thanks for the prompt response, Chris. I just went ahead and modified the sudoers file directly to allow this. I also found this forum post relevant:
http://forums.openstack.org/viewtopic.php?f=10&t=126

However, the first time around, I screwed something up and hosed the sudoers file, so I'd warn anyone else who tries the approach given in the link to be careful.