This bug was fixed in the package base-files - 10.1ubuntu2.7

base-files (10.1ubuntu2.7) bionic; urgency=medium

  * update-motd.d/50-motd-news: add cloud_id to user-agent string
    (LP: #1840946)

 -- Andreas Hasenack <>  Fri, 27 Sep 2019 15:24:34

** Changed in: base-files (Ubuntu Bionic)
       Status: Fix Committed => Fix Released

You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs

  Include cloud-id in user-agent string

Status in base-files package in Ubuntu:
  Fix Released
Status in base-files source package in Xenial:
  Fix Committed
Status in base-files source package in Bionic:
  Fix Released
Status in base-files source package in Disco:
  Fix Released

Bug description:

  We would like to include a cloud_id/$name parameter to the user-agent
  string that is sent to This will allow the
  server part of to serve cloud-specific content if one
  is available.

  [Test Case]
  a) confirm that the motd message is still displayed:
  $ sudo sh /etc/update-motd.d/50-motd-news --force

   * Kata Containers are now fully integrated in Charmed Kubernetes 1.16!
     Yes, charms take the Krazy out of K8s Kata Kluster Konstruction.

  b) confirm that cloud_id is set in the user-agent. This should be
  tested in lxd, gce, aws, and azure. Here is an example for lxd:

  $ sudo sh -x /etc/update-motd.d/50-motd-news --force 2>&1| grep -E "curl 
  + curl --connect-timeout 60 --max-time 60 -A curl/7.47.0-1ubuntu2.14 
Ubuntu/16.04.6/LTS GNU/Linux/4.15.0-64-generic/x86_64 
Intel(R)/Core(TM)/i7-7600U/CPU/@/2.80GHz uptime/921.00/900.00 cloud_id/lxd -o-

  For each of the mentioned clouds, we expect cloud_id to be set to
  their short names: aws, gce, azure.

  For xenial, there is an extra test case:
  c) list the timers to confirm motd-news is active, and will run sometime in 
the next 12h following the installation of the updated package:
  $ systemctl list-timers
  NEXT                         LEFT     LAST                         PASSED    
UNIT                         ACTIVATES
  Mon 2019-09-30 19:38:55 UTC  6h left  n/a                          n/a       
motd-news.timer              motd-news.service
  Mon 2019-09-30 22:45:13 UTC  9h left  n/a                          n/a       
apt-daily.timer              apt-daily.service
  Tue 2019-10-01 06:12:11 UTC  16h left n/a                          n/a       
apt-daily-upgrade.timer      apt-daily-upgrade.service
  Tue 2019-10-01 13:11:41 UTC  23h left Mon 2019-09-30 13:11:41 UTC  14min ago 
systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service

  [Regression Potential]
  This change adds a new parameter to the already existing user-agent string. 
This relies on the cloud-id tool from cloud-init. Even though it's considered 
trusted to some degree, it may be possible for some clouds to override their 
name in the data fed to cloud-init, which is what cloud-id parses. Therefore 
some precautions were taken when handling its contents:
  - set value to unknown if cloud-id fails, doesn't exist, or produce an empty 
  - sanitize the output of cloud-id, and truncate it to a maximum length
  - use a tempfile to store the intermediate output of cloud-id instead of a 
shell variable. One reason being avoiding storing a potentially large amount of 
data in a shell variable, and the other is to avoid mistakes when manipulating 
a shell variable that could contain shell metacharacters.

  [Other Info]
  For xenial, this is also finishing the fix for bug #1637800 which was stuck 
in the SRU queue due to it failing checks. Since the xenial package isn't using 
debhelper, manual dh snippets were added to the maintainer scripts, but they 
missed the dh_systemd_enable chunks. I'm also skipping starting 
motd-news.service, since the timer unit will handle that. This avoids an 
annoying error message about trying to start a unit that is not enabled.

  [Original Description]
  I'm preemptively filing this bug in case this isn't uploaded before the 
feature freeze.

  We would like to include a cloud_id/$name parameter to the user-agent
  string that is sent to This will allow the
  server part of to serve cloud-specific content if one
  is available.

  There is an MP for this already at

To manage notifications about this bug go to:

Mailing list:
Post to     :
Unsubscribe :
More help   :

Reply via email to