From a34dbdc53ff8e06f696730e084f2133408b2a567 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 6 Sep 2023 15:13:38 +0200 Subject: [PATCH] [v3.4] system reset: show graphRoot/runRoot before removal Backport of commit 6aaf6a28435c. system reset it says it will delete containers, images, networks, etc... However it will also delete the graphRoot and runRoot directories. Normally this is not an issue, however in same cases these directories were set to the users home directory or some other important system directory. As first step simply show the directories that are configured and thus will be deleted by reset. As future step we could implement some safeguard will will not delete some known important directories however I tried to keep it simple for now. [NO NEW TESTS NEEDED] see #18349, #18295, and #19870 Signed-off-by: Valentin Rothberg --- cmd/podman/system/reset.go | 7 +++++++ docs/source/markdown/podman-system-reset.1.md | 2 ++ 2 files changed, 9 insertions(+) diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go index 8a05bb09f5..d2385c8a98 100644 --- a/cmd/podman/system/reset.go +++ b/cmd/podman/system/reset.go @@ -1,3 +1,4 @@ +//go:build !remote // +build !remote package system @@ -61,6 +62,12 @@ WARNING! This will remove: - all pods - all images - all build cache`) + info, _ := registry.ContainerEngine().Info(registry.Context()) + // lets not hard fail in case of an error + if info != nil { + fmt.Printf(" - the graphRoot directory: %q\n", info.Store.GraphRoot) + fmt.Printf(" - the runRoot directory: %q\n", info.Store.RunRoot) + } if len(listCtn) > 0 { fmt.Println(`WARNING! The following external containers will be purged:`) // print first 12 characters of ID and first configured name alias diff --git a/docs/source/markdown/podman-system-reset.1.md b/docs/source/markdown/podman-system-reset.1.md index 744f917df5..86e7c730ca 100644 --- a/docs/source/markdown/podman-system-reset.1.md +++ b/docs/source/markdown/podman-system-reset.1.md @@ -12,6 +12,8 @@ podman\-system\-reset - Reset storage back to initial state This command must be run **before** changing any of the following fields in the `containers.conf` or `storage.conf` files: `driver`, `static_dir`, `tmp_dir` or `volume_path`. +It also removes the configured graphRoot and runRoot directories. Make sure +these are not set to some important directory. `podman system reset` reads the current configuration and attempts to remove all of the relevant configurations. If the administrator modified the configuration files first,