packer-qemu-templates icon indicating copy to clipboard operation
packer-qemu-templates copied to clipboard

Debian 8 install and IPv6 issue leads to DNS fail

Open cerih opened this issue 8 years ago • 1 comments

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"]
 ]
  1. 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

  2. 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

cerih avatar Jan 13 '17 17:01 cerih

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

jakobadam avatar Jan 22 '17 13:01 jakobadam