Skip to content

VyOS: vagrant box building hacks - #3849

Merged
ipspace merged 4 commits into
ipspace:devfrom
ssasso:vyos_vagrant_build
Sep 3, 2026
Merged

VyOS: vagrant box building hacks#3849
ipspace merged 4 commits into
ipspace:devfrom
ssasso:vyos_vagrant_build

Conversation

@ssasso

@ssasso ssasso commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes #3841

It's "a bit" hacky, but I put a warning on the box building document about this, and about the fact that for this reason we suggest using the containerlab version.

However, it works.

Tested with
netlab up -p libvirt -d vyos 01-interfaces.yml --validate (building issues are in the interface presence & ordering)

[SUCCESS] Lab devices configured


This scenario tests basic interface, IPv4, and IPv6 configuration, including generation of IPv6 Router Advertisements
[ping]     IPv4 ping H1,H2 => R [ node(s): h1,h2 ]
[PASS]     h1: Ping to 10.0.0.132 succeeded
[PASS]     h2: Ping to 10.0.0.132 succeeded
[PASS]     Test succeeded in 0.4 seconds

[ping6]    IPv6 ping H1,H2 => R [ node(s): h1,h2 ]
[PASS]     h1: Ping to 2001:db8:0:84::1 succeeded
[PASS]     h2: Ping to 2001:db8:0:84::1 succeeded
[PASS]     Test succeeded in 0.4 seconds

[shutdown] Check link shutdown (ping H3 => R) [ node(s): h3 ]
[PASS]     h3: Ping to 10.0.0.132 failed as expected
[PASS]     Test succeeded in 3.2 seconds

[SUCCESS]  Tests passed: 5

Given all this, up to you @ipspace if you want to merge this or not.

@ssasso
ssasso requested a review from ipspace September 2, 2026 15:31
@ipspace

ipspace commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Based on https://docs.vyos.io/en/1.5/automation/cloud-init.html, it seems like we could get most of your setup into cloud-init files. Let me waste some time on this... ;)

@ssasso

ssasso commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

Based on https://docs.vyos.io/en/1.5/automation/cloud-init.html, it seems like we could get most of your setup into cloud-init files. Let me waste some time on this... ;)

Unfortunately it's not that simple.
To use cloud init you first need to manually build an image with cloud init enabled ':) ... Using unmaintained Ansible playbooks :(

( https://docs.vyos.io/en/1.5/automation/cloud-init.html#generate-qcow2-image )

@ipspace

ipspace commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Unfortunately it's not that simple. To use cloud init you first need to manually build an image with cloud init enabled ':)

Yeah, they really try to make it "easy" to install stuff :((

How about modifying "netlab libvirt package" command to accept ISO images and then do the whole installation process (including reboot) in one go?

@ipspace

ipspace commented Sep 3, 2026

Copy link
Copy Markdown
Owner

One more thing: we could build an ISO image with the required scripts (the pre-boot script and another one with the set commands) and then execute a single script off the ISO image to complete VyOS configuration.

@ssasso

ssasso commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

How about modifying "netlab libvirt package" command to accept ISO images and then do the whole installation process (including reboot) in one go?

that could be a great idea.

potentially, we could also add "hooks" to inject arbitrary files on arbitrary partitions of the qcow file ("mounting" it with qemu-nbd & co) before packing it up as box. - at that point we can inject a first-boot script with all the required config including vagrant keys & friends.

however i'm wondering if this will ever be used by other devices and if it's worth the effort...

@ipspace

ipspace commented Sep 3, 2026

Copy link
Copy Markdown
Owner

potentially, we could also add "hooks" to inject arbitrary files on arbitrary partitions of the qcow file ("mounting" it with qemu-nbd & co) before packing it up as box. - at that point we can inject a first-boot script with all the required config including vagrant keys & friends.

Wondering what happens if you have two CD-ROMs when booting the CD-ROM image...

however i'm wondering if this will ever be used by other devices and if it's worth the effort...

Nah, we have to do this with the minimum amount of extra changes. For example:

  • We could recognize ISO as well as QCOW2 as the input and create empty QCOW2 file in that case (no big deal)
  • We can package an extra ISO file with our scripts (no extra functionality)
  • We could start the VM with a modified template (I'm using the FRR template at the moment; adding a second CDROM should be a breeze). The "only" unknown is what happens when VyOS reboots with two CD-ROMs attached to it.

@ipspace

ipspace commented Sep 3, 2026

Copy link
Copy Markdown
Owner

... I think I got most of the details nailed down. Give me a few hours...

@ipspace ipspace left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ;) Thanks a million!

@ipspace
ipspace merged commit de8b1f4 into ipspace:dev Sep 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Downloadable VyOS box is over 2 years old

2 participants