I’m having a confusing problem where the Ubuntu Bionic 18.04 LXD container boots but the only device in /sys/class/net is ‘lo’. I have eno1 defined in the virtual network that’s associated with the template but there aren’t any errors when contextualization runs, and the /var/run/one-context/context.sh.network script doesn’t have anything in there about a NIC.
I notice in the container template, under the Network section, there’s no option to choose virtio as the emulated hardware. I tried cutting and pasting
NIC_DEFAULT = [
MODEL = "virtio" ]
In the template before deploying but it doesn’t do anything. Come to think of it, the installation doc doesn’t say anything about restarting libvirtd on the LXD node…maybe I’m mislead here.
Another strange thing is if I specify eth0 as the NIC, the deployment fails with an error like ‘no such device as eth0’. Am I doing something totally wrong to get this container started? VMs deploy fine and let me specify a virtio NIC emulated hardware.
dclavijo
(Daniel Clavijo)
October 19, 2020, 3:11pm
2
Can you post the full VM Template onevm show -x <vm_id>
?
Also check in the container configuration lxc config show <one-vm_id>
the network config and look for the NIC.
Thanks. Here’s the VM after deploying it, and the lxc config.
<VM>
<ID>174</ID>
<UID>7</UID>
<GID>0</GID>
<UNAME>christay</UNAME>
<GNAME>oneadmin</GNAME>
<NAME>ub1c</NAME>
<PERMISSIONS>
<OWNER_U>1</OWNER_U>
<OWNER_M>1</OWNER_M>
<OWNER_A>0</OWNER_A>
<GROUP_U>0</GROUP_U>
<GROUP_M>0</GROUP_M>
<GROUP_A>0</GROUP_A>
<OTHER_U>0</OTHER_U>
<OTHER_M>0</OTHER_M>
<OTHER_A>0</OTHER_A>
</PERMISSIONS>
<LAST_POLL>1603151791</LAST_POLL>
<STATE>3</STATE>
<LCM_STATE>3</LCM_STATE>
<PREV_STATE>3</PREV_STATE>
<PREV_LCM_STATE>3</PREV_LCM_STATE>
<RESCHED>0</RESCHED>
<STIME>1603151750</STIME>
<ETIME>0</ETIME>
<DEPLOY_ID>one-174</DEPLOY_ID>
<MONITORING>
<CPU><![CDATA[0.0]]></CPU>
<MEMORY><![CDATA[0]]></MEMORY>
<NETRX><![CDATA[0]]></NETRX>
<NETTX><![CDATA[0]]></NETTX>
<STATE><![CDATA[a]]></STATE>
</MONITORING>
<TEMPLATE>
<AUTOMATIC_DS_REQUIREMENTS><![CDATA[("CLUSTERS/ID" @> 0)]]></AUTOMATIC_DS_REQUIREMENTS>
<AUTOMATIC_NIC_REQUIREMENTS><![CDATA[("CLUSTERS/ID" @> 0)]]></AUTOMATIC_NIC_REQUIREMENTS>
<AUTOMATIC_REQUIREMENTS><![CDATA[(CLUSTER_ID = 0) & !(PUBLIC_CLOUD = YES) & !(PIN_POLICY = PINNED)]]></AUTOMATIC_REQUIREMENTS>
<CONTEXT>
<DISK_ID><![CDATA[1]]></DISK_ID>
<NETWORK><![CDATA[YES]]></NETWORK>
<SET_HOSTNAME><![CDATA[ub1c]]></SET_HOSTNAME>
<SSH_PUBLIC_KEY><![CDATA[]]></SSH_PUBLIC_KEY>
<TARGET><![CDATA[hda]]></TARGET>
</CONTEXT>
<CPU><![CDATA[1]]></CPU>
<DISK>
<ALLOW_ORPHANS><![CDATA[NO]]></ALLOW_ORPHANS>
<CLONE><![CDATA[YES]]></CLONE>
<CLONE_TARGET><![CDATA[SYSTEM]]></CLONE_TARGET>
<CLUSTER_ID><![CDATA[0]]></CLUSTER_ID>
<DATASTORE><![CDATA[imagesLXD]]></DATASTORE>
<DATASTORE_ID><![CDATA[108]]></DATASTORE_ID>
<DEV_PREFIX><![CDATA[sd]]></DEV_PREFIX>
<DISK_ID><![CDATA[0]]></DISK_ID>
<DISK_SNAPSHOT_TOTAL_SIZE><![CDATA[0]]></DISK_SNAPSHOT_TOTAL_SIZE>
<DISK_TYPE><![CDATA[FILE]]></DISK_TYPE>
<DRIVER><![CDATA[raw]]></DRIVER>
<IMAGE><![CDATA[ubuntu_bionic - LXD]]></IMAGE>
<IMAGE_ID><![CDATA[36]]></IMAGE_ID>
<IMAGE_STATE><![CDATA[2]]></IMAGE_STATE>
<LN_TARGET><![CDATA[NONE]]></LN_TARGET>
<ORIGINAL_SIZE><![CDATA[1024]]></ORIGINAL_SIZE>
<READONLY><![CDATA[NO]]></READONLY>
<SAVE><![CDATA[NO]]></SAVE>
<SIZE><![CDATA[1024]]></SIZE>
<SOURCE><![CDATA[/var/lib/one//datastores/108/40cdd79fd7f0bc3f9cf2b44aee98fd16]]></SOURCE>
<TARGET><![CDATA[sda]]></TARGET>
<TM_MAD><![CDATA[shared]]></TM_MAD>
<TYPE><![CDATA[FILE]]></TYPE>
</DISK>
<GRAPHICS>
<LISTEN><![CDATA[0.0.0.0]]></LISTEN>
<PORT><![CDATA[6074]]></PORT>
<TYPE><![CDATA[vnc]]></TYPE>
</GRAPHICS>
<MEMORY><![CDATA[768]]></MEMORY>
<TEMPLATE_ID><![CDATA[28]]></TEMPLATE_ID>
<TM_MAD_SYSTEM><![CDATA[shared]]></TM_MAD_SYSTEM>
<VMID><![CDATA[174]]></VMID>
</TEMPLATE>
<USER_TEMPLATE>
<HYPERVISOR><![CDATA[lxd]]></HYPERVISOR>
<LXD_SECURITY_PRIVILEGED><![CDATA[yes]]></LXD_SECURITY_PRIVILEGED>
</USER_TEMPLATE>
<HISTORY_RECORDS>
<HISTORY>
<OID>174</OID>
<SEQ>0</SEQ>
<HOSTNAME>hpc-onet6</HOSTNAME>
<HID>11</HID>
<CID>0</CID>
<STIME>1603151762</STIME>
<ETIME>0</ETIME>
<VM_MAD><![CDATA[lxd]]></VM_MAD>
<TM_MAD><![CDATA[shared]]></TM_MAD>
<DS_ID>106</DS_ID>
<PSTIME>1603151762</PSTIME>
<PETIME>1603151782</PETIME>
<RSTIME>1603151782</RSTIME>
<RETIME>0</RETIME>
<ESTIME>0</ESTIME>
<EETIME>0</EETIME>
<ACTION>0</ACTION>
<UID>-1</UID>
<GID>-1</GID>
<REQUEST_ID>-1</REQUEST_ID>
</HISTORY>
</HISTORY_RECORDS>
</VM>
$ lxc config show one-174
architecture: x86_64
config:
limits.cpu.allowance: 100%
limits.memory: 768MB
security.nesting: "false"
security.privileged: "yes"
user.xml: |
<VM><ID>174</ID><UID>7</UID><GID>0</GID><UNAME>christay</UNAME><GNAME>oneadmin</GNAME><NAME>ub1c</NAME><PERMISSIONS><OWNER_U>1</OWNER_U><OWNER_M>1</OWNER_M><OWNER_A>0</OWNER_A><GROUP_U>0</GROUP_U><GROUP_M>0</GROUP_M><GROUP_A>0</GROUP_A><OTHER_U>0</OTHER_U><OTHER_M>0</OTHER_M><OTHER_A>0</OTHER_A></PERMISSIONS><LAST_POLL>0</LAST_POLL><STATE>3</STATE><LCM_STATE>2</LCM_STATE><PREV_STATE>3</PREV_STATE><PREV_LCM_STATE>2</PREV_LCM_STATE><RESCHED>0</RESCHED><STIME>1603151750</STIME><ETIME>0</ETIME><DEPLOY_ID></DEPLOY_ID><MONITORING></MONITORING><TEMPLATE><AUTOMATIC_DS_REQUIREMENTS><![CDATA[("CLUSTERS/ID" @> 0)]]></AUTOMATIC_DS_REQUIREMENTS><AUTOMATIC_NIC_REQUIREMENTS><![CDATA[("CLUSTERS/ID" @> 0)]]></AUTOMATIC_NIC_REQUIREMENTS><AUTOMATIC_REQUIREMENTS><![CDATA[(CLUSTER_ID = 0) & !(PUBLIC_CLOUD = YES) & !(PIN_POLICY = PINNED)]]></AUTOMATIC_REQUIREMENTS><CONTEXT><DISK_ID><![CDATA[1]]></DISK_ID><NETWORK><![CDATA[YES]]></NETWORK><SET_HOSTNAME><![CDATA[ub1c]]></SET_HOSTNAME><SSH_PUBLIC_KEY><![CDATA[]]></SSH_PUBLIC_KEY><TARGET><![CDATA[hda]]></TARGET></CONTEXT><CPU><![CDATA[1]]></CPU><DISK><ALLOW_ORPHANS><![CDATA[NO]]></ALLOW_ORPHANS><CLONE><![CDATA[YES]]></CLONE><CLONE_TARGET><![CDATA[SYSTEM]]></CLONE_TARGET><CLUSTER_ID><![CDATA[0]]></CLUSTER_ID><DATASTORE><![CDATA[imagesLXD]]></DATASTORE><DATASTORE_ID><![CDATA[108]]></DATASTORE_ID><DEV_PREFIX><![CDATA[sd]]></DEV_PREFIX><DISK_ID><![CDATA[0]]></DISK_ID><DISK_SNAPSHOT_TOTAL_SIZE><![CDATA[0]]></DISK_SNAPSHOT_TOTAL_SIZE><DISK_TYPE><![CDATA[FILE]]></DISK_TYPE><DRIVER><![CDATA[raw]]></DRIVER><IMAGE><![CDATA[ubuntu_bionic - LXD]]></IMAGE><IMAGE_ID><![CDATA[36]]></IMAGE_ID><IMAGE_STATE><![CDATA[2]]></IMAGE_STATE><LN_TARGET><![CDATA[NONE]]></LN_TARGET><ORIGINAL_SIZE><![CDATA[1024]]></ORIGINAL_SIZE><READONLY><![CDATA[NO]]></READONLY><SAVE><![CDATA[NO]]></SAVE><SIZE><![CDATA[1024]]></SIZE><SOURCE><![CDATA[/var/lib/one//datastores/108/40cdd79fd7f0bc3f9cf2b44aee98fd16]]></SOURCE><TARGET><![CDATA[sda]]></TARGET><TM_MAD><![CDATA[shared]]></TM_MAD><TYPE><![CDATA[FILE]]></TYPE></DISK><GRAPHICS><LISTEN><![CDATA[0.0.0.0]]></LISTEN><PORT><![CDATA[6074]]></PORT><TYPE><![CDATA[vnc]]></TYPE></GRAPHICS><MEMORY><![CDATA[768]]></MEMORY><TEMPLATE_ID><![CDATA[28]]></TEMPLATE_ID><TM_MAD_SYSTEM><![CDATA[shared]]></TM_MAD_SYSTEM><VMID><![CDATA[174]]></VMID></TEMPLATE><USER_TEMPLATE><HYPERVISOR><![CDATA[lxd]]></HYPERVISOR><LXD_SECURITY_PRIVILEGED><![CDATA[yes]]></LXD_SECURITY_PRIVILEGED></USER_TEMPLATE><HISTORY_RECORDS><HISTORY><OID>174</OID><SEQ>0</SEQ><HOSTNAME>hpc-onet6</HOSTNAME><HID>11</HID><CID>0</CID><STIME>1603151762</STIME><ETIME>0</ETIME><VM_MAD><![CDATA[lxd]]></VM_MAD><TM_MAD><![CDATA[shared]]></TM_MAD><DS_ID>106</DS_ID><PSTIME>1603151762</PSTIME><PETIME>1603151782</PETIME><RSTIME>1603151782</RSTIME><RETIME>0</RETIME><ESTIME>0</ESTIME><EETIME>0</EETIME><ACTION>0</ACTION><UID>-1</UID><GID>-1</GID><REQUEST_ID>-1</REQUEST_ID></HISTORY></HISTORY_RECORDS></VM>
volatile.idmap.base: "0"
volatile.idmap.next: '[]'
volatile.last_state.idmap: '[]'
volatile.last_state.power: RUNNING
devices:
context:
path: /context
source: /var/lib/one/datastores/106/174/mapper/disk.1
type: disk
root:
path: /
pool: default
readonly: "false"
type: disk
ephemeral: false
profiles:
- default
stateful: false
description: ""
dclavijo
(Daniel Clavijo)
October 20, 2020, 3:33pm
4
devices:
context:
path: /context
source: /var/lib/one/datastores/106/174/mapper/disk.1
type: disk
root:
path: /
pool: default
readonly: "false"
type: disk
The container definition template doesn’t have any network device. This stems from the fact that the VM Template doesn’t have a network definition at all
<TEMPLATE>
<AUTOMATIC_DS_REQUIREMENTS><![CDATA[("CLUSTERS/ID" @> 0)]]></AUTOMATIC_DS_REQUIREMENTS>
<AUTOMATIC_NIC_REQUIREMENTS><![CDATA[("CLUSTERS/ID" @> 0)]]></AUTOMATIC_NIC_REQUIREMENTS>
<AUTOMATIC_REQUIREMENTS><![CDATA[(CLUSTER_ID = 0) & !(PUBLIC_CLOUD = YES) & !(PIN_POLICY = PINNED)]]></AUTOMATIC_REQUIREMENTS>
<CONTEXT>
<DISK_ID><![CDATA[1]]></DISK_ID>
<NETWORK><![CDATA[YES]]></NETWORK>
<SET_HOSTNAME><![CDATA[ub1c]]></SET_HOSTNAME>
<SSH_PUBLIC_KEY><![CDATA[]]></SSH_PUBLIC_KEY>
<TARGET><![CDATA[hda]]></TARGET>
</CONTEXT>
<CPU><![CDATA[1]]></CPU>
<DISK>
<ALLOW_ORPHANS><![CDATA[NO]]></ALLOW_ORPHANS>
<CLONE><![CDATA[YES]]></CLONE>
<CLONE_TARGET><![CDATA[SYSTEM]]></CLONE_TARGET>
<CLUSTER_ID><![CDATA[0]]></CLUSTER_ID>
<DATASTORE><![CDATA[imagesLXD]]></DATASTORE>
<DATASTORE_ID><![CDATA[108]]></DATASTORE_ID>
<DEV_PREFIX><![CDATA[sd]]></DEV_PREFIX>
<DISK_ID><![CDATA[0]]></DISK_ID>
<DISK_SNAPSHOT_TOTAL_SIZE><![CDATA[0]]></DISK_SNAPSHOT_TOTAL_SIZE>
<DISK_TYPE><![CDATA[FILE]]></DISK_TYPE>
<DRIVER><![CDATA[raw]]></DRIVER>
<IMAGE><![CDATA[ubuntu_bionic - LXD]]></IMAGE>
<IMAGE_ID><![CDATA[36]]></IMAGE_ID>
<IMAGE_STATE><![CDATA[2]]></IMAGE_STATE>
<LN_TARGET><![CDATA[NONE]]></LN_TARGET>
<ORIGINAL_SIZE><![CDATA[1024]]></ORIGINAL_SIZE>
<READONLY><![CDATA[NO]]></READONLY>
<SAVE><![CDATA[NO]]></SAVE>
<SIZE><![CDATA[1024]]></SIZE>
<SOURCE><![CDATA[/var/lib/one//datastores/108/40cdd79fd7f0bc3f9cf2b44aee98fd16]]></SOURCE>
<TARGET><![CDATA[sda]]></TARGET>
<TM_MAD><![CDATA[shared]]></TM_MAD>
<TYPE><![CDATA[FILE]]></TYPE>
</DISK>
<GRAPHICS>
<LISTEN><![CDATA[0.0.0.0]]></LISTEN>
<PORT><![CDATA[6074]]></PORT>
<TYPE><![CDATA[vnc]]></TYPE>
</GRAPHICS>
<MEMORY><![CDATA[768]]></MEMORY>
<TEMPLATE_ID><![CDATA[28]]></TEMPLATE_ID>
<TM_MAD_SYSTEM><![CDATA[shared]]></TM_MAD_SYSTEM>
<VMID><![CDATA[174]]></VMID>
</TEMPLATE>
The VM XML should have a section like this one
NIC = [
AR_ID = "0",
BRIDGE = "br0",
BRIDGE_TYPE = "linux",
CLUSTER_ID = "0",
IP = "192.168.150.100",
MAC = "02:00:c0:a8:96:64",
NAME = "NIC0",
NETWORK = "public",
NETWORK_ID = "6",
NETWORK_UNAME = "oneadmin",
NIC_ID = "0",
SECURITY_GROUPS = "0",
TARGET = "one-18-0",
VN_MAD = "dummy" ]
with a defined network interface.
Another thing to keep in mind is that network device model emulation doesn’t apply to LXD.
Strange, it’s working fine now. I tried a few times to define a virtual network to use in the GUI but it didn’t add the NIC = [...]
block to the template. Maybe something I did wrong. Thanks for all your help!
1 Like