diff --git a/internal/app/machined/pkg/system/services/apid.go b/internal/app/machined/pkg/system/services/apid.go index 31bd2aa06..dcad69db6 100644 --- a/internal/app/machined/pkg/system/services/apid.go +++ b/internal/app/machined/pkg/system/services/apid.go @@ -72,6 +72,11 @@ func (o *APID) PreFunc(ctx context.Context, r runtime.Runtime) error { return err } + // clean up the socket if it already exists (important for Talos in a container) + if err := os.RemoveAll(constants.APIRuntimeSocketPath); err != nil { + return err + } + listener, err := net.Listen("unix", constants.APIRuntimeSocketPath) if err != nil { return err