hypriot / flash

Command line script to flash SD card images of any kind
MIT License
1k stars 176 forks source link

Cloud-init file is not honoured by Raspberry Pi 4 #155

Closed Jacobh2 closed 4 years ago

Jacobh2 commented 4 years ago

Hey,

I've tried to create an SD card for a RPi 4B 2GB version using a cloud-init file and flashing it using this flash tool. However, when I boot up the pi, it pops up as the default hostname "black-pearl", and does not set for example my public ssh key.

My cloud-init file looks like this (named builder.yaml):

hostname: builder
manage_etc_hosts: true
apt_preserve_sources_list: true

users:
  - name: client
    primary-group: users
    shell: /bin/bash
    sudo: ALL=(ALL) NOPASSWD:ALL
    groups: users,docker,adm,dialout,audio,plugdev,netdev,video
    ssh-import-id: None
    lock_passwd: true
    ssh_authorized_keys:
      - ssh-rsa AAAA....

locale: "en_US.UTF-8"
timezone: "Europe/Stockholm"

runcmd:
  # Pick up hostname change
  - 'systemctl restart avahi-daemon'

and I flash it using this command:

./flash -u builder.yaml https://github.com/hypriot/image-builder-rpi/releases/download/v1.11.3/hypriotos-rpi-v1.11.3.img.zip

I have checked the userdata file on the SD card after flashing, and before starting up the pi for the first time and can confirm that my cloud-init data is there and looks correct. However, starting up the pi makes it not honour the hostname or user settings.

What am I missing here?

Jacobh2 commented 4 years ago

I have even tried to use one of the samples provided, but without any success.

Jacobh2 commented 4 years ago

Sorry for this, seems like all that was needed was valuable patience: Letting the pi be for 5 min made it finally reachable with the correct hostname and username! :tada: