Casper Imaging crashing on 10.8.2 netboot image

dbraunschweiger
New Contributor II

I have been using a 10.7.5 netboot image with Casper Imaging 8.62 to image machines, but we recently acquired new Mac minis that will only boot to 10.8.2. I have made a number of different 10.8.2 netboot images, all of which boot fine. However, in the 10.8.2 images, Casper Imaging crashes after 20 - 30 seconds and cannot be re-launched. Has anyone else seen this/have a fix for it?

8 REPLIES 8

johnklimeck
Contributor II

dbraunschweiger,

This could be what a lot us were seeing a few months ago. If it is what I think it is, its Apple's NetBoot with Casper Imaging app. I am assuming the first thing you are doing in your Casper Imaging is erasing "Macintosh" or "Mac HD", and when this happens, Casper Imaging crashes and something in OS X hangs.

Got around this with the RAM Disk trick. If you do a search here at JAMF Nation on RAM disk and NetBoot, I believe you'll find that whole history. I followed the RAM disk modification that was shared and it has worked perfectly. No more Casper Imaging / NetBoot crashes / hangs.

Related to this, still awaiting Apple's GM of 10.8.3 to be released so we can make a "universal" netboot image to netboot the new Ivy Bridge Macs (Mac Minis, iMacs). Since I am part of Apple Dev membership, I have access to the beta builds, 10.8.3 (12D68) does indeed boot these new Macs as well as older models.

As far as making a successful netboot image of 12D68, no luck, does not work. So as I have posted here before, went ahead and made a 12D68 image, but installed it on a TB/ USB / FW drive (with Casper Imaging), and it pushes out a 12D86 (10.8.3) image.

A cool workaround suggested by one of the knowledgeable and kind brethren here on JAMF Nation.

dbraunschweiger
New Contributor II

Found the article you were referencing

http://www.macos.utah.edu/documentation/administration/setup_netboot_service_on_mac_os_x_10.6.x_client.x_client/setup_netboot_service_on_mac_os_x_10.6.x_client-diskless_netboot.html

I tried the fix, however now I am unable to boot to the net boot image at all.

;(

johnklimeck
Contributor II

Yeah, you will have to get a 10.8.2 netboot image that you know successfully netboots to (a not so new Mac). 10.8.2 will not netboot new Mac Minis or iMacs (in my testing).

Once you have that, make the mod to the rc.netboot file.

Also, I think I may have mentioned this in one of those threads, that mod that the University of Utah posted, make sure it is rc.netboot, and not rc.netboot.sh (shell script). Otherwise OS X does not recognize the file.

I still have a copy of my rc.netboot file and the permissions which should be rwxr-xr-x

You will get a little RAM disk icon on the desktop. This allows Disk Utility to grab the Mac HD and partition / erase it, and some of the memory spills over into the RAM disk, otherwise Casper Imaging crashes. I think this will be fixed in Casper 9

dbraunschweiger
New Contributor II

"Yeah, you will have to get a 10.8.2 netboot image that you know successfully netboots to (a not so new Mac). "

The 10.8.2 NetBoot image I'm using WAS able to boot successfully. But after running the "fix" it no longer boots.

johnklimeck
Contributor II

Copy of the rc.netboot file I am using. This may not be the exact file from U of U, it may be modified. But it totally works for us.

Look at the file and you can see if it is modified / varied from the original U of U script, it is working for us.

By the way I am serving this on a Mac OS 10.8.2 Server (may or may not matter).
----
#!/bin/sh
##
# Copyright 2002-2009 Apple Inc.
#
# This script configures NetBoot
##

. /etc/rc.common

#
# This script has been modified to support diskless or RAM disk netboot
#
# Revised: July 14th, 2011
# Revised by: Richard Glaser
#
# For more information or give feedback or file bugs...
# See web site...
#
# http://www.macos.utah.edu/documentation/administration/setup_netboot_service_on_mac_os_x_10.6.x_client.html
#

# # Define: NETBOOT_SHADOW
#
# Purpose:
# To change the behavior of the system when choosing a netboot shadow
# to use.
#
# Values:
# -NETWORK- Try to use the network for the shadow file, if
# that fails, use the local drive
# -NETWORK_ONLY- Only use the network, fail if not available
# -LOCAL- Use the local drive for the shadow file, if that
# fails, use the network
# -LOCAL_ONLY- Only use the local drive for the shadow, fail if
# not available

NETBOOT_MOUNT=/var/netboot

# Change to "-LOCAL_ONLY-" to use RAM Disk instead of network
NETBOOT_SHADOW=-LOCAL_ONLY-

# NETBOOT_SHADOW=${NETBOOT_SHADOW:-NETWORK-}
# There is a bug in the default variable assignment, it loses the the beginning "-"
# So, it never correctly assigns the variable or branch in the case statement in the # do_start() sub-routine and always gets assigned to the "* )" branch.

Failed()
{ echo rc.netboot: $1 echo rc.netboot: $1 > /dev/console sleep 5 exit 1
}

common_start()
{ netboot_dir=$1 netboot_shadow=$2 if [ "${netboot_dir}" = "" ] ; then Failed "netboot_dir is empty" fi if [ "${netboot_shadow}" = "" ] ; then Failed "netboot_shadow is empty" fi netboot_shadow="${netboot_dir}/${netboot_shadow}" if ! mkdir -p "${netboot_dir}" ; then Failed "create ${netboot_dir} failed" fi chmod 700 "${netboot_dir}" mount -u -o ro / root_device=$(mount | sed -n 's:/dev/(.) on / .:1:p') case "${root_device}" in vn*) if ! touch "${netboot_shadow}" ; then Failed "create ${netboot_shadow} failed" fi chmod 600 "${netboot_shadow}" if ! /usr/libexec/vndevice shadow "/dev/r${root_device}" "${netboot_shadow}" ; then Failed "vndevice shadow failed" fi ;; "") Failed "root device unknown" ;; *) if ! touch "${netboot_shadow}" ; then Failed "failed to create shadow ${netboot_shadow}" fi chmod 600 "${netboot_shadow}" if ! /usr/bin/nbdst -recycle "${root_device}" "${netboot_shadow}" ; then Failed "nbdst failed" fi ;; esac
}

local_mount()
{
# tries=0
# limit=11
# while [ $tries -lt $limit ]; do
# tries=$(( tries + 1 ))
# volinfo=autodiskmount -F 2>/dev/null
# if [ $? -ne 0 ]; then
# if [ $tries -lt $limit ]; then
# echo "Waiting for local drives..."
# echo "Waiting for local drives (retry ${tries}/$(( limit - 1 )))..." > /dev/console
# sleep 5
# else
# echo "autodiskmount -F found no local drives"
# return 1
# fi
# else
# tries=$limit
# fi
# done
# set ${volinfo}
# devname=$1
# fstype=$2
#
# mount -t "${fstype}" -o nosuid,nodev "/dev/${devname}" "${NETBOOT_MOUNT}" 2>&1
# if [ $? -ne 0 ]; then
# echo "mount of ${devname} failed"
# return 1
# fi volinfo=autodiskmount -F 2>/dev/null RAMDisk "${NETBOOT_MOUNT}" common_start "${NETBOOT_MOUNT}/.com.apple.NetBootX" shadowfile return 0
}

#
# Create a RAM disk with same perms as mountpoint
#

RAMDisk()
{ mntpt=$1 rdsize=500000 echo "Creating RAM Disk for $mntpt" dev=hdik -drivekey system-image=yes -nomount ram://$rdsize if [ $? -eq 0 ] ; then newfs_hfs $dev # save & restore fs permissions covered by the mount eval `/usr/bin/stat -s $mntpt` mount -t hfs -o union -o nobrowse $dev $mntpt chown $st_uid:$st_gid $mntpt chmod $st_mode $mntpt fi
}

network_mount()
{ mount_from=$(ipconfig netbootoption shadow_mount_path 2>&1) if [ $? -ne 0 ]; then echo "no network shadow mount path available" return 1 fi shadow_path=$(ipconfig netbootoption shadow_file_path 2>&1) if [ $? -ne 0 ]; then echo "no network shadow file path available" return 1 fi case "${mount_from}" in afp:) fstype=afp kextutil -v 0 /System/Library/Filesystems/AppleShare/asp_tcp.kext kextutil -v 0 /System/Library/Filesystems/AppleShare/afpfs.kext ;; nfs:) fstype=nfs;; *) echo "unknown network filesystem mount from ${mount_from}" return 1 ;; esac mount -t "${fstype}" -o nobrowse "${mount_from}" "${NETBOOT_MOUNT}" if [ $? -ne 0 ]; then echo "mount -t ${fstype} -o nobrowse ${mount_from} ${NETBOOT_MOUNT} failed" return 1 fi common_start "${NETBOOT_MOUNT}" "${shadow_path}" return 0
}

do_start()
{ case "${NETBOOT_SHADOW}" in -LOCAL_ONLY- ) err=$(local_mount) if [ $? -ne 0 ]; then Failed "${err}" fi ;; -LOCAL- ) err=$(local_mount) if [ $? -ne 0 ]; then err=$(network_mount) if [ $? -ne 0 ]; then Failed "Could not find a local or network drive" fi fi ;; -NETWORK_ONLY-) err=$(network_mount) if [ $? -ne 0 ]; then Failed "${err}" fi ;;

* ) err=$(network_mount) if [ $? -ne 0 ]; then err=$(local_mount) if [ $? -ne 0 ]; then Failed "Could not find a network or local drive" fi fi ;; esac

}

do_init()
{ # attach the shadow file to the root disk image do_start

# make sure the root filesystem is clean fsck -p || fsck -fy || Failed "Could not clean root filesystem"

# make it writable mount -uw /

# adjust /private/var/vm to point to the writable area (if not diskless) swapdir=/private/var/vm mounted_from=$(mount | sed -n 's:(.) on ./var/netboot.:1:p') case "${mounted_from}" in /dev/) netboot_dir="${NETBOOT_MOUNT}/.com.apple.NetBootX" if [ -d "${netboot_dir}" ]; then rm -rf "${swapdir}" ln -s "${netboot_dir}" "${swapdir}" fi ;; *) ;; esac

# set the ComputerName based on what the NetBoot server told us it was machine_name=$(ipconfig netbootoption machine_name 2>&1) if [ $? -ne 0 ]; then echo "no machine name option available" else echo "Setting ComputerName to ${machine_name}" scutil --set ComputerName "${machine_name}" fi
}

if [ $# -lt 1 ] ; then exit 0
fi

command=$1

shift

case "${command}" in init) do_init $@ ;;
esac

##
# Exit
##
exit 0

dbraunschweiger
New Contributor II

That worked. Thanks!

johnklimeck
Contributor II

Sure thing. Spent days on this a few months ago. Same exact issue. Glad it worked.

John

johnklimeck
Contributor II

dbraunschweiger,

Can you mark as "Solved your Issue"

thx,

John