Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our maas LAN can't access the internet and has a internal apt-mirror site I changed the mirror set of maas server's snippets/maas_proxy file as follows:

d-i     mirror/country string manual
d-i     mirror/http/hostname string
d-i     mirror/http/directory string /ubuntu
d-i     mirror/http/proxy string

I deployed two maas node. Dashboard show the two node's state are ready. But node's cloud-init client changed the apt's sources.list like this:

## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
##     or do the same in user-data
deb precise main
deb-src precise main

Directly use cobbler install node(without maas), the node apt's sources.list like:

deb precise main
deb-src precise main

My question is:

  1. How to set user-data in maas? So that I can set cloud-init's mirror's url to or prevent cloud-init to change mirror's url.
  2. Maas node's file /home/ubuntu/.ssh/authorized_keys is empty. Is it caused by the mirror's setup?
share|improve this question

Thanks for reporting this. I've opened bug 1006966 against upstream maas to address this.

For the time being, the easiest way for you to work around this is probably to have a late_command install a file into /etc/cloud/cloud.cfg with content like:

# /etc/cloud/cloud.cfg.d/99-local-mirror-only.cfg
apt_preserve_sources_list: true

Untested, but you may be able to accomplish that by doing:

--- /var/lib/cobbler/kickstarts/maas.preseed.dist   2012-05-31 15:37:06.689109923 +0000
+++ /var/lib/cobbler/kickstarts/maas.preseed    2012-05-31 15:37:43.293109690 +0000
@@ -90,4 +90,5 @@
 d-i    preseed/late_command string true && \
        $SNIPPET('maas_sudoers') && \
        $SNIPPET('maas_disable_pxe') && \
+       $SNIPPET('local_mass_local_mirror') && \
--- /dev/null   2012-05-31 15:21:47.612623001 +0000
+++ /var/lib/cobbler/snippets/local_maas_local_mirror   2012-05-31 15:39:33.897110012 +0000
@@ -0,0 +1 @@
+in-target sh -c "echo apt_preserve_sources_list: true > /etc/cloud/cloud.cfg.d/99-local-mirror-only.cfg" \

Oh, and to answer "how to set userdata in maas", that is only currently possible by using the maas API. There are no existing client tools at this time.

share|improve this answer
hi, smoser: I has tested your suggestion. Installer tip "Failed to run preseed command". And I found the boot of node has no /etc/cloud/ directory at that time. – Michael Jun 1 '12 at 4:59
up vote 1 down vote accepted

OK, we can complete node installation by add a line in /var/lib/cobbler/snippets/maas_preseed like:

 cloud-init   cloud-init/local-cloud-config string manage_etc_hosts: localhost
+cloud-init   cloud-init/local-cloud-config string apt_preserve_sources_list: true

In factor, cloud-init/local-cloud-config is the cloud-init's local configer.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.