jakobadam / packer-qemu-templates

Packer qemu templates
Mozilla Public License 2.0
332 stars 175 forks source link

Debian 8 install and IPv6 issue leads to DNS fail #23

Open cerih opened 7 years ago

cerih commented 7 years ago

Not really an issue specific to this repository, but I have not personally experienced this other than when installing Debian using Packer with qemu and its use of this particular type of network device.

I will write up the changes after an opportunity for other perspectives.

Whether you experience this will depend on your own qemu user networking support for ipv6.

Debian 8 network installation can acquire a site-local address from qemu, and if so, it then installs rdnssd which overwrites /etc/resolv.conf with a useless IPv6 DNS address (by default fec0::3) In /var/log/installer/syslog you will find.. Jan 13 13:09:47 apt-install: Queueing package rdnssd for later installation This will overwrite /etc/resolv.conf on reboot and cause failure of shell update/package scripts. Solutions:

  1. Override user network definition in json to force ipv4 only (see added -netdev option). rdnssd does not get installed as result.

    "qemuargs": [
    [ "-netdev", "user,hostfwd=tcp::{{ .SSHHostPort }}-:22,id=user.0,ipv4"],
    [ "-device", "virtio-net,netdev=user.0"]
    ]
  2. Install resolvconf package which is recommended when rdnssd is installed normally (but not when inserted by the installer in this case) which will allow many programs to "manage" /etc/resolv.conf. In preseed.cfg edit pkgsel to add it. d-i pkgsel/include string openssh-server resolvconf

  3. Disable/remove rdnssd if it was installed when resolvconf was not, e.g. in preseed.cfg

    d-i preseed/late_command string \
    if [ -x "/target/sbin/rdnssd" -a ! -x "/target/sbin/resolvconf" ] ; then \
    in-target systemctl disable rdnssd.service ; \
    fi

    See also this Debian bug

jakobadam commented 7 years ago

I'm not using the debian. So I guess you're in a better position to pick a solution.