Otherwise we end up with a bad container fstab and a container that won't boot. See https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/879052
Signed-off-by: Serge Hallyn <serge.hal...@canonical.com> --- templates/lxc-ubuntu.in | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index 9a41a49..f92c695 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -331,20 +331,21 @@ do_bindhome() rootfs=$1 user=$2 - # bind-mount the user's path into the container's /home - h=`getent passwd $user | cut -d: -f 6` - mkdir -p $rootfs/$h - echo "$h $rootfs/$h none bind 0 0" >> $path/fstab - # copy /etc/passwd, /etc/shadow, and /etc/group entries into container pwd=`getent passwd $user` if [ $? -ne 0 ]; then echo 'Warning: failed to copy password entry for $user' + return else echo $pwd >> $rootfs/etc/passwd fi shad=`getent shadow $user` echo $shad >> $rootfs/etc/shadow + + # bind-mount the user's path into the container's /home + h=`getent passwd $user | cut -d: -f 6` + mkdir -p $rootfs/$h + echo "$h $rootfs/$h none bind 0 0" >> $path/fstab } clean() @@ -437,6 +438,13 @@ do esac done +pwd=`getent passwd $bindhome` +if [ $? -ne 0 ]; then + echo "Error: no password entry found for $bindhome" + exit 1 +fi + + if [ "$arch" == "i686" ]; then arch=i386 fi -- 1.7.5.4 ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev _______________________________________________ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users