Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM centos/7/cloud: empty /etc/resolv.conf #783

Closed
lictw opened this issue Aug 29, 2023 · 1 comment
Closed

VM centos/7/cloud: empty /etc/resolv.conf #783

lictw opened this issue Aug 29, 2023 · 1 comment
Labels
Incomplete Waiting on more information from reporter

Comments

@lictw
Copy link

lictw commented Aug 29, 2023

Hello! Did I find right place to post bug with official centos/7/cloud image?

Host: ubuntu/22.04 5.15.0-79-generic
LXD: 5.17
Image: Centos 7 amd64 (20230828_07:08)

The problem. With default profile:

# lxc profile show default
config: {}
description: ""
devices:
  eth0:
    name: eth0
    network: lxdbr0
    type: nic

after lxc launch images:centos/7/cloud c1 --vm there is empty /etc/resolv.conf (so no DNS resolution), but internet:

[root@c1 ~]# cat /etc/resolv.conf 
# Generated by NetworkManager
[root@c1 ~]# ping google.com
ping: google.com: Name or service not known
[root@c1 ~]# ping -c 1 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=107 time=6.03 ms

--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 6.035/6.035/6.035/0.000 ms

I'm not sure I understand exactly what's going on, but:

  1. centos/7 image use eth0 as network interface
  2. .., but cloud-init (with default NoCloud datasource) configured for enp5s0 and it configures this device for NetworkManager (NM):
[root@c1 ~]# cat /var/lib/cloud/seed/nocloud-net/network-config 
version: 1
config:
  - type: physical
    name: enp5s0
    subnets:
      - type: dhcp
        control: auto
[root@c1 ~]# ls /etc/sysconfig/network-scripts/ifcfg-*    
/etc/sysconfig/network-scripts/ifcfg-enp5s0  /etc/sysconfig/network-scripts/ifcfg-eth0  /etc/sysconfig/network-scripts/ifcfg-lo
[root@c1 ~]# grep NM /etc/sysconfig/network-scripts/ifcfg-*
/etc/sysconfig/network-scripts/ifcfg-eth0:NM_CONTROLLED=no
  1. dhcp-client runs first and configure network on eth0
  2. after that runs NM, it can't manage eth0 (so can't break network), but hold (so empty) /etc/resolv.conf, and it can't handle configured enp5s0 (no such device)

So there is VM with network and without DNS. I created simple profile for temporary fix:

# lxc profile show network.centos-7 
config:
  cloud-init.network-config: |
    version: 1
    config:
    - type: physical
      name: eth0
      subnets:
      - type: dhcp
        control: auto
# lxc launch images:centos/7/cloud c2 -p default -p network.centos-7 --vm
[root@c2 ~]# cat /etc/resolv.conf 
# Generated by NetworkManager
search lxd
nameserver 10.200.30.1
[root@c2 ~]# ping -c 1 ya.ru
PING ya.ru (5.255.255.242) 56(84) bytes of data.
64 bytes from ya.ru (5.255.255.242): icmp_seq=1 ttl=246 time=14.8 ms

--- ya.ru ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 14.866/14.866/14.866/0.000 ms
[root@c2 ~]# ls /etc/sysconfig/network-scripts/ifcfg-* 
/etc/sysconfig/network-scripts/ifcfg-eth0  /etc/sysconfig/network-scripts/ifcfg-lo
@stgraber
Copy link
Member

Is this still happening? We have automated daily tests of our images and they've not flagged this image as having an issue.

@stgraber stgraber added the Incomplete Waiting on more information from reporter label Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Incomplete Waiting on more information from reporter
Development

No branches or pull requests

2 participants