Skip to content

Commit b6ff072

Browse files
committed
update article
1 parent af4a059 commit b6ff072

File tree

2 files changed

+69
-94
lines changed

2 files changed

+69
-94
lines changed
51.4 KB
Loading
Lines changed: 69 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: VM is unresponsive while applying policy
3-
description: This article provides steps to resolve issues where the load screen is stuck when applying a policy during boot in an Azure VM.
3+
description: This article provides steps to resolve issues in which the load screen is stuck when applying a policy during boot in an Azure VM.
44
services: virtual-machines-windows
55
documentationcenter: ''
66
author: TobyTu
@@ -18,96 +18,80 @@ ms.author: v-mibufo
1818

1919
# VM is unresponsive while applying ‘Group Policy Local Users & Groups’ policy
2020

21-
This article provides steps to resolve issues where the load screen is stuck when applying a policy during boot in an Azure VM.
21+
This article provides steps to resolve issues where the load screen is stuck applying a policy during boot in an Azure VM.
2222

2323
## Symptoms
2424

25-
When you use [Boot diagnostics](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/boot-diagnostics) to view the screenshot of the VM, you will see that the screen is stuck loading with the message: ‘Applying Group Policy Local Users and Groups policy’.
25+
When you use [Boot diagnostics](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/boot-diagnostics) to view the screenshot of the VM, you will see that the screen is stuck loading with the message: ‘*Applying Group Policy Local Users and Groups policy*’.
2626

2727
![Screen showing Applying Group Policy Local Users and Groups policy loading (Windows Server 2012 R2)](media/unresponsive-vm-apply-group-policy/Applying-Group-Policy.png)
2828

2929
![Screen showing Applying Group Policy Local Users and Groups policy loading (Windows Server 2012).](media/unresponsive-vm-apply-group-policy/Applying-Group-Policy2.png)
3030

3131
## Cause
3232

33-
This issue is caused by a code defect in the Windows Profile Service Dynamic Link Library (*profsvc.dll*).
33+
This issue is caused by conflicting locks when the policy is attempting to cleanup old user profiles.
3434

3535
> [!NOTE]
3636
> This applies only on Windows Server 2012 and Windows Server 2012 R2.
3737
3838
The policy being applied that won’t finish its processes is:
3939

40-
`Computer Configuration\Policies\Administrative Templates\System\User Profiles\Delete user profiles older than a specified number of days on system restart`
40+
`Computer Configuration\Policies\Administrative Templates\System/User Profiles\Delete user profiles older than a specified number of days on system restart`
4141

42-
It will only get stuck if all six of the following conditions are true:
43-
44-
1. The **Delete user profiles older than a specified number of days on system restart** policy is enabled.
45-
2. You have profiles that have met the age requirements to require cleanup.
46-
3. You have any components that have registered for delete notification for profiles.
47-
4. The components make any calls (direct or indirect) that need to acquire data from the Service Control Manager (SCM) components of Windows, for example, Start, Stop, or Query information about a service.
48-
5. You have a service that configured to start as automatic.
49-
6. This same service is set to run under the context of a domain account (as opposed to using a built-in account, for example, local system).
50-
51-
### What's the code defect
52-
53-
The defect is because of the Service Control Manager (SCM) and the Profile services attempting to apply locks on one another simultaneously. Locks exist to prevent multiple services from making changes on the same data at the same time, which would cause corruption. Ordinarily multiple lock requests wouldn’t cause an issue, however since this is happening during boot, neither service can complete their processes as they are stuck waiting upon one another.
54-
55-
*OS Bug 5880648 - Service Control Manager deadlocks with the "Delete user profiles on restart" policy.*
56-
57-
There are two actions that overlap so that:
58-
59-
- Action 1 acquires the profile lock but hasn't yet acquired the SCM lock.
60-
61-
**AND**
62-
63-
- Action 2 acquires the SCM lock but hasn't yet acquired the profile lock.
42+
## Resolution
6443

65-
Once this has occurred, the next attempt to acquire the second required lock hangs the action.
44+
### Process overview
6645

