Undefined method `each'

When creating a vm with a bridge network interface I get this error:

Sat Aug 31 14:32:52 2019 [Z0][VMM][D]: Message received: LOG I 13 sudo: no tty present and no askpass program specified

Sat Aug 31 14:32:52 2019 [Z0][VMM][D]: Message received:      LOG I 13 /var/tmp/one/vnm/vlan.rb:166:in `get_bridges': undefined method `each' for nil:NilClass (NoMethodError)

Sat Aug 31 14:32:52 2019 [Z0][VMM][D]: Message received: LOG I 13 from /var/tmp/one/vnm/vlan.rb:36:in `activate'

Sat Aug 31 14:32:52 2019 [Z0][VMM][D]: Message received: LOG I 13 from /var/tmp/one/vnm/bridge/pre:29:in `<main>'

Sat Aug 31 14:32:52 2019 [Z0][VMM][D]: Message received: LOG I 13 ExitCode: 1

Sat Aug 31 14:32:52 2019 [Z0][VMM][D]: Message received: LOG I 13 Failed to execute network driver operation: pre.

Sat Aug 31 14:32:52 2019 [Z0][VMM][D]: Message received: DEPLOY FAILURE 13  bridge: -

I also get the error when trying to attach the nic to an existing vm.

Hello @salad_dinner,

OpenNebula needs to be able to use sudo without a password in order to manage some resources like networks, you can find more info here: http://docs.opennebula.org/5.8/integration/references/compile.html?configure-sudo-for-oneadmin#configure-sudo-for-oneadmin

So can you try to provide oneadmin user sudo permission passwordless and try again?

Hi @cgonzalez,

You seem to be right. I initially had this sudoers file for the oneadmin user:

Defaults:oneadmin !requiretty
Defaults:oneadmin secure_path = /sbin:/bin:/usr/sbin:/usr/bin

Cmnd_Alias ONE_MISC = /sbin/mkfs, /bin/sync, /sbin/mkswap
Cmnd_Alias ONE_NET = /sbin/brctl, /sbin/ebtables, /sbin/iptables, /sbin/ip6tables, /sbin/ip, /sbin/ipset, /usr/bin/arping
Cmnd_Alias ONE_LVM = /sbin/lvcreate, /sbin/lvremove, /sbin/lvs, /sbin/vgdisplay, /sbin/lvchange, /sbin/lvscan, /sbin/lvextend
Cmnd_Alias ONE_ISCSI = /usr/bin/iscsiadm, /usr/sbin/tgt-admin, /usr/sbin/tgtadm
Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl
Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm
Cmnd_Alias ONE_CEPH = /usr/bin/rbd
Cmnd_Alias ONE_MARKET = /usr/lib/one/sh/create_container_image.sh
Cmnd_Alias ONE_HA = /bin/systemctl start opennebula-flow, /bin/systemctl stop opennebula-flow, /bin/systemctl start opennebula-gate, /bin/systemctl stop opennebula-gate, /usr/sbin/service opennebula-flow start, /usr/sbin/service opennebula-flow stop, /usr/sbin/service opennebula-gate start, /usr/sbin/service opennebula-gate stop

oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_CEPH, ONE_MARKET, ONE_HA

To test if this was the issue i changed it to
oneadmin ALL = (ALL) NOPASSWD:ALL
And the virt did deploy (aside from needing the bridge-utils package still). Can you tell if there is anything missing from my sudoers file that might be causing this?

@cgonzalez
Disregard my last post. It looks like all I needed was to install bridge-utils. For some reason I wasn’t getting a good error message about this until I changed the sudoers file.

So, is it working fine now? after changing the sudoers file and installing bridge-utils?

The sudoers file didn’t actually need to be changed. I tried on a different node that was still using the stock sudoers file and it worked after installing bridge-utils.