netboot: failed to parse DNS settings set by dhclient

Bug #1812466 reported by cuihao
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
dropbear (Ubuntu)
Fix Committed
Undecided
Unassigned
initramfs-tools (Ubuntu)
Fix Committed
Undecided
Unassigned

Bug Description

I am setting up diskless netboot for Ubuntu LiveCDs, with following kernel arguments:

```
boot=casper netboot=nfs nfsroot=192.168.89.10:/extracted/livecd toram
```

I have noticed the following strange error messages after dhcp (also see the attachment):

```
/init: /run/net-ens3.conf: line 8: 202.38.64.56: not found
/init: /run/net-ens3.conf: line 8: 202.38.64.56: not found
/init: /run/net-ens3.conf: line 8: 202.38.64.56: not found
no search or nameservers found in /run/net-ens3.conf /run/net-ens3.conf /run/net6-*.conf
/init: /run/net-ens3.conf: line 8: 202.38.64.56: not found
/init: /run/net-ens3.conf: line 8: 202.38.64.56: not found
```

I manually broke the init process, and found line 8 of /run/net-ens3.conf is:

```
IPV4DNS0=192.168.88.1 202.38.64.56 202.38.64.17
```

The problematic code is in the `netinfo_to_resolv_conf` function of `scripts/functions`. It sources `/run/net-ens3.conf` (which is obviously not in correct shell syntax due to the space inserted between multiple DNS servers) to get network settings:

```
. "$f" || { echo "WARN: failed '. \"$f\"'" 1>&2; return 1; }
```

The bug is introduced by commit a77729e9, which replaced IP-config with dhclient. While IP-config seems to write each DNS in `IPV4DNS0`, `IPV4DNS1`, etc., dhclient write all DNS in `IPV4DNS0`, which is not expected by `netinfo_to_resolv_conf`.

I can confirm 18.10 LiveCDs are affected.

Revision history for this message
cuihao (cuihao-leo) wrote :
description: updated
Revision history for this message
cuihao (cuihao-leo) wrote :

Another reasonable solution is to ask isc-dhcp packagers to change the dhclient hook script `/etc/initramfs-tools/lib/etc/dhcp/dhclient-enter-hooks.d/config`.

Currently it writes all DNS in IPV4DNS0:
```
echo "IPV4DNS0=$new_domain_name_servers" >> /run/net-$interface.conf
```

information type: Public → Public Security
information type: Public Security → Public
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in dropbear (Ubuntu):
status: New → Confirmed
Changed in initramfs-tools (Ubuntu):
status: New → Confirmed
Sandro (supersandro2000)
Changed in initramfs-tools (Ubuntu):
status: Confirmed → Fix Committed
Changed in dropbear (Ubuntu):
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.