diff --git a/internal/provider/bootstrap.go b/internal/provider/bootstrap.go index e773cbae..ea63b46e 100644 --- a/internal/provider/bootstrap.go +++ b/internal/provider/bootstrap.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "os" "strings" logging "github.com/ipfs/go-log" @@ -197,8 +198,22 @@ func oneTimeBootstrap(l logging.StandardLogger, c *providerConfig.Config, vpnSet } if utils.IsOpenRCBased() { + // Instead of creating an empty file, let's use the one generated by the k3s installer + content, err := os.ReadFile("/etc/init.d/k3s") + if err != nil { + l.Errorf("Failed to read init file: %s", err.Error()) + return err + } + + if len(content) == 0 { + err = fmt.Errorf("empty init file for k3s") + l.Errorf("openrc error: %s", err.Error()) + return err + } + svc, err = openrc.NewService( openrc.WithName(svcName), + openrc.WithUnitContent(string(content)), ) if err != nil { l.Errorf("Failed to create service: %s", err.Error())