Page MenuHomeVyOS Platform

tpm encryption enable breaks cloud-init service
Closed, ResolvedPublicBUG

Description

cloud-init service fails to start with the following error:

Starting Initial cloud-init job (pre-networking)...
[   32.938055] cloud-init[1141]: Cloud-init v. 22.1-453-g11d4c471-1~bddeb running 'init-local' at Thu, 26 Jun 2025 14:58:47 +0000. Up 32.91 seconds.
[   32.994128] cloud-init[1141]: 2025-06-26 14:58:47,775 - util.py[WARNING]: failed stage init-local
[FAILED] Failed to start Initial cloud-init job (pre-networking).
[   33.037081] cloud-init[1141]: failed run of stage init-local
[   33.105051] cloud-init[1141]: ------------------------------------------------------------
[   33.171060] cloud-init[1141]: Traceback (most recent call last):
[   33.231048] cloud-init[1141]:   File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 761, in status_wrapper
[   33.231093] cloud-init[1141]:     ret = functor(name, args)
[   33.336096] cloud-init[1141]:           ^^^^^^^^^^^^^^^^^^^
[   33.362072] cloud-init[1141]:   File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 384, in main_init
[   33.412064] cloud-init[1141]:     init.fetch(existing=existing)
[   33.469067] cloud-init[1141]:   File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 432, in fetch
[   33.542065] cloud-init[1141]:     return self._get_data_source(existing=existing)
[   33.614053] cloud-init[1141]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   33.647066] cloud-init[1141]:   File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 319, in _get_data_source
[   33.699053] cloud-init[1141]:     util.del_file(self.paths.instance_link)
[   33.734046] cloud-init[1141]:   File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1900, in del_file
[   33.781072] cloud-init[1141]:     raise e
[   33.842054] cloud-init[1141]:   File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1897, in del_file
[   33.912062] cloud-init[1141]:     os.unlink(path)
[   33.968123] cloud-init[1141]: IsADirectoryError: [Errno 21] Is a directory: '/opt/vyatta/etc/config/cloud/instance'

Seems like the problem is that encrypt_config uses copytree with default symlinks=False, so cloud/instance is copied as a directory instead of preserved as a symlink.
Before encryption enable:

vyos@VyOS-for-Smoke-Tests:~$ ls -la /opt/vyatta/etc/config/cloud/
total 32
drwxr-xr-x 8 root root 4096 Mar  5 02:22 .
drwxr-xr-x 1 root root 4096 Mar  5 02:22 ..
drwxr-xr-x 2 root root 4096 Mar  5 02:22 data
drwxr-xr-x 2 root root 4096 Mar  5 02:22 handlers
lrwxrwxrwx 1 root root   58 Mar  5 02:22 instance -> /opt/vyatta/etc/config/cloud/instances/i-087ddb4d24ac36170
drwxr-xr-x 3 root root 4096 Mar  5 02:22 instances
drwxr-xr-x 6 root root 4096 Mar  5 02:22 scripts
drwxr-xr-x 2 root root 4096 Mar  5 02:22 seed
drwxr-xr-x 2 root root 4096 Mar  5 02:22 sem

After encryption enable:

vyos@VyOS-for-Smoke-Tests:~$ ls -la /opt/vyatta/etc/config/cloud/
total 36
drwxr-xr-x  9 root vyattacfg 4096 Mar  5 02:22 .
drwxr-xr-x 10 root vyattacfg 4096 Mar  5 02:26 ..
drwxr-xr-x  2 root vyattacfg 4096 Mar  5 02:26 data
drwxr-xr-x  2 root vyattacfg 4096 Mar  5 02:22 handlers
drwxr-xr-x  5 root vyattacfg 4096 Mar  5 02:26 instance
drwxr-xr-x  3 root vyattacfg 4096 Mar  5 02:22 instances
drwxr-xr-x  6 root vyattacfg 4096 Mar  5 02:22 scripts
drwxr-xr-x  2 root vyattacfg 4096 Mar  5 02:22 seed
drwxr-xr-x  2 root vyattacfg 4096 Mar  5 02:22 sem

Details

Version
1.5-rolling-202602271438
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

natali-rs1985 changed the task status from Open to In progress.Jul 2 2026, 10:15 AM
natali-rs1985 claimed this task.
natali-rs1985 changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.