(container string)
| 1005 | } |
| 1006 | |
| 1007 | func startContainer(container string) error { |
| 1008 | var stderr strings.Builder |
| 1009 | if err := podman.Start(container, &stderr); err == nil { |
| 1010 | return nil |
| 1011 | } |
| 1012 | |
| 1013 | errString := stderr.String() |
| 1014 | if !strings.Contains(errString, "use system migrate to mitigate") { |
| 1015 | return fmt.Errorf("failed to start container %s", container) |
| 1016 | } |
| 1017 | |
| 1018 | ociRuntimeRequired := "runc" |
| 1019 | if cgroupsVersion == 2 { |
| 1020 | ociRuntimeRequired = "crun" |
| 1021 | } |
| 1022 | |
| 1023 | logrus.Debugf("Migrating containers to OCI runtime %s", ociRuntimeRequired) |
| 1024 | |
| 1025 | if err := podman.SystemMigrate(ociRuntimeRequired); err != nil { |
| 1026 | var builder strings.Builder |
| 1027 | fmt.Fprintf(&builder, "failed to migrate containers to OCI runtime %s\n", ociRuntimeRequired) |
| 1028 | fmt.Fprintf(&builder, "Factory reset with: podman system reset") |
| 1029 | |
| 1030 | errMsg := builder.String() |
| 1031 | return errors.New(errMsg) |
| 1032 | } |
| 1033 | |
| 1034 | if err := podman.Start(container, nil); err != nil { |
| 1035 | var builder strings.Builder |
| 1036 | fmt.Fprintf(&builder, "container %s doesn't support cgroups v%d\n", container, cgroupsVersion) |
| 1037 | fmt.Fprintf(&builder, "Factory reset with: podman system reset") |
| 1038 | |
| 1039 | errMsg := builder.String() |
| 1040 | return errors.New(errMsg) |
| 1041 | } |
| 1042 | |
| 1043 | return nil |
| 1044 | } |
| 1045 | |
| 1046 | func startP11KitServer() ([]string, error) { |
| 1047 | serverSocket, err := utils.GetP11KitServerSocket(currentUser) |
no outgoing calls
no test coverage detected
searching dependent graphs…