cloud-init NoCloud with OPNsense 21

Started by s-cappa, September 28, 2021, 04:18:32 PM

Previous topic - Next topic
Hi everyone!
I'm new to OPNSense (also to FreeBSD in general ;D) and I'm interested to use cloud-init to configure at least LAN (vtnet0) with static ip address, root password and eventually running custom scripts in a OPNsense VM created with Qemu to apply a custom configuration.

I saw that opnsense github repo has cloud-init port [url]https://github.com/opnsense/ports/tree/master/net/cloud-init[/url, so I installed it with:

pkg install net/cloud-init

Then I added cidata.iso image to Qemu as required by cloud-init NoCloud with user-data and meta-data.
I already tested those files on ubuntu server 21 and kali linux. They are correct at least on those OSs ;)

I found the cdrom as /dev/cd0 and mounted with


mkdir -p /media/cdrom
mount -t cd9660 /dev/cd0 /media/cdrom


I also edited /etc/fstab appending this line:


/dev/cd0 /media/cdrom cd9660 ro 0 0


to auto mount the cdrom at boot.

Finally, I created (because unexisting) /etc/rc.conf with this content:

cloudinit_enable="YES"


and restarted my OPNsense VM.

What I expect now is that cloud-init will start automatically at boot.

However this doesn't happen, probably because I have to configure something.
If I run `cloud-init init` via terminal it throws error:


stages.py[WARNING]: Failed to rename devices: Unexpected error while running command.
Command [`ip`, `-6`, `addr`,`show`, `permanent`, `scope`,`global`]
Exit code: -
Reason: [Errno 2] No such file or directory: b`ip`
Stdout: -
Stderr: -
No `init` modules to run under section `cloud_init_modules`


On both Kali Linux and Ubuntu Server it works easely.

I have some questions about this:
1) Is it possible to use cloud-init port with NoCloud and a cdrom (cidata) with configuration files or it supports only Cloud services with OpenStack and so on?
2) Is my configuration above correct or am I missing something?
3) Why does it appear the error above? How can I fix it?

Thank you.


October 07, 2021, 05:35:40 PM #2 Last Edit: October 07, 2021, 05:41:45 PM by l-ross
Hi s-cappa, I'm looking for freebsd cloud-init as well.
Unfortunately it seems that there's a dependency with ip command, but I can find a port package for it.
Does anyone know how to deal with that, pls?