Unable to set apt_preferences(5) parameter during maas-enlisting-node phase

Bug #1857468 reported by Nishant Kumar
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MAAS
Expired
Undecided
Unassigned
cloud-init
Expired
Undecided
Unassigned

Bug Description

During the maas-enlisting-node phase, cloud init tries to run an 'apt-get update' and it fails because of an error as given below:

2019-12-18T06:08:39+00:00 maas-enlisting-node cloud-init[2655]: Get:4 http://<repo_name>/ubuntu bionic-security InRelease [10.1 kB]
2019-12-18T06:08:39+00:00 maas-enlisting-node cloud-init[2655]: Err:5 http://<repo_name>/ubuntu bionic-backports Release
2019-12-18T06:08:39+00:00 maas-enlisting-node cloud-init[2655]: 404 Not Found [IP: 32.68.226.74 80]
2019-12-18T06:08:40+00:00 maas-enlisting-node cloud-init[2655]: Reading package lists...
2019-12-18T06:08:40+00:00 maas-enlisting-node cloud-init[2655]: E: The repository 'http://<repo_name>/ubuntu bionic-backports Release' does not have a Release file.
2019-12-18T06:08:40+00:00 maas-enlisting-node cloud-init[2655]: E: Repository 'http://<repo_name>/ubuntu bionic InRelease' changed its 'Label' value from 'Ubuntu' to 'ubuntu bionic'
2019-12-18T06:08:40+00:00 maas-enlisting-node cloud-init[2655]: E: Repository 'http://<repo_name>/ubuntu bionic-updates InRelease' changed its 'Label' value from 'Ubuntu' to 'ubuntu bionic-updates'
2019-12-18T06:08:40+00:00 maas-enlisting-node cloud-init[2655]: E: Repository 'http://<repo_name>/ubuntu bionic-updates InRelease' changed its 'Codename' value from 'bionic' to 'bionic-updates'
2019-12-18T06:08:40+00:00 maas-enlisting-node cloud-init[2655]: E: Repository 'http://<repo_name>/ubuntu bionic-security InRelease' changed its 'Label' value from 'Ubuntu' to 'ubuntu bionic-security'
2019-12-18T06:08:40+00:00 maas-enlisting-node cloud-init[2655]: E: Repository 'http://<repo_name>/ubuntu bionic-security InRelease' changed its 'Codename' value from 'bionic' to 'bionic-security'

apt has an option to to ignore this error by providing a parameter -"--allow-releaseinfo-change", however I am unable to set this parameter in maas. Is there a place in the code or in the cloud init phase where we can set this option to avoid the above error? If not then would it make sense to add such functionality?

Revision history for this message
Alberto Donato (ack) wrote :

The apt-get update call is performed by cloud-init.

Therefore, supporting the option would be a feature request in cloud-init.

affects: maas → cloud-init
Revision history for this message
Scott Moser (smoser) wrote :

The first question/easiest answer is:
   Why is your mirror misbehaving / Fix your mirror.

You can pass apt options to cloud-init via apt_configure module
  https://cloudinit.readthedocs.io/en/latest/topics/modules.html#apt-configure

The apt flag that you're requesting (--allow-releaseinfo-change) says
that it is applied via config in apt_preferences(5) configuration
item: Acquire::AllowReleaseInfoChange.

Cloud-init does not have configuration syntax to modify apt_preferences(5).
Unfortunately it does not look like you can configure this in apt.conf.d.

write_files could be used to write a file into /etc/apt/preferences.d/
with the desired configuration.
https://cloudinit.readthedocs.io/en/latest/topics/modules.html#write-files

So, if you can convince MAAS to send cloud-config with something like the
following, then you'd be good.

    #cloud-config
    write_files:
     - path: /etc/apt/preferences.d/your.conf
       content: |
          Acquire::AllowReleaseInfoChange = yes

In order to accomplish this, you need either:

 a.) support in maas for generic user-supplied cloud-config to enlistment
environment where you could just use write_files.
 b.) specific support in maas for 'apt-preferences' configuration to the
enlistment environment and also changes to cloud-init to expose
'apt-preferences' configuration.

Both of these require some change in MAAS (or just answering "here is how you do 'a'" above.

summary: - Unable to set Apt config parameter during maas-enlisting-node phase
+ Unable to set apt_preferences(5) parameter during maas-enlisting-node
+ phase
Revision history for this message
Scott Moser (smoser) wrote :

I updated the title to change 'apt config' to apt_preferences as I think that is required. Please correct me if I'm wrong.

Revision history for this message
Lee Trager (ltrager) wrote :

MAAS allows you to define user_data in preseeds. You'll need to add the config Scott posted to the files in /etc/maas/preseeds as cloud-init always runs apt update.

Lee Trager (ltrager)
Changed in maas:
status: New → Incomplete
Changed in cloud-init:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for MAAS because there has been no activity for 60 days.]

Changed in maas:
status: Incomplete → Expired
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for cloud-init because there has been no activity for 60 days.]

Changed in cloud-init:
status: Incomplete → Expired
Revision history for this message
James Falcon (falcojr) wrote :
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.