[SRU] Reinforce hostname preseed regex

Bug #1745531 reported by Hua Zhang on 2018-01-26
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
debian-installer (Ubuntu)
Status tracked in Bionic
Trusty
Medium
Eric Desrochers
Xenial
Medium
Hua Zhang
Artful
Medium
Hua Zhang
Bionic
Medium
Hua Zhang
preseed (Ubuntu)
Status tracked in Bionic
Trusty
Medium
Hua Zhang
Xenial
Medium
Hua Zhang
Artful
Medium
Hua Zhang
Bionic
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) on 2018-01-26
tags: added: sts
Eric Desrochers (slashd) on 2018-01-26
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) on 2018-01-26
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
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
Eric Desrochers (slashd) wrote :

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

tags: added: patch
Hua Zhang (zhhuabj) wrote :
Hua Zhang (zhhuabj) wrote :
Hua Zhang (zhhuabj) wrote :
Hua Zhang (zhhuabj) wrote :
Hua Zhang (zhhuabj) wrote :
summary: - Reinforce hostname preseed regex
+ [SRU] Reinforce hostname preseed regex
Hua Zhang (zhhuabj) wrote :
description: updated
Hua Zhang (zhhuabj) wrote :
Eric Desrochers (slashd) on 2018-01-29
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
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) on 2018-01-29
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) on 2018-01-30
Changed in debian-installer (Ubuntu Xenial):
assignee: Eric Desrochers (slashd) → Hua Zhang (zhhuabj)
Eric Desrochers (slashd) on 2018-01-31
description: updated
Eric Desrochers (slashd) on 2018-01-31
description: updated
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
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.

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

Hua Zhang (zhhuabj) wrote :
tags: added: verification-done-artful
removed: verification-needed-artful

Hello,

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

Cristian

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
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!

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

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.

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

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
Ł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
Hua Zhang (zhhuabj) wrote :
tags: added: verification-done-trusty verification-done-xenial
removed: verification-needed-trusty verification-needed-xenial
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
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
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
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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers