diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index 7772d47f019..00983d96c15 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -33,6 +33,7 @@ - Support for linux/arm64 {pull}23479[23479] - Skip top level files when unziping archive during upgrade {pull}23456[23456] - Do not take ownership of Endpoint log path {pull}23444[23444] +- Fixed fetching DBus service PID {pull}23496[23496] - Fix issue of missing log messages from filebeat monitor {pull}23514[23514] ==== New features diff --git a/x-pack/elastic-agent/pkg/agent/application/upgrade/service.go b/x-pack/elastic-agent/pkg/agent/application/upgrade/service.go index 2c21d020f8b..097fabb6855 100644 --- a/x-pack/elastic-agent/pkg/agent/application/upgrade/service.go +++ b/x-pack/elastic-agent/pkg/agent/application/upgrade/service.go @@ -171,7 +171,12 @@ func (p *dbusPidProvider) Close() { } func (p *dbusPidProvider) PID(ctx context.Context) (int, error) { - prop, err := p.dbusConn.GetServiceProperty(install.ServiceName, "MainPID") + sn := install.ServiceName + if !strings.HasSuffix(sn, ".service") { + sn += ".service" + } + + prop, err := p.dbusConn.GetServiceProperty(sn, "MainPID") if err != nil { return 0, errors.New("failed to read service", err) }