[SRU] Reinforce hostname preseed regex

Bug #1745531 reported by Hua Zhang
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
debian-installer (Ubuntu)
Fix Released
Medium
Hua Zhang
Trusty
Fix Released
Medium
Eric Desrochers
Xenial
Fix Released
Medium
Hua Zhang
Artful
Fix Released
Medium
Hua Zhang
Bionic
Fix Released
Medium
Hua Zhang
preseed (Ubuntu)
Fix Released
Medium
Hua Zhang
Trusty
Fix Released
Medium
Hua Zhang
Xenial
Fix Released
Medium
Hua Zhang
Artful
Fix Released
Medium
Hua Zhang
Bionic
Fix Released
Medium
Hua Zhang

Bug Description

[Special notes]

Rebuilding debian-installer will be necessary in order to get a new mini.iso (Minimal ISO image of Ubuntu) containing this particular fix.

Despite the fact that a full ISO are no longer built for some of the affected stable releases, one can use what is called a minimal ISO image (mini.iso) of Ubuntu. This mini.iso uses a text-based installer, resulting in a smaller image. The minimal ISO image will download packages from online archives at installation time instead of providing them on the install media itself.

[Impact]

This is the same issue reported in https://bugs.launchpad.net/ubuntu/+source/preseed/+bug/1452202
However that is marked as 'Fix Released' and the issue is still occurring so it seems best to just open a new bug according to Eric's comment.

The present hostname preseed regex looks like:

if ! echo "$RET" | grep -q 'ubuntu'; then
   ...
   /bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /etc/hosts
   ...
fi

There are still multiple problems with them according to Peter's comment (https://bugs.launchpad.net/ubuntu/+source/preseed/+bug/1452202/comments/64) and Mathieu's comment (https://bugs.launchpad.net/ubuntu/+source/preseed/+bug/1452202/comments/93).

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

So the fix will try to:

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.

[Test Case]

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

Change the HOSTNAME to see if the hostname in /etc/hosts can be updated correctly.

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

[Regression Potential]

 * none expected, the actual changes are as follows:

- if ! echo "$RET" | grep -q 'ubuntu'; then
+ if ! echo "$RET" | grep -qw 'ubuntu'; then
...
- /bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /etc/hosts
+ /bin/sed -i "s/\b${CURRENT_HOSTNAME}\b/${NETCFG_HOSTNAME}/g" /etc/hosts

In other words, we simply make it more robust to select only pattern containing matches that form whole word... catching 'ubuntu' hostname as-is but not catching pattern where ubuntu is part of the user chosen hostname as follow :

"sometextubuntu"
"sometextubuntusometext"
"ubuntusometext"
...

[Original Description]

Hua Zhang (zhhuabj)
tags: added: sts
Eric Desrochers (slashd)
Changed in preseed (Ubuntu Trusty):
assignee: nobody → Hua Zhang (zhhuabj)
Changed in preseed (Ubuntu Xenial):
assignee: nobody → Hua Zhang (zhhuabj)
Changed in preseed (Ubuntu Bionic):
assignee: nobody → Hua Zhang (zhhuabj)
status: New → Confirmed
Changed in preseed (Ubuntu Xenial):
status: New → Confirmed
Changed in preseed (Ubuntu Trusty):
status: New → Confirmed
importance: Undecided → Medium
Changed in preseed (Ubuntu Xenial):
importance: Undecided → Medium
Changed in preseed (Ubuntu Bionic):
importance: Undecided → Medium
Eric Desrochers (slashd)
Changed in debian-installer (Ubuntu Bionic):
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)
Changed in preseed (Ubuntu Trusty):
status: Confirmed → In Progress
Changed in preseed (Ubuntu Xenial):
status: Confirmed → In Progress
Changed in preseed (Ubuntu Bionic):
status: Confirmed → In Progress
Changed in preseed (Ubuntu Artful):
assignee: nobody → Hua Zhang (zhhuabj)
importance: Undecided → Medium
status: New → In Progress
Changed in debian-installer (Ubuntu Artful):
assignee: nobody → Eric Desrochers (slashd)
Changed in debian-installer (Ubuntu Bionic):
status: New → In Progress
Revision history for this message
Eric Desrochers (slashd) wrote :

I'll take care of the "d-i" bit to force a rebuild of the mini.iso once Joshua's preseed patch is uploaded in affected releases.

Note: "d-i" for Trusty will need extra care as it faces a FTBFS situation.
For more details, see LP: #1743787.

- Eric

tags: added: sts-sponsor-slashd
Revision history for this message
Eric Desrochers (slashd) wrote :

"d-i" debdiff for Trusty [lp1745531-lp1743787-di-trusty.debdiff]

tags: added: patch
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 :
summary: - Reinforce hostname preseed regex
+ [SRU] Reinforce hostname preseed regex
Revision history for this message
Hua Zhang (zhhuabj) wrote :
description: updated
Revision history for this message
Hua Zhang (zhhuabj) wrote :
Eric Desrochers (slashd)
Changed in debian-installer (Ubuntu Bionic):
importance: Undecided → Medium
Changed in debian-installer (Ubuntu Artful):
importance: Undecided → Medium
Changed in debian-installer (Ubuntu Xenial):
importance: Undecided → Medium
Changed in debian-installer (Ubuntu Trusty):
importance: Undecided → Medium
Changed in debian-installer (Ubuntu Artful):
status: New → In Progress
Changed in debian-installer (Ubuntu Xenial):
status: New → In Progress
Changed in debian-installer (Ubuntu Trusty):
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package preseed - 1.71ubuntu7

---------------
preseed (1.71ubuntu7) bionic; urgency=medium

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

 -- Hua Zhang <email address hidden> Thu, 25 Jan 2018 15:12:38 +0800

Changed in preseed (Ubuntu Bionic):
status: In Progress → Fix Released
Eric Desrochers (slashd)
Changed in debian-installer (Ubuntu Bionic):
assignee: Eric Desrochers (slashd) → Hua Zhang (zhhuabj)
Changed in debian-installer (Ubuntu Artful):
assignee: Eric Desrochers (slashd) → Hua Zhang (zhhuabj)
Eric Desrochers (slashd)
Changed in debian-installer (Ubuntu Xenial):
assignee: Eric Desrochers (slashd) → Hua Zhang (zhhuabj)
Eric Desrochers (slashd)
description: updated
Eric Desrochers (slashd)
description: updated
Revision history for this message
Eric Desrochers (slashd) wrote :

I have uploaded preseed for T/X/A. It is now waiting on the SRU verification team approval for the new packages to start building in $RELEASE-proposed.

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

I have also uploaded d-i for T/X/A which will be needed after the preseed build for the mini.iso for instance. It is now waiting on the SRU verification team approval for the new packages to start building in $RELEASE-proposed.

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Hua, or anyone else affected,

Accepted preseed into artful-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/preseed/1.71ubuntu5.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 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-artful to verification-done-artful. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-artful. In either case, without details of your testing we will not be able to proceed.

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

Changed in preseed (Ubuntu Artful):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-artful
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Hua, or anyone else affected,

Accepted debian-installer into artful-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/debian-installer/20101020ubuntu523.2 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-artful to verification-done-artful. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-artful. In either case, without details of your testing we will not be able to proceed.

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 Artful):
status: In Progress → Fix Committed
Revision history for this message
Brian Murray (brian-murray) wrote :

Presumably this works in bionic but I don't see any information (its not required for the SRU process) indicating that it is fixed. However, I'd like to see Artful verified before accepting it into other releases.

Revision history for this message
Hua Zhang (zhhuabj) wrote :
tags: added: verification-done-artful
removed: verification-needed-artful
Revision history for this message
Cristian Henzel (cristian-henzel) wrote :

Hello,

I have also tested the 523.2 netboot ISO and can confirm that it works for me.

Cristian

Revision history for this message
Chris J Arges (arges) wrote :

Hello Hua, 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.2 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-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

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-xenial
Changed in preseed (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed-trusty
Revision history for this message
Chris J Arges (arges) wrote :

Hello Hua, 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.2 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-trusty to verification-done-trusty. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-trusty. In either case, without details of your testing we will not be able to proceed.

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
Launchpad Janitor (janitor) wrote :

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

---------------
preseed (1.71ubuntu5.1) artful; urgency=medium

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

 -- Zhang Hua <email address hidden> Fri, 26 Jan 2018 13:32:11 +0800

Changed in preseed (Ubuntu Artful):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) 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 debian-installer - 20101020ubuntu523.2

---------------
debian-installer (20101020ubuntu523.2) artful; urgency=medium

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

 -- Zhang Hua <email address hidden> Fri, 26 Jan 2018 13:53:02 +0800

Changed in debian-installer (Ubuntu Artful):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Hua, 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.43 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-trusty to verification-done-trusty. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-trusty. In either case, without details of your testing we will not be able to proceed.

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
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Hua, 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.19 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-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

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
Revision history for this message
Hua Zhang (zhhuabj) wrote :
tags: added: verification-done-trusty verification-done-xenial
removed: verification-needed-trusty verification-needed-xenial
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

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

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

 -- Zhang Hua <email address hidden> Tue, 16 Jan 2018 21:58:04 +0800

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

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

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

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

 -- Hua Zhang <email address hidden> Thu, 25 Jan 2018 15:16:39 +0800

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

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

  * Include $efi_name in shim filename. (LP: #1743787)
  * Rebuild to pick up the latest change in preseed. (LP: #1745531)

 -- Eric Desrochers <email address hidden> Fri, 19 Jan 2018 09:20:25 -0500

Changed in debian-installer (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

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

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

 -- Hua Zhang <email address hidden> Thu, 25 Jan 2018 15:09:28 +0800

Changed in preseed (Ubuntu Trusty):
status: Fix Committed → Fix Released
tags: added: id-5ab94d853c3f9bad14e58f87
Changed in debian-installer (Ubuntu Bionic):
status: In Progress → Fix Released
Mathew Hodson (mhodson)
Changed in debian-installer (Ubuntu):
status: In Progress → Fix Released
tags: removed: verification-needed
Revision history for this message
Jean-François Prévost (jfprevost) wrote :

Hi,

I'm having the same issue on Focal Fossa using ubuntu-20.04-legacy-server-amd64.iso (md5sum 9d2b54506f8f9fdad6b72e45aff0f0de).

The only workaround which helps overcome the issue of not taking into account d-i netcfg/hostname string <desired host name> from preseed file is to specify hostname=<desired host name> on kernel boot command line.

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.