Page MenuHomeVyOS Platform

VyOS cloud init fails with No such file or directory: '/opt/vyatta/etc/config.boot.default'
Confirmed, LowPublic

Description

I built my own image for proxmox with cloud init, but the configuration provided is not applied, instead I get the error:

#/var/log/cloud-init.log
2025-02-28 01:14:30,699 - handlers.py[DEBUG]: start: modules-config/config-vyos_userdata: running config-vyos_userdata with frequency once-per-instance
2025-02-28 01:14:30,699 - util.py[DEBUG]: Writing to /opt/vyatta/etc/config/cloud/instances/nocloud/sem/config_vyos_userdata - wb: [644] 25 bytes
2025-02-28 01:14:30,700 - helpers.py[DEBUG]: Running config-vyos_userdata using lock (<FileLock using file '/opt/vyatta/etc/config/cloud/instances/nocloud/sem/config_vyos_userdata'>)
2025-02-28 01:14:30,700 - cc_vyos_userdata.py[DEBUG]: Commands to configure: ["set system host-name 'r01'"]
2025-02-28 01:14:30,700 - cc_vyos_userdata.py[DEBUG]: Using configuration file: /opt/vyatta/etc/config.boot.default
2025-02-28 01:14:30,700 - handlers.py[DEBUG]: finish: modules-config/config-vyos_userdata: FAIL: running config-vyos_userdata with frequency once-per-instance
2025-02-28 01:14:30,700 - util.py[WARNING]: Running module vyos_userdata (<module 'cloudinit.config.cc_vyos_userdata' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_vyos_userdata.py'>) failed
2025-02-28 01:14:30,701 - util.py[DEBUG]: Running module vyos_userdata (<module 'cloudinit.config.cc_vyos_userdata' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_vyos_userdata.py'>) failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 1086, in _run_modules
    ran, _r = cc.run(
              ^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 55, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 185, in run
    results = functor(*args)
              ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_vyos_userdata.py", line 198, in handle
    with open(config_file_path, 'r') as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/vyatta/etc/config.boot.default'

However, when I check the mentioned file it is there at the expected location, but it's only the default config without my cloud init provided parameters.

This is the build flavor used:

image_format = "qcow2"
packages=["qemu-guest-agent", "cloud-init"]

I suppose this install the vyos cloud init package and not the "official"/debian cloud init package? Otherwise I followed to documentation at https://docs.vyos.io/en/sagitta/automation/cloud-init.html#cloud-init-on-proxmox.

Please let me know if you need more details, any log file, etc.

Thanks in advance

Details

Version
-
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

I tried adding

[[includes_chroot]]
  path = "opt/vyatta/etc/config/config.boot"
  data = ""

to the build flavor, and now it seems to work.

I still get warning in the cloud init log, but so far I haven't noticed anything not working. This works as a workaround for me, but I still think that this is a bug.

I tried adding

[[includes_chroot]]
  path = "opt/vyatta/etc/config/config.boot"
  data = ""

to the build flavor, and now it seems to work.

I still get warning in the cloud init log, but so far I haven't noticed anything not working. This works as a workaround for me, but I still think that this is a bug.

I've recently just encountered the same issue and tried to get to it's roots at this forum thread: https://forum.vyos.io/t/smoke-tests-failing-again/16200

So for what it's known, this is some sort of bug. I'm unsure yet though, if it is a bug in the vyos cloud-init modules or in the build setup. As you've noticed, even an empty file is enough for cloud-init to pull through and do it's job, so I suspect the vyos cloud-init modules themself to be the culprit. There seem to be a few different locations where a "default" config can be found, so I'm unsure which one would be the right. But as providing a custom one at this location actually changed the default config the router had on first boot, I suspect this to be the "proper" one. I didn't investigate any further than this.

I worked around this issue by simply providing a custom (not empty) default, moving it into place before starting the build, similar do how you do it via [[includes_chroot]]. I still look forward to open a PR allowing operations based on src files instead of inline contents, but that's a different topic.

zsdc changed the task status from Open to Confirmed.Tue, Mar 11, 5:47 PM
zsdc subscribed.

The problem exists because, in the latest builds, the config.boot.default file was moved to /usr/share/vyos/config.boot.default. Therefore, when Cloud-init searches for one of the config files to apply the initial configuration, it cannot find any - neither the main nor the default file.

These sections need to be updated to follow the next logic:

  1. Try to use the /opt/vyatta/etc/config/config.boot file first.
  2. Read /usr/share/vyos/config.boot.default if the main file is not available.
  3. Perform the required config operations.
  4. Save the configuration to /opt/vyatta/etc/config/config.boot, regardless of which file was used for reading.

Section 1:

Section 2: