ubuntu preseed install fails to set a hostname

Bug #1452202 reported by bugproxy
30
This bug affects 4 people
Affects Status Importance Assigned to Milestone
debian-installer (Ubuntu)
Fix Released
Medium
Eric Desrochers
Trusty
Fix Released
Medium
Eric Desrochers
Xenial
Fix Released
Medium
Eric Desrochers
Bionic
Fix Released
Medium
Eric Desrochers
netcfg (Debian)
New
Unknown
preseed (Ubuntu)
Fix Released
Medium
Eric Desrochers
Trusty
Fix Released
Medium
Eric Desrochers
Xenial
Fix Released
Medium
Eric Desrochers
Bionic
Fix Released
Medium
Eric Desrochers

Bug Description

[Impact]

 * DHCP hostname take precedence over netcfg/hostname, if set.

The problem is that the system read the preseed file after having run netcfg, thus the preseed parameter cannot be loaded straight from the start.

[Test Case]

 * HOWTO reproduce :

Install Ubuntu using a preseed[1] file[2] and add the following line in the preseed recipe :
d-i netcfg/hostname string <HOSTNAME>

If the machine get a HOSTNAME from DHCP server or from a reverse lookup, netcfg/hostname doesn't take precedence.

[1] - url=http://<WEB_SERVER>/<PRESEED_FILE>
[2] - https://help.ubuntu.com/lts/installation-guide/example-preseed.txt

[Regression Potential]

 * none expected, the change is trivial and has been intensively jointly tested by myself and cyphermox.

[Other Info]

 * Debian bug : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755848
   Patch has been submitted to Debian
 * There is an old patch introduced in 2012 [Use netcfg/hostname for the hostname if found. (Closes: #606636)] but that doesn't work as expected.

[Original Description]

== Comment: #0 - Edward R. Cheslek <email address hidden> - 2015-04-28 18:04:01 ==
---Problem Description---
An install using a preseed file fails to configure the hostname of the system being installed.

Contact Information = <email address hidden>

---uname output---
Ubuntu 15.04 ppc64le

Machine Type = Tuleta pKVM guest

---Debugger---
A debugger is not configured

---Steps to Reproduce---
 set up an automated install using a preseed file. Grub menu entry:

menuentry "Test" {
        linux ubuntu-installer/ppc64el/vmlinux tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false auto=true preseed/url=http://10.33.11.31/data/autoinst/ted.preseed
        initrd ubuntu-installer/ppc64el/initrd.gz
}

The install will begin, and reach the hostname configuration screen, then stop, waiting for input. The hostname is set in the preseed file, which is attached.

Install method: http from ports.ubuntu.com

Install disk info: n/a

Install ISO Information: n/a

*Additional Instructions for <email address hidden>:
-Post a private note with access information to the machine that the bug is occuring on.

== Comment: #1 - SANDHYA VENUGOPALA <email address hidden> - 2015-04-29 06:08:18 ==
Some literature that is floating around -

when booting from an installation CD and using a preseed file on a network, the installer will need answers to some questions (hostname, network configuration, ...) before it can load the preseed file. On the other hand, including a customized preseed file in a setup CD will allow for more automation, but requires re-mastering of the CD.

The configuration of domain and host name, and keymap are still being asked, even if you have them in your preseed file as shown above. So if you want to kickstart the preseeded installation without a single questions asked, append the following more options to kernel boot prompt:

console-keymaps-at/keymap=us hostname=myhost domain=example.com locale=en_US

Perhaps David Heller can throw some light on this and let us know if its bug.

== Comment: #2 - Edward R. Cheslek <email address hidden> - 2015-04-29 07:57:29 ==
I'm booting and installing from the network. Even if I leave the hostname related options out of my preseed, it still picks up and displays the correct hostname from dhcp.

== Comment: #3 - David Heller <email address hidden> - 2015-05-05 14:12:52 ==
I'm not very familiar with this particular preseed option so I'm not sure how it's supposed to behave. However, in a quick test on Ubuntu 15.04, adding "netcfg/hostname=blah" to the kernel cmdline worked: it successfully overrode the hostname from DHCP (the way it is usually set in my environment) with no other changes required.

In the preseed however, I could not make it work, even if I commented out the related lines:

#d-i netcfg/get_hostname string unassigned-hostname
#d-i netcfg/get_domain string unassigned-domain
d-i netcfg/hostname string blah

And looking in the installer log, it could be a order of operations thing, since we see it picking up the hostname from DHCP before retrieving the preseed...

# cat /var/log/syslog | egrep "hostname|seed"
May 5 16:10:16 netcfg[2270]: INFO: DHCP hostname: "myhost"
May 5 16:10:16 netcfg[2270]: DEBUG: Preseeding domain from global: ibm.com
May 5 16:10:16 main-menu[301]: INFO: Menu item 'network-preseed' selected
May 5 16:10:18 preseed: successfully loaded preseed file from ftp://9.114.211.201/install/autoinst/myhost

That said: this doesn't tell exactly when the hostname was *set*, or if it should be overridden even if it is set at that point.

IMHO it should work the same way in the preseed as it does command-line, regardless of order, since that is what the user is requesting. If the installer already "set" the hostname from DHCP info, well, it should set it again with what the user wants.

But I don't know if this is supported or expected to work in all cases. Frankly, I'm not even sure if this is the correct way to do it in preseed (although it seems like it is).

But I think it's fair to mirror this to Ubuntu to ask.

== Comment: #5 - Edward R. Cheslek <email address hidden> - 2015-05-05 16:21:35 ==
I can set the hostname on the linux kernel line in grub, and it will show up correctly in the installer, but my issue is that the install still asks me to confirm that the hostname is correct. I want to proceed through my install totally unattended.

Revision history for this message
bugproxy (bugproxy) wrote : preseed file

Default Comment by Bridge

tags: added: architecture-ppc64le bugnameltc-124423 severity-high targetmilestone-inin1510
Revision history for this message
bugproxy (bugproxy) wrote : hardware summary of the affected system

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : syslog of the affected system

Default Comment by Bridge

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1452202/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
tags: added: vivid
affects: ubuntu → debian-installer (Ubuntu)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Confirming/Triaged: I can reproduce this here easily; preseeded hostname should indeed get used. As I recall this isn't a new issue.

Setting priority to medium since there is an "easy" workaround for it.

Changed in debian-installer (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Steve Langasek (vorlon)
Changed in debian-installer (Ubuntu):
assignee: nobody → Mathieu Trudel-Lapierre (mathieu-tl)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Looks to me like you're "just" missing adding 'priority=critical' on the command-line to avoid being asked for the hostname. This happens before while the hostname is preseeded, the network needs to be brought up before it can be read, and netcfg does both bringing up the network and setting the hostname. Setting the debconf priority to 'critical' avoids the initial questions about the keymap and hostname/network settings. In other words, this means for a fully-automated, unattended preseeded install, you wouldn't need to specify hostname or keymap/locale, as SANDHYA VENUGOPALA suggested.

There still appears to be a bug though, in the way that netcfg doesn't honor the preseeded settings and set the hostname in /target (or in the installer environment, for that matter).

I will leave to your choice whether you want to close this bug report now, or keep it open for the netcfg bug I described, which still matches the title and description.

Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2015-09-09 09:54 EDT-------
Making the comment external -

Edward R. Cheslek 2015-09-08 21:16:54 EDT

Mathieu, I guess you're the developer who will be fixing this netcfg issue? If that's that's the case, then it's at your discretion whether you'd prefer to close this as "will not fix", or drive the netcfg issue to resolution here. For me, I'd prefer to keep everything contained to this one bug, for clarity/completeness. If you do open a new bug, please cc myself and <email address hidden>.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Yes, I'd be the one fixing this issue -- I'm just responding to the fact that this was initially opened as "how can I make d-i not ask for the hostname, to get a fully unattended install". In this sense, the bug is "fixed", by bringing up debconf priority, the install will be unattended.

Now, I'd like to have an idea on how important teaching netcfg to apply hostname again later (either from what is received from DHCP or from preseeded settings), so we know whether this changes any priorities.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Reassigning to netcfg which is the correct package where to fix this.

affects: debian-installer (Ubuntu) → netcfg (Ubuntu)
Changed in netcfg (Ubuntu):
status: Triaged → In Progress
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2016-01-28 06:04 EDT-------
Canonical,

Any updates?

Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2016-03-15 05:48 EDT-------
Canonical,

Any updates?

Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2016-06-27 02:58 EDT-------
What would be the target release for this bug?

Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2016-07-08 02:29 EDT-------
.

Revision history for this message
Sandhya Venugopala (vsandhya) wrote :

Hi Mathieu Trudel-Lapierre,

Kindly let us know the updates and target release.

Changed in netcfg:
status: Unknown → New
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

This bug is still on my list, but there hasn't been progress for the moment. The workaround I can think of to set hostname during the install would be to preseed the value on the command-line (setting netcfg/hostname=whatever along with priority=critical, etc.).

Eric Desrochers (slashd)
Changed in netcfg (Ubuntu):
assignee: Mathieu Trudel-Lapierre (cyphermox) → Eric Desrochers (slashd)
Revision history for this message
Eric Desrochers (slashd) wrote :

Fix for Yakkety

description: updated
description: updated
Revision history for this message
Eric Desrochers (slashd) wrote :

Fix for Trusty

tags: added: sts
Eric Desrochers (slashd)
description: updated
Eric Desrochers (slashd)
description: updated
description: updated
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Fix for Yakkety" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Eric Desrochers (slashd)
Changed in netcfg (Ubuntu Trusty):
assignee: nobody → Eric Desrochers (slashd)
importance: Undecided → Medium
status: New → In Progress
Eric Desrochers (slashd)
description: updated
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2016-09-29 10:13 EDT-------
This bug is actually targeted 15.10, which is past end of life.
To submitter, is this reproducible on 16.04 or 16.10?
If so, please retarget or close.
Thanks!

Revision history for this message
bugproxy (bugproxy) wrote : syslog of the affected system

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : Fix for Yakkety

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : Fix for Trusty

Default Comment by Bridge

Mathew Hodson (mhodson)
Changed in netcfg (Ubuntu Xenial):
importance: Undecided → Medium
affects: netcfg → ubuntu-translations
Changed in ubuntu-translations:
importance: Unknown → Undecided
no longer affects: ubuntu-translations
Changed in netcfg (Debian):
status: Unknown → New
Revision history for this message
Eric Desrochers (slashd) wrote :

I have deleted the proposed .debdiff as I want to re-work them a little bit.

Will re-submit once my re-work is completed.

Eric

Revision history for this message
Eric Desrochers (slashd) wrote :

Additional note about the re-work.

The original patch I have submitted works as expected by overriding the hostname but ...

I noticed after more testing that if LVM is used partman rely on "/etc/hostname" to name the VG[1] for instance : <hostname>--vg-root.

Unfortunately, the current patch does the hostname overriden after that the Volume Group is created which make the vg name and hostname inconsistent.

The re-work of the patch will consist on making sure the hostname override happens before the vgcreate to keep things consistent and not having a vg group that display the hostname before it has been overriden.

[1] - lib/auto-lvm.sh
278 auto_lvm_perform() {
279 # Use hostname as default vg name (if available)
280 local defvgname pv vg_file vg_name
281 # $pv_devices will be overridden with content from $VG_MAP_DIR
282 local pv_devices
283
284 db_get partman-auto-lvm/new_vg_name
285 if [ -z "$RET" ]; then
286 if [ -s /etc/hostname ]; then
287 defvgname=$(cat /etc/hostname | head -n 1 | tr -d " ")
288 fi
289 if [ "$defvgname" ]; then
290 db_set partman-auto-lvm/new_vg_name $defvgname-vg
291 else
292 db_set partman-auto-lvm/new_vg_name Ubuntu
293 fi
294 fi

Revision history for this message
Eric Desrochers (slashd) wrote :

Moving the script in preseed src code under "network-preseed.postinst" address the vg name creation situation (see previous comment).

It basically make "netcfg/hostname",if set, to load (override the hostname) before the "Volume Group" creation start which build the vg name based on the hostname (/etc/hostname)

Thanks cyphermox for your help.

Eric

Revision history for this message
Eric Desrochers (slashd) wrote :

Debdiff for Yakkety

Revision history for this message
Eric Desrochers (slashd) wrote :

Debdiff for Trusty

Revision history for this message
bugproxy (bugproxy) wrote :

Default Comment by Bridge

Revision history for this message
Eric Desrochers (slashd) wrote :

Debdiff for Xenial

Changed in netcfg (Ubuntu Xenial):
assignee: nobody → Eric Desrochers (slashd)
status: New → In Progress
Eric Desrochers (slashd)
tags: added: sts-sponsor
removed: targetmilestone-inin1510 vivid
tags: added: sts-sru
description: updated
description: updated
bugproxy (bugproxy)
tags: added: targetmilestone-inin1510
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Since we changed stuff in preseed, fixing up the package links...

affects: netcfg (Ubuntu) → preseed (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package preseed - 1.71ubuntu3

---------------
preseed (1.71ubuntu3) yakkety; urgency=medium

  * Fix for netcfg/hostname, if set, to take precedence. (LP: #1452202)
    - Modify debian/network-preseed.postinst

 -- Eric Desrochers <email address hidden> Wed, 05 Oct 2016 11:50:09 -0400

Changed in preseed (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello bugproxy, or anyone else affected,

Accepted preseed into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/preseed/1.71ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in preseed (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Eric Desrochers (slashd) wrote :

I have tested "preseed - 1.71ubuntu1.1" by rebuilding the source code on a PPA along with d-i "20101020ubuntu451.6" in order to get a mini.iso.

I confirmed the mini.iso override the hostname as expected if "netcfg/hostname" is set and that the override occurred before the disk configuration for the vg name to match with the overridden hostname, if LVM is use.

Eric

tags: added: verification-done
removed: verification-needed
Revision history for this message
Eric Desrochers (slashd) wrote :

Next step, is to increase the version of d-i for Y/X/T for the change in preseed to be rebuild and be part of the new ISOs (Daily)

Eric

Changed in debian-installer (Ubuntu):
status: New → In Progress
Changed in debian-installer (Ubuntu Trusty):
status: New → In Progress
Changed in debian-installer (Ubuntu):
importance: Undecided → Medium
Changed in debian-installer (Ubuntu Xenial):
status: New → In Progress
Changed in debian-installer (Ubuntu Trusty):
importance: Undecided → Medium
Changed in debian-installer (Ubuntu Xenial):
importance: Undecided → Medium
Revision history for this message
Eric Desrochers (slashd) wrote :

d-i debdiff for Yakkety

Revision history for this message
Eric Desrochers (slashd) wrote :

d-i debdiff for Xenial

Revision history for this message
Eric Desrochers (slashd) wrote :

d-i debdiff for Trusty

Changed in debian-installer (Ubuntu):
assignee: nobody → Eric Desrochers (slashd)
Changed in debian-installer (Ubuntu Xenial):
assignee: nobody → Eric Desrochers (slashd)
Changed in debian-installer (Ubuntu Trusty):
assignee: nobody → Eric Desrochers (slashd)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Ok, looks like yakkety already has picked up the latest preseed in the current debian-installer package in the images; marking this one Fix Released.

Changed in debian-installer (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello bugproxy, or anyone else affected,

Accepted preseed into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/preseed/1.62ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in preseed (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: removed: verification-done
tags: added: verification-needed
Revision history for this message
Eric Desrochers (slashd) wrote :

I have tested on Trusty with "preseed - 1.62ubuntu1.1" by rebuilding the source code on a PPA along with d-i " 20101020ubuntu318.40" in order to get a mini.iso.

I confirmed the mini.iso override the hostname as expected if "netcfg/hostname" is set and that the override occurred before the disk configuration for the vg name to match with the overridden hostname, if LVM is use.

Eric

tags: added: verification-done
removed: verification-needed
Revision history for this message
Martin Pitt (pitti) wrote :

Hello bugproxy, or anyone else affected,

Accepted debian-installer into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/debian-installer/20101020ubuntu318.41 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in debian-installer (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: removed: verification-done
tags: added: verification-needed
Revision history for this message
Eric Desrochers (slashd) wrote :

The d-i debdiff contains no changes, it is only to allow the rebuild (Daily ISO) to happen and to pick up the latest change in preseed package.

Eric

tags: added: verification-done
removed: verification-needed
Louis Bouchard (louis)
tags: removed: sts-sponsor
Revision history for this message
bugproxy (bugproxy) wrote : syslog of the affected system

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : Fix for Yakkety

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : lp_1452202_yak.debdiff

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : lp_1452202_trusty.debdiff

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : lp_1452202_xenial.debdiff

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : d-i_yakkety.debdiff

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : d-i_xenial.debdiff

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : d-i_trusty.debdiff

Default Comment by Bridge

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package preseed - 1.62ubuntu1.1

---------------
preseed (1.62ubuntu1.1) trusty; urgency=medium

  * Fix for netcfg/hostname, if set, to take precedence. (LP: #1452202)
    - Modify debian/network-preseed.postinst

 -- Eric Desrochers <email address hidden> Wed, 05 Oct 2016 11:58:53 -0400

Changed in preseed (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for preseed has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package preseed - 1.71ubuntu1.1

---------------
preseed (1.71ubuntu1.1) xenial; urgency=medium

  * Fix for netcfg/hostname, if set, to take precedence. (LP: #1452202)
    - Modify debian/network-preseed.postinst

 -- Eric Desrochers <email address hidden> Wed, 05 Oct 2016 12:01:39 -0400

Changed in preseed (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package debian-installer - 20101020ubuntu318.41

---------------
debian-installer (20101020ubuntu318.41) trusty; urgency=medium

  * No change rebuild to pick up the latest change in preseed (LP: #1452202)

 -- Eric Desrochers <email address hidden> Mon, 17 Oct 2016 17:29:25 -0400

Changed in debian-installer (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello bugproxy, or anyone else affected,

Accepted debian-installer into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/debian-installer/20101020ubuntu451.7 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in debian-installer (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: removed: verification-done
tags: added: verification-needed
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

287 defvgname=

Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello bugproxy, or anyone else affected,

Accepted debian-installer into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/debian-installer/20101020ubuntu451.8 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
Adam Conrad (adconrad) wrote :

Hello bugproxy, or anyone else affected,

Accepted debian-installer into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/debian-installer/20101020ubuntu451.9 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2016-12-07 05:06 EDT-------
Hi Edward ,

Kindly update the bug once tested.

Revision history for this message
Adam Conrad (adconrad) wrote :

Still waiting on someone to test the xenial debian-installer upload and tell us that the bug is indeed fixed there.

Revision history for this message
Eric Desrochers (slashd) wrote :

The patch has been tested a while ago, but the tag never been changed.

I change the tag to verification-done.

Thanks Adam for pointing this out.

Eric

tags: added: verification-done
removed: verification-needed
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2017-01-12 11:42 EDT-------
This is fixed, thanks everyone.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package debian-installer - 20101020ubuntu451.9

---------------
debian-installer (20101020ubuntu451.9) xenial; urgency=medium

  * Bump FLOPPY_SIZE by 2MB on amd64 and i386 for linux-firmware growth.

debian-installer (20101020ubuntu451.8) xenial; urgency=medium

  * No change rebuild to pick up the latest change in preseed (LP: #1452202)

 -- Adam Conrad <email address hidden> Wed, 07 Dec 2016 01:10:51 -0700

Changed in debian-installer (Ubuntu Xenial):
status: Fix Committed → Fix Released
Louis Bouchard (louis)
tags: added: sts-sru-done
removed: sts-sru
Revision history for this message
Peter Wu (lekensteyn) wrote :

There are two problems with the patch:
1. netcfg/hostname=ubuntu (or any value containing "ubuntu") remains unfixed.
2. Certain DHCP hostnames can result in corrupting the hosts file.

For example, with DHCP name "node" and "netcfg/hostname=newname" we have this command:
/bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /etc/hosts
which would change "ff02::1 ip6-allnodes" into "ff02::1 ip6-allnewnames".

(I actually ran into the first issue, trying to set hostname "ubuntu" which failed and resulted in a hostname that consists of an IP address...)

Revision history for this message
Peter Wu (lekensteyn) wrote :

See also the comments in https://unix.stackexchange.com/questions/106614/preseed-cfg-ignoring-hostname-setting, and in particular the reference to
http://d-i.alioth.debian.org/manual/en.i386/apbs04.html#preseed-network
The hostname is probably a very common case though.

I am currently using this in my preseed file (tested with Ubuntu 16.04.2 mini.iso):

d-i preseed/early_command string hostname=ubuntu; \
    sed "s/^127.0.1.1\t.*/127.0.1.1\t$hostname/" -i /etc/hosts; \
    echo "$hostname" > /etc/hostname; hostname "$hostname"

Proposal: revert the current patch and suggest the above preseed config *or* modify preseed:
1. Change sed commands to something like the above.
2. Remove "f ! echo "$RET" | grep -q 'ubuntu';" such that the hostname is unconditionally set when netcfg/hostname is given.

Note that "127.0.1.1\t%s" originates from netcfg-1.135ubuntu4.2, function netcfg_write_common in netcfg-common.c. This exact match does not rely on the current hostname which should possible regex injection issues.

Revision history for this message
Hua Zhang (zhhuabj) wrote :

I think Peter Wu is totally right.

In addition to above two problems, there is still another problem with the patch that the present regular expression '/bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /etc/hosts' can't handle multiple hostname case:

$ echo '127.0.1.1 ubuntu.me.com ubuntu' |sed "s/ubuntu/newnode/"
127.0.1.1 newnode.me.com ubuntu

$ echo '127.0.1.1 ubuntu.me.com ubuntu' |sed "s/ubuntu/newnode/g"
127.0.1.1 newnode.me.com newnode

Revision history for this message
Hua Zhang (zhhuabj) wrote :

Maybe we can use the following regex instead, 'awk '$1 ~ /^127|localhost/ {print $0}'' is used to fix 'ff02::1 ip6-allnodes' case, and add 'g' option to modifity all hostname.

$ hostname=ubuntu
$ echo '127.0.1.1 ubuntu.me.com ubuntu' |awk '$1 ~ /^127|localhost/ {print $0}' |sed "s/\s*\(${hostname}\)\(\s*\)/\tnewnode/g"
127.0.1.1 newnode.me.com newnode

Addition, also need to remove "f ! echo "$RET" | grep -q 'ubuntu';" as Peter Wu said above

Revision history for this message
Hua Zhang (zhhuabj) wrote :

I mean:

/usr/bin/awk '$1 ~ /^127|localhost/ {print $0}' /etc/hosts | /bin/sed "s/\s*\(${CURRENT_HOSTNAME}\)\(\s*\)/\t${NETCFG_HOSTNAME}/g"

Revision history for this message
bugproxy (bugproxy) wrote : preseed file

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : hardware summary of the affected system

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : syslog of the affected system

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : Fix for Yakkety

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : Fix for Trusty

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : lp_1452202_yak.debdiff

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : lp_1452202_trusty.debdiff

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : lp_1452202_xenial.debdiff

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : d-i_yakkety.debdiff

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : d-i_xenial.debdiff

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : d-i_trusty.debdiff

Default Comment by Bridge

Revision history for this message
Hua Zhang (zhhuabj) wrote :

The following regex is more better

/bin/sed -i "/^[127|localhost]/s/${CURRENT_HOSTNAME}/${NETCFG_HOSTNAME}/g" /etc/hosts

Revision history for this message
Eric Desrochers (slashd) wrote :

Hi Hua Zhang,

Just as an FYI...

A rebuild of "d-i" will be also required after your "preseed" SRU change in order to generate a new Minimal image of Ubuntu (mini.iso).

Note that there is a "d-i" FTBTFS situation that will need to be fix for "d-i" before the "d-i" rebuilt for the package to successfully build. I have already reported the bug about it:
LP: #1743787

- Eric

Revision history for this message
Hua Zhang (zhhuabj) wrote :
Revision history for this message
Hua Zhang (zhhuabj) wrote :
Revision history for this message
Hua Zhang (zhhuabj) wrote :
Revision history for this message
Hua Zhang (zhhuabj) wrote :
Revision history for this message
Hua Zhang (zhhuabj) wrote :
Hua Zhang (zhhuabj)
tags: added: sts-sru-needed
removed: sts-sru-done verification-done
Revision history for this message
Hua Zhang (zhhuabj) wrote :

Remove the debdiff for "d-i" for Trusty only and Eric will take care of it in lp bug #1743787

Revision history for this message
Eric Desrochers (slashd) wrote :

Hi Joshua,

As discussed on irc, It would be best for Trusty to use the debdiff I made found in LP: #1743787.

Otherwise, when the "d-i" rebuild will be needed to generate a new mini.iso for instance, "d-i" will fail to build.

Everything is documented in the bug.

- Eric

Revision history for this message
bugproxy (bugproxy) wrote : d-i_trusty_v2.debdiff

Default Comment by Bridge

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

I don't think I'd want to have the patches provided applied as-is. There are multiple problems with them:

- The default hostname is 'ubuntu', and is the value you will get if nothing is preseeded -- we *do* need to skip it in this case, although the grep may need to be more precise. A name like 'ubuntuxenial' should match this grep.

- The sed needs to be fixed to more appropriately catch for the exact string, rather than any substring -- ie. it should not match 'ipv6-allnodes' if the name received from DHCP was 'node'. It should only match and replace for 'node'.

- You do not want to replace for all of 127 in /etc/hosts: you should not replace 127.0.0.1, but instead only "add" (replace, if necessary) 127.0.1.1; so maybe simply replace that entire line (to account for the case where multiple hostnames are set).

Revision history for this message
Eric Desrochers (slashd) wrote :

IIUC,one of the goal mentioned by cyphermox here seems to avoid the grep cmd to catch ubuntu pattern where hostname has ubuntu in it.

Example:
sometextbeforeubuntusometextafter
ubuntusometextafter
sometextbeforeubuntu

and only catch it when it is 'ubuntu' nothing else.

I think "-w" should suffice to keep the if statement remove in Joshua' proposal.

# man grep
-w, --word-regexp
              Select only those lines containing matches that form whole words.

if ! echo "$RET" | grep -qw 'ubuntu'; then
or
if ! echo "$RET" | grep -q '\<ubuntu\>'; then

Some quick tests I quickly ran on my laptop :
# echo "beforeubuntuafter" | grep -w "ubuntu"
# echo "beforeubuntuafter" | grep -w "ubuntu"
# echo "ubuntuafter" | grep -w "ubuntu"
# echo "ubuntu" | grep -w "ubuntu"
ubuntu

That should cover at least that one item.

Thoughts ?

- Eric

Revision history for this message
Hua Zhang (zhhuabj) wrote :

Hi Eric,

I think your proposal '-w' is good, so I will change to use:

if ! echo "$RET" | grep -qw 'ubuntu'; then

Mathieu,

How about using '/b' ? I mean using the following regex

/bin/sed -i "s/\b${CURRENT_HOSTNAME}\b/${NETCFG_HOSTNAME}/g" /etc/hosts

I have done some test below:

hua@t440p:~$ echo "node" | sed "s/\bnode\b/newnode/g"
newnode
hua@t440p:~$ echo "node." | sed "s/\bnode\b/newnode/g"
newnode.
hua@t440p:~$ echo "node.me.com" | sed "s/\bnode\b/newnode/g"
newnode.me.com
hua@t440p:~$ echo "ipv6-allnodes" | sed "s/\bnode\b/newnode/g"
ipv6-allnodes
hua@t440p:~$ echo "ipv6-allnodes node node.me.com node2 node2.me.com" | sed "s/\bnode\b/newnode/g"
ipv6-allnodes newnode newnode.me.com node2 node2.me.com

any thoughts ?

- joshua

Revision history for this message
Eric Desrochers (slashd) wrote :

Joshua,

That look good to me.

So I would suggest:

1) Keep the if statement and add the -w option to grep to be more robust
2) Modify the sed cmd with word boundaries (\b) to be more robust as well.

Can you build preseed & "d-i" in your PPA to generate a mini.iso and test the reproducer ?
If it fix the above situation, please redo the debdiff and we *cyphermox and I" will review it again.

Thanks

- Eric

Revision history for this message
Eric Desrochers (slashd) wrote :

Joshua,

Could you also report another bug against preseed for this particular case with this one as a reference ? With its own SRU justification tmpl, ....

It'll make sponsor and SRU team life easier to review.

- Eric

Revision history for this message
Hua Zhang (zhhuabj) wrote :

According to Eric's above comment, I've opened a new bug to track this at - https://bugs.launchpad.net/ubuntu/+source/preseed/+bug/1745531

tags: added: sts-sru-done
removed: sts-sru-needed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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