lima-vm / lima-vm/lima

Rocky10: systemd-resolved.service: Unit systemd-resolved.service not found

Open
#5,490 2 comments 0 reactions 0 assignees Claimed by @Soumya-codr View on GitHub
bug guest/el10
Dominant language
Go
Stars
21.9k
Forks
957
Avg merge
2d 6h
Merged PRs (30d)
53

Description

### Description

When launching the `rocky-10` template cloud-init fails with this error:

```
status: error
extended_status: error - done
boot_status_code: enabled-by-generator
last_update: Thu, 01 Jan 1970 00:01:21 +0000
detail: DataSourceNoCloud [seed=/dev/vdb]
errors:
- ('scripts_per_boot', RuntimeError('Runparts: 1 failures (00-lima.boot.sh) in 1 attempted commands'))
recoverable_errors:
DEPRECATED:
- Deprecated cloud-config provided: users.0.ssh-authorized-keys: Deprecated in version 18.3. Use **ssh_authorized_keys** instead., users.0.uid: Changed in version 22.3. The use of ``string`` type is deprecated. Use an ``integer`` instead.
WARNING:
- Failed to run module scripts_per_boot (per-boot in /var/lib/cloud/scripts/per-boot)
- Running module scripts_per_boot () failed
```

Digging deeper in the cloud init logs I've found this:
```
+ systemctl restart systemd-resolved.service
Failed to restart systemd-resolved.service: Unit systemd-resolved.service not found.
```

I've done a root-cause analysis on this and found the following:
https://github.com/lima-vm/lima/blob/1973a8c6801e172ee89bc3d998cd1c5ea60a9235/pkg/cidata/cidata.TEMPLATE.d/boot.Linux/06-enable-mdns-on-systemd.sh#L13-L15

This code assumes resolvectl is installed with systemd-resolved package, but on rocky it is installed with the systemd package.

An additional check like `systemctl cat systemd-resolved.service >/dev/null 2>&1 || exit 0` would make the script work properly.

Command to reproduce:

```
limactl start template:rocky-10
```

Contributor guide

Open the contributing guide

Research direction

Start with pkg/cidata/cidata.TEMPLATE.d/boot.Linux/06-enable-mdns-on-systemd.sh, especially the systemctl restart and resolvectl checks, and reproduce with limactl start template:rocky-10. The fix is done when Rocky 10 no longer fails cloud-init because systemd-resolved.service is absent, while the script still handles systems that provide the service.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, shell
Domain
devops, operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.