67-
**Action 1: Old profile deletion notification (has Profile Lock, needs SCM Lock)**
46+
1. [Create and access a repair VM](#step-1-create-and-access-a-repair-vm)
47+
2. [Disable the policy](#step-2-disable-the-policy)
48+
3. [Enable Serial Console and memory dump collection](#step-3-enable-serial-console-and-memory-dump-collection)
49+
4. [Rebuild the VM](#step-4-rebuild-the-vm)
6850

69-
1. First, the policy that is set to delete old profiles grabs an internal profile service lock.
51+
> [!NOTE]
52+
> When encountering this boot error, the Guest OS is not operational. You will be troubleshooting in offline mode to resolve this issue.
7053
71-
This lock is there to prevent two threads from interacting with the profiles while the delete operation is progress.
54+
### Step 1: Create and access a repair VM
7255

73-
2. It then finds profiles that are old enough to be deleted.
74-
3. As a step of the profile deletion, a component that has registered for notifications of the deletions of a profile tries to start a service.
75-
4. Before the Service Control Manager (SCM) starting the service, it first needs to acquire an internal SCM lock, which is held by threads in **Action 2**.
56+
1. Use [steps 1-3 of the VM repair commands](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/repair-windows-vm-using-azure-virtual-machine-repair-commands#repair-process-example) to prepare a repair VM.
57+
2. Use Remote Desktop Connection connect to the repair VM.
7658

77-
**Action 2: Profile load or creation for user-specific data (has SCM Lock, needs Profile Lock)**
59+
### Step 2: Disable the policy
7860

79-
1. At boot, SCM needs to first order all autostart services by their group, as well as any services that those services are dependent upon.
80-
2. SCM acquires an internal SCM lock that is used to control access to starting, stopping, or configuring services as it orders the services.
81-
3. Once the services are in order, the SCM loops through each service and starts it.
82-
4. If the service is running under the context of a domain account, a profile needs to be loaded or created for the domain account in order to store user-specific data.
83-
5. This request is sent to the Profile Service.
84-
6. The profile service needs access to the internal lock acquired in **Action 1**.
61+
1. On the repair VM, open the Registry Editor.
62+
2. Locate the key **HKEY_LOCAL_MACHINE** and then select **File** > **Load Hive...** from the menu.
8563

86-
## Resolution
64+
![Screenshot shows highlighted HKEY_LOCAL_MACHINE, as well as the menu containing “Load Hive…”](media/unresponsive-vm-apply-group-policy/registry.png)
8765

88-
### Process overview
66+
- Load Hive allows you to load a registry key from an offline system, which in this case is your broken disk attached to your repair VM.
67+
- **HKEY_LOCAL_MACHINE** is where all the system-wide settings are stored and may be abbreviated as “HKLM”.
68+
3. In the attached disk, navigate to the `\windows\system32\config\SOFTWARE` file and open it.
8969

90-
1. [Create and access a Repair VM](#step-1-create-and-access-a-repair-vm)
91-
2. [Enable Serial Console and memory dump collection](#step-2-enable-serial-console-and-memory-dump-collection)
92-
3. [Rebuild the VM](#step-3-rebuild-the-vm)
93-
4. [Collect the memory dump file](#step-4-collect-the-memory-dump-file)
70+
a) When you open it, you will be prompted for a name. Enter BROKENSOFTWARE as the name.<br/>
71+
b) To verify that BROKENSOFTWARE was loaded, you can expand **HKEY_LOCAL_MACHINE** and look for the added BROKENSOFTWARE key.
72+
4. Navigate to the BROKENSOFTWARE and validate if the CleanupProfile key exists in the hive that was loaded.
9473

95-
> [!NOTE]
96-
> When encountering this boot error, the Guest OS is not operational. You will be troubleshooting in Offline mode to resolve this issue.
74+
a) If the key does not exist, then the CleanupProfile policy is not set up. In this case, you should [submit a support ticket](https://portal.azure.com/?#blade/Microsoft_Azure_Support/HelpAndSupportBlade), including the memory.dmp file located in the Windows directory of the attached OS disk.<br/>
75+
b) If the key does exist, then it means that the CleanupProfile policy is set up. Its value represents the retention policy in days. Continue to delete the key.
76+
5. Delete the CleanupProfiles key using the command below:
9777

98-
### Step 1: Create and access a Repair VM
78+
```
79+
reg delete "HKLM\BROKENSOFTWARE\Policies\Microsoft\Windows\System" /v CleanupProfiles /f
80+
```
81+
6. Unload the BROKENSOFTWARE hive using the command below:
9982
100-
1. Use [steps 1-3 of the VM Repair Commands](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/repair-windows-vm-using-azure-virtual-machine-repair-commands#repair-process-example) to prepare a Repair VM.
101-
2. Use Remote Desktop Connection connect to the Repair VM.
83+
```
84+
reg unload HKLM\BROKENSOFTWARE
85+
```
10286
103-
### Step 2: Enable Serial Console and memory dump collection
87+
### Step 3: Enable Serial Console and memory dump collection
10488
10589
To enable memory dump collection and Serial Console, run the script below:
10690
10791
1. Open an elevated command prompt session (Run as administrator).
10892
2. Run the following commands:
10993
110-
Enable Serial Console:
94+
**Enable Serial Console**:
11195
11296
```
11397
bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /ems {<BOOT LOADER IDENTIFIER>} ON
@@ -116,55 +100,46 @@ To enable memory dump collection and Serial Console, run the script below:
116100
```
117101
bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /emssettings EMSPORT:1 EMSBAUDRATE:115200
118102
```
119-
3. Verify that the free space on the OS disk is as much as the memory size (RAM) on the VM.
103+
3. Verify if the free space on the OS disk is as much as the memory size (RAM) on the VM.
120104
121105
If there's not enough space on the OS disk, you should change the location where the memory dump file will be created and refer that to any data disk attached to the VM that has enough free space. To change the location, replace “%SystemRoot%” with the drive letter (for example “F:”) of the data disk in the below commands.
122106
123-
Suggested configuration to enable OS dump:
124-
125-
Load Broken OS Disk:
126-
127-
```
128-
REG LOAD HKLM\BROKENSYSTEM <VOLUME LETTER OF BROKEN OS DISK>:\windows\system32\config\SYSTEM
129-
```
107+
**Suggested configuration to enable OS dump**:
130108
131-
Enable on ControlSet001:
109+
Load Broken OS Disk:
132110
133-
```
134-
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f
135-
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f
136-
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f
137-
```
138-
139-
Enable on ControlSet002:
140-
141-
```
142-
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f
143-
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f
144-
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f
145-
```
146-
147-
Unload broken OS disk:
111+
```
112+
REG LOAD HKLM\BROKENSYSTEM <VOLUME LETTER OF BROKEN OS DISK>:\windows\system32\config\SYSTEM
113+
```
148114
149-
```
150-
REG UNLOAD HKLM\BROKENSYSTEM
151-
```
115+
Enable on ControlSet001:
116+
117+
```
118+
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f
119+
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f
120+
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f
121+
```
122+
123+
Enable on ControlSet002:
124+
125+
```
126+
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f
127+
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f
128+
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f
129+
```
130+
131+
Unload broken OS disk:
132+
133+
```
134+
REG UNLOAD HKLM\BROKENSYSTEM
135+
```
152136
153-
### Step 3: Rebuild the VM
137+
### Step 4: Rebuild the VM
154138
155139
Use [step 5 of the VM Repair Commands](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/repair-windows-vm-using-azure-virtual-machine-repair-commands#repair-process-example) to reassemble the VM.
156140
157-
### Step 4: Collect the memory dump file
158-
159-
To resolve this problem, you would need first to gather the memory dump file for the crash and contact support with the memory dump file. To collect the dump file, follow these steps:
160-
161-
1. Attach the OS disk to a new Repair VM:
162-
163-
- Use [steps 1-3 of the VM Repair Commands](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/repair-windows-vm-using-azure-virtual-machine-repair-commands#repair-process-example) to prepare a new Repair VM.
164-
- Use Remote Desktop Connection connect to the Repair VM.
141+
If this fixed the issue, then you have disabled this policy locally. For a permanent solution, do not to use the CleanupProfiles policy on VMs, and use another method to perform the profile cleanup.
165142
166-
2. Locate the dump file and submit a support ticket:
143+
Policy to stop using:
167144
168-
- On the repair VM, go to windows folder in the attached OS disk. If the driver letter that is assigned to the attached OS disk is F, you need to go to `F:\Windows`.
169-
- Locate the memory.dmp file, and then [submit a support ticket](https://portal.azure.com/?#blade/Microsoft_Azure_Support/HelpAndSupportBlade) with the memory dump file.
170-
- If you are having trouble locating the memory.dmp file, you may wish to use [non-maskable interrupt (NMI) calls in serial console](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/serial-console-windows#use-the-serial-console-for-nmi-calls) instead. You can follow the guide to [generate a crash dump file using NMI calls](https://docs.microsoft.com/windows/client-management/generate-kernel-or-complete-crash-dump) here.
145+
Machine\Admin Templates\System\User Profiles\Delete user profiles older than a specified number of days on system restart

0 commit comments

Comments
 (0)