Skip to content

google-guest-agent logs error on Ubuntu 24.04 saying it failed to restart sshd.service after successfully restarting ssh.service #467

@Ankush-Pathak

Description

@Ankush-Pathak

google-guest-agent.service reports the following error on Ubuntu 24.04 (noble)

ERROR oslogin.go:163 Error reloading service: Failed to reload-or-restart sshd.service: Unit sshd.service not found..

This error can be slightly misleading, as google-guest-agent.service still restarts ssh.service successfully before attempting to restart sshd.service. See code.

sshd.service is not loaded on Ubuntu 24.04 due to bug LP #2087949. sshd.service is just an alias to ssh.service. So technically, sshd.service exists but is not loaded.

$ systemctl list-units --all sshd.service
  UNIT         LOAD      ACTIVE   SUB  DESCRIPTION 
● sshd.service not-found inactive dead sshd.service

Legend: LOAD   → Reflects whether the unit definition was properly loaded.
        ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
        SUB    → The low-level unit activation state, values depend on unit type.

1 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.

Given google-guest-agent.service tries to skip restarting services that do not exist, perhaps it should also skip restarting services that failed to load as a way to avoid logging the error mentioned above. Or maybe log an error only if it fails to restart both ssh.service and sshd.service in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions