[pve-devel] [PATCH v4 container 1/2] fix #3313: recover unprivileged bit from old config during pct restore

Oguz Bektas o.bektas at proxmox.com
Thu Feb 25 15:11:16 CET 2021

since pct defaults to privileged containers, it restores the container
as privileged when `--unprivileged 1` is not passed.

instead we should check the old configuration and retrieve it from

this way, when one creates an unprivileged container on GUI, it will be
still restored as unprivileged via pct (without having to pass

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>

* split

 src/PVE/API2/LXC.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 8ce462f..04456a8 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -362,6 +362,9 @@ __PACKAGE__->register_method({
 			# 'lxc.idmap' entries. We need to make sure that the extracted contents
 			# of the container match up with the restored configuration afterwards:
 			$conf->{lxc} = $orig_conf->{lxc};
+			$conf->{unprivileged} = $orig_conf->{unprivileged}
+			    if !defined($unprivileged) && defined($orig_conf->{unprivileged});
 		if ($storage_only_mode) {

More information about the pve-devel mailing list