Citrix App Layering | Adding version to OS Layer failing with error "Failed to duplicate layer. Please ensure that Windows was shut down properly."
book
Article ID: CTX322419
calendar_today
Updated On:
Description
Adding version to OS Layer failing with error "Failed to duplicate layer. Please ensure that Windows was shut down properly".
Screenshot of the error:

On the ELM logs, we would see the below errors:
2021-07-14 09:20:34,824 INFO DefaultPool2 CopyPartitionByNtfsCloneJobStep: Cloning NTFS from block device /dev/nbd946p1 to /dev/nbd947p1
2021-07-14 09:20:34,875 ERROR DefaultPool2 CopyPartitionByNtfsCloneJobStep: NtfsClone failure (exitCode 1), repository reports 2760335364096 bytes remaining out of 3297175932928 bytes total
2021-07-14 09:20:34,880 ERROR DefaultPool2 CopyPartitionByNtfsCloneJobStep: NtfsClone failure: ERROR: Volume '/dev/nbd946p1' is scheduled for a check or it was shutdown uncleanly. Please boot Windows or use the --force option to progress.
2021-07-14 09:20:34,880 ERROR DefaultPool2 JobStepEnumerator: Job step failed: MessageId=FailedNtfsClone, DefaultTitle=, CategoryData={[ExternalToolFailure { Call = "/usr/sbin/ntfsclone", Args = "-O /dev/nbd947p1 /dev/nbd946p1", Output = "", Error = "ntfsclone v2018.3.1AR.1 (libntfs-3g)", ErrorCode = 1 }]}
2021-07-14 09:20:34,880 INFO DefaultPool2 JobInterceptor: FinalizeLayerJob for JobId '768d6e' has failed
Resolution
Try the below action items to resolve the issue.
Action Item 1:
From the errors above, this usually means that the OS is in a unclean state, the Operating system is basically in a "dirty" state.
To take care of this issue, please try the following commands:
-Open command prompt as administrator in packaging machine
-Powercfg -h off
-CHKDSK /F C:
-Shutdown to finalize
After these commands are run, try to finalize the OS Layer.
If it still fails, then try Action Item 2.
Action Item 2:
Reboot the packaging machine a few times and try again. If this did not force a chkdsk on the VM then you will need to do so manually.
Please take a Windows VM that was not created with App Layering and attach the OS disk from the packaging machine to it. Then manually run chkdsk from an administrator command prompt on that disk. Once done, please reattach the disk to the packaging machine, boot it back up and then shut down to finalize again.
Problem Cause
This is mostly to do with the OS corruption/fragmentation issue.
Issue/Introduction
This article helps to troubleshoot the error seen while adding version to an OS Layer in Citrix App Layering. The error says "Failed to duplicate layer. Please ensure that Windows was shut down properly".
Additional Information
Look into the best practices for OS Layer preparation discussed in the below link:
https://docs.citrix.com/en-us/citrix-app-layering/4/layer/prepare-os-for-layering/prepare-os-citrix-hypervisor-hyperv-vsphere.html
Was this article helpful?
thumb_up
Yes
thumb_down
No