Bug#746570: live-build: chroot image contains /etc/mtab as a regular file
reopen 746570
found 746570 4.0~alpha37-1
tags 746570 + patch
thanks
On Thu, 01 May 2014 at 15:31:36 +0100, Simon McVittie wrote:
> At the time that *.hook.chroot run, /etc/mtab is a regular file.
> Since wheezy, Debian has preferred it to be a symlink to /proc/mounts
On Wed, 07 May 2014 at 19:57:13 +0000, Debian Bug Tracking System wrote:
> Version: 4.0~alpha37-1
>
> this has been fixed in above version.
Unfortunately, the change in 4.0~alpha37-1 was not sufficient in all cases.
In the wheezy-based images I'm building, /etc/mtab is created as a regular
file during the build process, so "ln -s" fails.
I attach a patch which works. With a bit of extra debug added, it does this:
[2014-06-18 14:38:18] lb chroot-hooks --verbose
mtab before replacement:
-rw-r--r-- 1 root root 76 Jun 18 13:37 /etc/mtab
mtab after replacement:
lrwxrwxrwx 1 root root 10 Jun 18 13:38 /etc/mtab -> /proc/mtab
demonstrating that it is necessary, and that it replaces the file with
a symlink as desired.
Regards,
S
>From 7a1ae72804e133cd2c1097f7e0d70caa0cb7bd4f Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Wed, 18 Jun 2014 14:00:40 +0100
Subject: [PATCH] If /etc/mtab exists as a file, replace it with a symlink
(Closes: #746570)
---
share/hooks/0020-create-mtab-symlink.hook.chroot | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/share/hooks/0020-create-mtab-symlink.hook.chroot b/share/hooks/0020-create-mtab-symlink.hook.chroot
index 0cae147..68587a5 100755
--- a/share/hooks/0020-create-mtab-symlink.hook.chroot
+++ b/share/hooks/0020-create-mtab-symlink.hook.chroot
@@ -2,9 +2,10 @@
set -e
-# Create /etc/mtab symlink
+# Create /etc/mtab symlink, replacing a regular file if necessary
if [ ! -L /etc/mtab ]
then
+ rm -f /etc/mtab
ln -s /proc/mtab /etc/mtab
fi
--
2.0.0
Reply to: