]> git.proxmox.com Git - pve-container.git/commitdiff
protected_call: remove left-over rootdir/dev mkdir
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 9 Sep 2020 17:31:51 +0000 (19:31 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 9 Sep 2020 18:54:57 +0000 (20:54 +0200)
commit 797e12e8a5df246d8afc53b045e632977cdf0088 got rid of our "just
bind-mount the root /dev to the CT temporarily for some stuff" for
good a while ago (2015), but creating the /dev directory in the CT
root was kept, from what I can tell, by mistake.

This can be a problem if, whyever, the CT rootfs is not mounted, as
we then break a future mount as we create this /dev directory inside
what would be the CTs rootfs mount point. It is then not empty
anymore and a normal mount cannot happen, failing with "directory is
not empty"

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/LXC/Setup.pm

index d424aaac0464acb1fe04361b00e69b561ec27dda..fb0be37dee3593fe241aef6d3d4d7b5be8ae2ddb 100644 (file)
@@ -134,11 +134,6 @@ sub protected_call {
     # avoid recursion:
     return $sub->() if $self->{in_chroot};
 
-    my $rootdir = $self->{rootdir};
-    if (!-d "$rootdir/dev" && !mkdir("$rootdir/dev")) {
-       die "failed to create temporary /dev directory: $!\n";
-    }
-
     pipe(my $res_in, my $res_out) or die "pipe failed: $!\n";
 
     my $child = fork();
@@ -149,6 +144,7 @@ sub protected_call {
        # avoid recursive forks
        $self->{in_chroot} = 1;
        eval {
+           my $rootdir = $self->{rootdir};
            chroot($rootdir) or die "failed to change root to: $rootdir: $!\n";
            chdir('/') or die "failed to change to root directory\n";
            my $res = $sub->();