mirror of https://github.com/containers/podman.git
Merge pull request #4541 from giuseppe/use-file-backend-no-systemd
config: use EventsLogger=file without systemd
This commit is contained in:
commit
63924775ba
|
|
@ -469,6 +469,9 @@ func NewConfig(userConfigPath string) (*Config, error) {
|
||||||
if defaultConfig, err := defaultConfigFromMemory(); err != nil {
|
if defaultConfig, err := defaultConfigFromMemory(); err != nil {
|
||||||
return nil, errors.Wrapf(err, "error generating default config from memory")
|
return nil, errors.Wrapf(err, "error generating default config from memory")
|
||||||
} else {
|
} else {
|
||||||
|
// Check if we need to switch to cgroupfs and logger=file on rootless.
|
||||||
|
defaultConfig.checkCgroupsAndLogger()
|
||||||
|
|
||||||
if err := config.mergeConfig(defaultConfig); err != nil {
|
if err := config.mergeConfig(defaultConfig); err != nil {
|
||||||
return nil, errors.Wrapf(err, "error merging default config from memory")
|
return nil, errors.Wrapf(err, "error merging default config from memory")
|
||||||
}
|
}
|
||||||
|
|
@ -487,9 +490,6 @@ func NewConfig(userConfigPath string) (*Config, error) {
|
||||||
return nil, errors.Wrapf(define.ErrInvalidArg, "volume path must be an absolute path - instead got %q", config.VolumePath)
|
return nil, errors.Wrapf(define.ErrInvalidArg, "volume path must be an absolute path - instead got %q", config.VolumePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we need to switch to cgroupfs on rootless.
|
|
||||||
config.checkCgroupsAndAdjustConfig()
|
|
||||||
|
|
||||||
return config, nil
|
return config, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -524,11 +524,13 @@ func systemConfigs() ([]string, error) {
|
||||||
return configs, nil
|
return configs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkCgroupsAndAdjustConfig checks if we're running rootless with the systemd
|
// checkCgroupsAndLogger checks if we're running rootless with the systemd
|
||||||
// cgroup manager. In case the user session isn't available, we're switching the
|
// cgroup manager. In case the user session isn't available, we're switching the
|
||||||
// cgroup manager to cgroupfs. Note, this only applies to rootless.
|
// cgroup manager to cgroupfs and the events logger backend to 'file'.
|
||||||
func (c *Config) checkCgroupsAndAdjustConfig() {
|
// Note, this only applies to rootless.
|
||||||
if !rootless.IsRootless() || c.CgroupManager != define.SystemdCgroupsManager {
|
func (c *Config) checkCgroupsAndLogger() {
|
||||||
|
if !rootless.IsRootless() || (c.CgroupManager !=
|
||||||
|
define.SystemdCgroupsManager && c.EventsLogger == "file") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -543,7 +545,8 @@ func (c *Config) checkCgroupsAndAdjustConfig() {
|
||||||
logrus.Warningf("The cgroups manager is set to systemd but there is no systemd user session available")
|
logrus.Warningf("The cgroups manager is set to systemd but there is no systemd user session available")
|
||||||
logrus.Warningf("For using systemd, you may need to login using an user session")
|
logrus.Warningf("For using systemd, you may need to login using an user session")
|
||||||
logrus.Warningf("Alternatively, you can enable lingering with: `loginctl enable-linger %d` (possibly as root)", rootless.GetRootlessUID())
|
logrus.Warningf("Alternatively, you can enable lingering with: `loginctl enable-linger %d` (possibly as root)", rootless.GetRootlessUID())
|
||||||
logrus.Warningf("Falling back to --cgroup-manager=cgroupfs")
|
logrus.Warningf("Falling back to --cgroup-manager=cgroupfs and --events-backend=file")
|
||||||
c.CgroupManager = define.CgroupfsCgroupsManager
|
c.CgroupManager = define.CgroupfsCgroupsManager
|
||||||
|
c.EventsLogger = "file"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue