Sometimes lxc-slackware breaks due to erroneously created ${DEV}/null file
by crts from LinuxQuestions.org on (#4VKB6)
Some packages may redirect stderr to /dev/null during container creation. When the script tries to execute
Code:mknod -m 666 ${DEV}/null c 1 3in the configuration stage it will abort with an error. This patch mitigates the problem.
Code:--- lxc-slackware.org 2019-11-24 10:50:33.428626035 +0100
+++ lxc-slackware.mod 2019-11-24 11:02:37.717571177 +0100
@@ -90,6 +90,12 @@
# http://www.vislab.uq.edu.au/howto/lxc/MAKEDEV.sh
DEV=$rootfs/dev
mkdir -p ${DEV}
+
+# Some install scripts may have redirected stderr to
+# /dev/null and thus created a file named /dev/null.
+# It must be removed before attempting to create
+# the device /dev/null.
+[[ -e ${DEV}/null ]] && rm -rf ${DEV}/null
mknod -m 666 ${DEV}/null c 1 3
mknod -m 666 ${DEV}/zero c 1 5
mknod -m 666 ${DEV}/random c 1 8PS:
I am aware that the test '[[ -e ${DEV}/null ]]' is probably redundant and that I am overly cautious here.


Code:mknod -m 666 ${DEV}/null c 1 3in the configuration stage it will abort with an error. This patch mitigates the problem.
Code:--- lxc-slackware.org 2019-11-24 10:50:33.428626035 +0100
+++ lxc-slackware.mod 2019-11-24 11:02:37.717571177 +0100
@@ -90,6 +90,12 @@
# http://www.vislab.uq.edu.au/howto/lxc/MAKEDEV.sh
DEV=$rootfs/dev
mkdir -p ${DEV}
+
+# Some install scripts may have redirected stderr to
+# /dev/null and thus created a file named /dev/null.
+# It must be removed before attempting to create
+# the device /dev/null.
+[[ -e ${DEV}/null ]] && rm -rf ${DEV}/null
mknod -m 666 ${DEV}/null c 1 3
mknod -m 666 ${DEV}/zero c 1 5
mknod -m 666 ${DEV}/random c 1 8PS:
I am aware that the test '[[ -e ${DEV}/null ]]' is probably redundant and that I am overly cautious here.