Custom image using cloud-init fails to fetch MAAS metadata on bare metal

Problem Summary

I’m deploying a custom Ubuntu 22.04 image built with Packer via MAAS. While the image deploys successfully on virtual machines, it intermittently fails on bare-metal nodes with the following cloud-init error:

cloud-init[2638]: DataSourceNone. No metadata service found at 169.254.169.254

My Setup

  • MAAS version: 3.5
  • cloud-init version in custom image: 23.1.2
  • OS: Ubuntu 22.04
  • Image built using Packer v1.12.0
  • Metadata expected via 169.254.169.254 (MAAS)
    If anyone know the fix or experienced this please reply with a fix

Hi @akashram611

DataSourceNone is a fallback datasource when nothing else worked.

cloud-init datasource is provided via kernel parameters e.g.

cc:{'datasource_list': ['MAAS']}end_cc cloud-config-url=http://10-245-136-0--21.maas-internal:5248/MAAS/metadata/latest/by-id/4tpr6w/?op=get_preseed apparmor=0 log_host=10.245.136.20 log_port=5247

It could be that either your MAAS is behind the loadbalancer and the proper port is not advertised or something else.

Can you tell a bit more about your MAAS setup? Any errors observed in MAAS logs?

Hi @troyanov, my MAAS setup is separate regiond and rackd controller & I cant able to see log as well
root@maasregiond:~# cd /var/snap/maas/common/
chrony/ log/ maas/ pebble/ proxy/ snap_mode test-db-socket/
root@maasregiond:~# cd /var/snap/maas/common/log/
root@maasregiond:/var/snap/maas/common/log# ls
root@maasregiond:/var/snap/maas/common/log# cd …/…

Starting from MAAS 3.5 all logs were moved to system journal
https://maas.io/docs/how-to-use-logging#p-14514-checking-logs-in-systemd-maas-35-and-newer

On your machine, can you check what kernel parameters are being passed during boot? What are the values for datasource_list and cloud-config-url?

where i can find those parameters

cat /proc/cmdline or cat /etc/default/grub

By the way, are you using MAAS DHCP? Do you have DHCP enabled for the VLAN where your machine is connected to?

root@maasregiond:~# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-5.15.0-139-generic root=/dev/mapper/ubuntu–vg-ubuntu–lv ro
root@maasregiond:~# cat /etc/default/grub

If you change this file, run ‘update-grub’ afterwards to update

/boot/grub/grub.cfg.

For full documentation of the options in this file, see:

info -f grub -n ‘Simple configuration’

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian
GRUB_CMDLINE_LINUX_DEFAULT=“”
GRUB_CMDLINE_LINUX=“”

Uncomment to enable BadRAM filtering, modify to suit your needs

This works with Linux (no patch required) and with any kernel that obtains

the memory map information from GRUB (GNU Mach, kernel of FreeBSD …)

#GRUB_BADRAM=“0x01234567,0xfefefefe,0x89abcdef,0xefefefef”

Uncomment to disable graphical terminal (grub-pc only)

#GRUB_TERMINAL=console

The resolution used on graphical terminal

note that you can use only modes which your graphic card supports via VBE

you can see them in real GRUB with the command `vbeinfo’

#GRUB_GFXMODE=640x480

Uncomment if you don’t want GRUB to pass “root=UUID=xxx” parameter to Linux

#GRUB_DISABLE_LINUX_UUID=true

Uncomment to disable generation of recovery mode menu entries

#GRUB_DISABLE_RECOVERY=“true”

Uncomment to get a beep at grub start

#GRUB_INIT_TUNE=“480 440 1”
root@maasregiond:~#

yess, i am getting this issue at the end of the deployment

Hm, that looks like your Region controller machine, not the machine having issues?

To me it looks like either network misconfiguration you maybe you are hitting a cloud-init issue (however I remember the log line looked differently)

For ur clarification

Regiond > Rackd > Target Baremetal

My target baremetal has no OS, i am pushing from maas at the end of deployment, its not getting deplyed fully it gets cloud init failed errors

I even downgraded the cloudinit using apt-get install -y --allow-downgrades cloud-init=23.1.2-0ubuntu0~22.04.1

Hm. Ok.

And the problem happens only for the custom images or original Ubuntu also fails?

Both the images fails

Could you try to use the daily ppa as for Comment #13 : Bug #2106671 : Bugs : MAAS

I’d still be curious to know what is inside kernel parameters, as it could be that machine is getting a wrong data source IP?

@akashram611 is it possible to share the console output of the machine that you are trying to boot?

Hi @r00ta


in which one i should copy that script

You need to create /var/snap/maas/current/preseeds/curtin_userdata

i cant able to deply my vm after i created that script file