diff --git a/pkg/config/spec.go b/pkg/config/spec.go index 8526583..937261b 100644 --- a/pkg/config/spec.go +++ b/pkg/config/spec.go @@ -523,12 +523,27 @@ func NewUkiResetSpec(cfg *Config) (spec *v1.ResetUkiSpec, err error) { spec.Partitions.Persistent = partitions.GetPartitionViaDM(cfg.Fs, constants.PersistentLabel) spec.Partitions.OEM = partitions.GetPartitionViaDM(cfg.Fs, constants.OEMLabel) + // Get EFI partition + parts, err := partitions.GetAllPartitions() + if err != nil { + return spec, fmt.Errorf("could not read host partitions") + } + for _, p := range parts { + if p.FilesystemLabel == constants.EfiLabel { + spec.Partitions.EFI = p + break + } + } + if spec.Partitions.Persistent == nil { return spec, fmt.Errorf("persistent partition not found") } if spec.Partitions.OEM == nil { return spec, fmt.Errorf("oem partition not found") } + if spec.Partitions.EFI == nil { + return spec, fmt.Errorf("efi partition not found") + } // Fill oem partition err = unmarshallFullSpec(cfg, "reset", spec) diff --git a/pkg/uki/reset.go b/pkg/uki/reset.go index 26dba56..40db03e 100644 --- a/pkg/uki/reset.go +++ b/pkg/uki/reset.go @@ -58,6 +58,13 @@ func (r *ResetAction) Run() (err error) { } } + // REMOUNT /efi as RW (its RO by default) + umount, err := e.MountRWPartition(r.spec.Partitions.EFI) + if err != nil { + return err + } + cleanup.Push(umount) + // Copy "recovery" to "active" err = overwriteArtifactSetRole(r.cfg.Fs, constants.UkiEfiDir, "recovery", "active", r.cfg.Logger) if err != nil {