mirror of
https://github.com/kairos-io/immucore.git
synced 2025-04-27 11:12:30 +00:00
Add timeout wait for sysroot (#278)
This commit is contained in:
parent
b4654ffb47
commit
b9fe50bf84
@ -89,7 +89,9 @@ The immutable rootfs can be configured with the following kernel parameters:
|
|||||||
|
|
||||||
* `rd.immucore.debug`: Enables debug logging
|
* `rd.immucore.debug`: Enables debug logging
|
||||||
|
|
||||||
* `rd.immucore.uki`: Enables UKI booting (Experimental)
|
* `rd.immucore.uki`: Enables UKI booting
|
||||||
|
|
||||||
|
* `rd.immucore.sysrootwait=<seconds>`: Waits for the sysroot to be mounted up to <seconds> before continuing with the boot process. This is useful when booting from CD/Netboot as immucore doesn't mount the /sysroot in those cases, but we want to run the initramfs stage once the system is ready. Sometimes dracut can be really slow and the default 1 minute of waiting is not enough. In those cases you can increase this value to wait more time. Defaults to 60s.
|
||||||
|
|
||||||
|
|
||||||
### Configuration with an environment file
|
### Configuration with an environment file
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cnst "github.com/kairos-io/immucore/internal/constants"
|
cnst "github.com/kairos-io/immucore/internal/constants"
|
||||||
@ -119,7 +120,18 @@ func (s *State) MountRootDagStep(g *herd.Graph) error {
|
|||||||
func (s *State) WaitForSysrootDagStep(g *herd.Graph) error {
|
func (s *State) WaitForSysrootDagStep(g *herd.Graph) error {
|
||||||
return g.Add(cnst.OpWaitForSysroot,
|
return g.Add(cnst.OpWaitForSysroot,
|
||||||
herd.WithCallback(func(ctx context.Context) error {
|
herd.WithCallback(func(ctx context.Context) error {
|
||||||
cc := time.After(60 * time.Second)
|
var timeout = 60 * time.Second
|
||||||
|
timeoutArg := internalUtils.CleanupSlice(internalUtils.ReadCMDLineArg("rd.immucore.sysrootwait="))
|
||||||
|
if len(timeoutArg) > 0 {
|
||||||
|
atoi, err := strconv.Atoi(timeoutArg[0])
|
||||||
|
if err == nil && atoi > 0 {
|
||||||
|
timeout = time.Duration(atoi) * time.Second
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internalUtils.Log.Debug().Str("timeout", timeout.String()).Msg("Waiting for sysroot")
|
||||||
|
|
||||||
|
cc := time.After(timeout)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user