mirror of
https://github.com/kairos-io/immucore.git
synced 2025-08-18 14:17:06 +00:00
Run udevadm trigger after mounting loop device
So the devices get refreshed and they show up under /dev/disk/by-label Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
parent
ad014e9f22
commit
4cfe5e764d
@ -61,7 +61,6 @@ func (s *State) MountRootDagStep(g *herd.Graph) error {
|
|||||||
herd.WithDeps(cnst.OpMountState),
|
herd.WithDeps(cnst.OpMountState),
|
||||||
herd.WithCallback(
|
herd.WithCallback(
|
||||||
func(ctx context.Context) error {
|
func(ctx context.Context) error {
|
||||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Logger()
|
|
||||||
// Check if loop device is mounted by checking the existance of the target label
|
// Check if loop device is mounted by checking the existance of the target label
|
||||||
if internalUtils.IsMountedByLabel(s.TargetLabel) {
|
if internalUtils.IsMountedByLabel(s.TargetLabel) {
|
||||||
log.Logger.Debug().Str("targetImage", s.TargetImage).Str("path", s.Rootdir).Str("TargetLabel", s.TargetLabel).Msg("Not mounting loop, already mounted")
|
log.Logger.Debug().Str("targetImage", s.TargetImage).Str("path", s.Rootdir).Str("TargetLabel", s.TargetLabel).Msg("Not mounting loop, already mounted")
|
||||||
@ -70,9 +69,13 @@ func (s *State) MountRootDagStep(g *herd.Graph) error {
|
|||||||
// TODO: squashfs recovery image?
|
// TODO: squashfs recovery image?
|
||||||
cmd := fmt.Sprintf("losetup --show -f %s", s.path("/run/initramfs/cos-state", s.TargetImage))
|
cmd := fmt.Sprintf("losetup --show -f %s", s.path("/run/initramfs/cos-state", s.TargetImage))
|
||||||
_, err := utils.SH(cmd)
|
_, err := utils.SH(cmd)
|
||||||
if err != nil {
|
s.LogIfError(err, "losetup")
|
||||||
log.Logger.Debug().Err(err).Msg("")
|
// Trigger udevadm
|
||||||
}
|
// On some systems the COS_ACTIVE/PASSIVE label is automatically shown as soon as we mount the device
|
||||||
|
// But on other it seems like it won't trigger which causes the sysroot to not be mounted as we cant find
|
||||||
|
// the block device by the target label. Make sure we run this after mounting so we refresh the devices.
|
||||||
|
sh, _ := utils.SH("udevadm trigger --settle")
|
||||||
|
s.Logger.Debug().Str("output", sh).Msg("udevadm trigger")
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
Loading…
Reference in New Issue
Block a user