Skip to content

Commit

Permalink
Fixed: Under Ubuntu Xenial, /etc/mtab is a symlink to /proc/self/mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxwin committed Dec 30, 2016
1 parent 9d5a09e commit d543e53
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions autoinstaller/Adapter/UbuntuAdapter.pm
Expand Up @@ -78,7 +78,7 @@ sub _init

=item _updateSystemMTAB()
Ensure that /etc/mtab file is a symlink to /proc/mounts
Ensure that /etc/mtab file is a symlink to /proc/mounts or /proc/self/mounts
See #IP-1679
Expand All @@ -88,13 +88,16 @@ sub _init

sub _updateSystemMTAB
{
return 0 if -l '/etc/mtab' && readlink('/etc/mtab') eq '/proc/mounts';
if (-l '/etc/mtab') {
my $resolved = readlink('/etc/mtab');
return 0 if $resolved eq '/proc/mounts' || $resolved eq '/proc/self/mounts';
}

if (-l _) {
unlink '/etc/mtab' or die(sprintf('Could not remove default system /etc/mtab symlink: %s', $!));
} else {
rename('/etc/mtab', '/etc/mtab.DIST') or die(
sprintf('Could not rename default system /etc/mtab to /etc/mtab.DIST: %s', $!)
sprintf('Could not rename default system /etc/mtab file to /etc/mtab.DIST: %s', $!)
);
}

Expand Down

0 comments on commit d543e53

Please sign in to comment.