Skip to content

Commit

Permalink
fix: remove listening socket to fix Talos in a container restart
Browse files Browse the repository at this point in the history
Fixes #4462

As `/system` volumes survives restarts in a container mode, we need to
make sure listening file socket is removed before creating a listener.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
(cherry picked from commit f6110f8)
  • Loading branch information
smira authored and Unix4ever committed Nov 2, 2021
1 parent 2698679 commit a937e6f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/app/machined/pkg/system/services/apid.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a937e6f

Please sign in to comment.