← Back to team overview

cloud-init team mailing list archive

Re: using cloud-init on a wireless Raspberry Pi

 

HI,

> The only way I've been able to get it to successfully connect to the
internet is by including the wifi credentials in the network-config file.
But since this uses Netplan, it requires a reboot to finally connect.
Your mention of the additional reboot needed, reminds me of this bug:

https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1870346  which
pointed to a netplan bug
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1874377

which is now fixed.

> But no additional packages the image needs are installed, since internet
was not available when the image was created prior to reboot.
> How can I overcome this?

IIUC, with the lack of an network connection, then your custom cloud-config
would not run to completion as it needed to install additional
packages?

On possible workaround is to pre-install the packages in your image without
booting.
Cloud-init project uses a command, mount-image-callback, from the
cloud-image-utils package.

On an existing Ubuntu system (of the same arch) where you have your image,
you can do something like:

sudo mount-image-callback --system-mounts --system-resolvconf <image file>
-- chroot _MOUNTPOINT_ /bin/bash -c 'apt update && apt install -y pkg1 pkg2
...'


Hope that helps,
Ryan


On Wed, Dec 2, 2020 at 7:16 AM Jim Gregory <launchpad_acct@xxxxxxxxxxxxxxx>
wrote:

> I'm trying to set up Ubuntu Server on a Raspberry Pi 3 using cloud-init.
> I would like to be able to create a customized image by copying the default
> image to an SD card, then copying new versions of user-data and
> network-config over the default ones.
>
> However, I can't seem to do this when the Pi doesn't have an ethernet
> connection (i.e., it's on wifi only).  The only way I've been able to get
> it to successfully connect to the internet is by including the wifi
> credentials in the network-config file.  But since this uses Netplan, it
> requires a reboot to finally connect.  But no additional packages the image
> needs are installed, since internet was not available when the image was
> created prior to reboot.
>
> How can I overcome this?
>
> -Jim
> --
> ~ sent from my pedal-powered computer (pedalpc.com) ~
>
>
> --
> Mailing list: https://launchpad.net/~cloud-init
> Post to     : cloud-init@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~cloud-init
> More help   : https://help.launchpad.net/ListHelp
>

References