summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-09-03 11:03:58 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-09-03 13:46:48 +0200
commitcfe1d2768847929b44ddd10184eff28fd5762c2d (patch)
tree779996dc578612776a8c13c3a9983668eb96738a /cmd/podman
parent099549bd38c2b39fb884c8e9aecdf4e44c90b484 (diff)
downloadpodman-cfe1d2768847929b44ddd10184eff28fd5762c2d.tar.gz
podman-cfe1d2768847929b44ddd10184eff28fd5762c2d.tar.bz2
podman-cfe1d2768847929b44ddd10184eff28fd5762c2d.zip
rootless: detect user namespace configuration changes
detect if the current user namespace doesn't match the configuration in the /etc/subuid and /etc/subgid files. If there is a mismatch, raise a warning and suggest the user to recreate the user namespace with "system migrate", that also restarts the containers. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/main_local.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go
index 648dc166e..0feba609b 100644
--- a/cmd/podman/main_local.go
+++ b/cmd/podman/main_local.go
@@ -120,6 +120,14 @@ func profileOff(cmd *cobra.Command) error {
}
func setupRootless(cmd *cobra.Command, args []string) error {
+ matches, err := rootless.ConfigurationMatches()
+ if err != nil {
+ return err
+ }
+ if !matches {
+ logrus.Warningf("the current user namespace doesn't match the configuration in /etc/subuid or /etc/subgid")
+ logrus.Warningf("you can use `%s system migrate` to recreate the user namespace and restart the containers", os.Args[0])
+ }
if os.Geteuid() == 0 || cmd == _searchCommand || cmd == _versionCommand || cmd == _mountCommand || cmd == _migrateCommand || strings.HasPrefix(cmd.Use, "help") {
return nil
}
@@ -140,7 +148,7 @@ func setupRootless(cmd *cobra.Command, args []string) error {
became, ret, err := rootless.TryJoinFromFilePaths("", false, []string{pausePidPath})
if err != nil {
logrus.Errorf("cannot join pause process. You may need to remove %s and stop all containers", pausePidPath)
- logrus.Errorf("you can use `%s system migrate` to recreate the pause process", os.Args[0])
+ logrus.Errorf("you can use `%s system migrate` to recreate the pause process and restart the containers", os.Args[0])
logrus.Errorf(err.Error())
os.Exit(1)
}