]> git.proxmox.com Git - pve-container.git/commitdiff
fix issue where ttys aren't correctly set after restore
authorOguz Bektas <o.bektas@proxmox.com>
Fri, 13 Sep 2019 10:35:57 +0000 (12:35 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 14 Nov 2019 17:30:28 +0000 (18:30 +0100)
restore from unpriv to priv causes a problem with the log-in from web
console, since the /etc/securetty file isn't modified after a restore to
reflect that change (/dev/lxc/tty1 and so on).

template_fixup is normally called in post_create_hook, but we have no
$password or $ssh_keys to call the hook with during the restore. instead
we call template_fixup by itself to fix the ttys on some distributions.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
(cherry picked from commit 4b4bbe553bebac2fbc179616c90594eed275b07e)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/API2/LXC.pm

index 26c4f8800a8cf4e60c5a2be370463a4c08fe1e56..83ddd084d78c4fe20fd07bf50a5cc5f0c5c2dd36 100644 (file)
@@ -415,6 +415,8 @@ __PACKAGE__->register_method({
 
                    if ($restore) {
                        PVE::LXC::Create::restore_configuration($vmid, $rootdir, $conf, !$is_root, $unique, $skip_fw_config_restore);
+                       my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir);
+                       $lxc_setup->template_fixup($conf);
                    } else {
                        my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir); # detect OS
                        PVE::LXC::Config->write_config($vmid, $conf); # safe config (after OS detection)