mirror of
https://github.com/kairos-io/immucore.git
synced 2025-08-18 14:17:06 +00:00
Set basic /run mount from the start to be able to always log (#154)
This commit is contained in:
parent
7fe9afa409
commit
a1710b8589
@ -26,7 +26,7 @@ func SetLogger() {
|
|||||||
loggers = append(loggers, zerolog.ConsoleWriter{Out: logFile})
|
loggers = append(loggers, zerolog.ConsoleWriter{Out: logFile})
|
||||||
}
|
}
|
||||||
|
|
||||||
loggers = append(loggers, zerolog.ConsoleWriter{Out: os.Stderr})
|
loggers = append(loggers, zerolog.NewConsoleWriter())
|
||||||
|
|
||||||
multi := zerolog.MultiLevelWriter(loggers...)
|
multi := zerolog.MultiLevelWriter(loggers...)
|
||||||
level = zerolog.InfoLevel
|
level = zerolog.InfoLevel
|
||||||
|
@ -194,15 +194,19 @@ func Fsck(device string) error {
|
|||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
// MountProc will mount /proc
|
// MountBasic will mount /proc and /run
|
||||||
// For now proc is needed to read the cmdline fully in uki mode
|
// For now proc is needed to read the cmdline fully in uki mode
|
||||||
// in normal modes this should already be done by the initramfs process, so we can skip this.
|
// in normal modes this should already be done by the initramfs process, so we can skip this.
|
||||||
func MountProc() {
|
// /run is needed to start logging from the start
|
||||||
|
func MountBasic() {
|
||||||
_ = os.MkdirAll("/proc", 0755)
|
_ = os.MkdirAll("/proc", 0755)
|
||||||
if !IsMounted("/proc") {
|
if !IsMounted("/proc") {
|
||||||
_ = syscall.Mount("proc", "/proc", "proc", syscall.MS_NOSUID|syscall.MS_NODEV|syscall.MS_NOEXEC|syscall.MS_RELATIME, "")
|
_ = syscall.Mount("proc", "/proc", "proc", syscall.MS_NOSUID|syscall.MS_NODEV|syscall.MS_NOEXEC|syscall.MS_RELATIME, "")
|
||||||
}
|
}
|
||||||
|
_ = os.MkdirAll("/run", 0755)
|
||||||
|
if !IsMounted("/run") {
|
||||||
|
_ = syscall.Mount("tmpfs", "/run", "tmpfs", syscall.MS_NOSUID|syscall.MS_NODEV|syscall.MS_NOEXEC|syscall.MS_RELATIME, "mode=755")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOemTimeout parses the cmdline to get the oem timeout to use. Defaults to 5 (converted into seconds afterwards).
|
// GetOemTimeout parses the cmdline to get the oem timeout to use. Defaults to 5 (converted into seconds afterwards).
|
||||||
|
2
main.go
2
main.go
@ -22,7 +22,7 @@ func main() {
|
|||||||
var targetDevice, targetImage string
|
var targetDevice, targetImage string
|
||||||
var state *mount.State
|
var state *mount.State
|
||||||
|
|
||||||
utils.MountProc()
|
utils.MountBasic()
|
||||||
utils.SetLogger()
|
utils.SetLogger()
|
||||||
|
|
||||||
v := version.Get()
|
v := version.Get()
|
||||||
|
@ -403,13 +403,6 @@ func (s *State) UKIMountBaseSystem(g *herd.Graph) error {
|
|||||||
func(ctx context.Context) error {
|
func(ctx context.Context) error {
|
||||||
var err error
|
var err error
|
||||||
mounts := []mount{
|
mounts := []mount{
|
||||||
{
|
|
||||||
"/run",
|
|
||||||
"tmpfs",
|
|
||||||
"tmpfs",
|
|
||||||
syscall.MS_NOSUID | syscall.MS_NODEV | syscall.MS_NOEXEC | syscall.MS_RELATIME,
|
|
||||||
"mode=755",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"/sys",
|
"/sys",
|
||||||
"sysfs",
|
"sysfs",
|
||||||
@ -438,6 +431,7 @@ func (s *State) UKIMountBaseSystem(g *herd.Graph) error {
|
|||||||
err = multierror.Append(err, e)
|
err = multierror.Append(err, e)
|
||||||
internalUtils.Log.Err(e).Msg("Creating dir")
|
internalUtils.Log.Err(e).Msg("Creating dir")
|
||||||
}
|
}
|
||||||
|
|
||||||
e = syscall.Mount(m.what, m.where, m.fs, m.flags, m.data)
|
e = syscall.Mount(m.what, m.where, m.fs, m.flags, m.data)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
err = multierror.Append(err, e)
|
err = multierror.Append(err, e)
|
||||||
|
Loading…
Reference in New Issue
Block a user