Tuesday, 17 February 2015

An active remote client has recently sent requests to this machine

Trying to get Windows 7 to sleep is notoriously difficult. Like many, I was in the situation that I got the following message:

C:\Windows\system32>powercfg /requests
DISPLAY:
None.

SYSTEM:
[DRIVER] \FileSystem\srvnet
An active remote client has recently sent requests to this machine.

AWAYMODE:
None.

Needless to say, the Management Console's fsmgmt.msc was silent about any active sessions, so the message seems to be a lie.

In order to make the message disappear, I ended up creating a homegroup, activating media streaming and waiting for the whole process to finish (there is a message in the control panel while it is still busy »sharing«). Afterwards, I simlpy »left« the homegroup again, and voilá, the srvnet request disappeared.

There is also a setting in the advanced power options about letting the computer sleep while sharing media, but that seems to have no effect either way.

Monday, 9 February 2015

Running Yosemite on UEFI hardware

I use the Clover boot loader in a UEFI-only installation on the ESP with the »BootCamp« theme. The only UEFI driver I need is OsxAptioFix2Drv-64 -- without it I get ???.

The best source for up-to-date kexts I've found is to download the current MultiBeast installer. The »Contents/Resources« folder of »MultiBeast.app« contains packages which can be expanded using

$ pkgutil --expand FakeSMC-v6.14.1364.pkg p
$ pax -rzf p/Payload

For my Intel DH87RL, I drop FakeSMC.kext and AppleIntelE1000e.kext into the corresponding folder OEM/DH87RL/kexts/10.10 on the ESP.

After installing new kexts, a reboot »without caches« must be performed by selecting the boot entry with space bar in Clover and selecting the corresponding entry.

My configuration file OEM/DH87RL/config.plist contains

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>ACPI</key>
 <dict>
  <key>SSDT</key>
  <dict>
   <key>EnableC6</key>
   <true/>
   <key>Generate</key>
   <dict>
    <key>CStates</key>
    <true/>
    <key>PStates</key>
    <true/>
   </dict>
  </dict>
 </dict>
 <key>Boot</key>
 <dict>
  <key>DefaultVolume</key>
  <string>LastBootedVolume</string>
  <key>Timeout</key>
  <integer>5</integer>
  <key>Log</key>
  <false/>
 </dict>
 <key>GUI</key>
 <dict>
  <key>Scan</key>
  <true/>
  <key>Custom</key>
  <dict>
   <key>Legacy</key>
   <array>
    <dict>
     <key>Type</key>
     <string>Windows</string>
     <key>Hidden</key>
     <true/>
    </dict>
   </array>
  </dict>
 </dict>
 <key>KernelAndKextPatches</key>
 <dict>
  <key>Debug</key>
  <false/>
  <key>KernelPm</key>
  <true/>
 </dict>
 <key>RtVariables</key>
 <dict>
  <key>MountEFI</key>
  <false/>
 </dict>
 <key>SystemParameters</key>
 <dict>
  <key>InjectKexts</key>
  <string>Detect</string>
 </dict>
</dict>
</plist>

Friday, 6 February 2015

Deploy Windows RE on system partition

I have been fighting with REAgentC to allow me to install the WinRE image to the system partition (8).

I have gone through numerous errors like »the product has been uninstalled«, »there is insufficient space on the device«, »the operation cannot be completed due to a file system limitation« and the pair of »cannot find the file/path specified« or »file cannot be created because it exists«.

I think the »cannot be created« error was the result of copying an existing boot.sdi ramdisk along with the winre.wim. This is wrong, REAgentC creates the ramdisk.

One thing I've noticed is that at least on an MBR disk, an NTFS partition is required in order to successfully enable WinRE on the system partition. If it's FAT32, I got misleading errors about »insufficient space« until I enlarged it, which then told me it could not complete the operation due to »file system limitations.«

If REAgentC is confused by the current contents of %systemroot%\System32\Recovery\ReAgent.xml, replace by a blank file:

<?xml version='1.0' encoding='utf-8'?>
<WindowsRE version="1.0">
    <WinreBCD id=""/>
    <WinreLocation path="" id="0" offset="0"/>
    <ImageLocation path="" id="0" offset="0"/>
    <OsInstallLocation path="" id="0" offset="0"/>
    <InstallState state="0"/>
    <OsInstallAvailable state="0"/>
    <WinREStaged state="0"/>
    <OperationParam path=""/>
    <OsBuildVersion path=""/>
    <OemTool state="0"/>
    <BootKey state="0"/>
    <IsServer state="0"/>
    <ScheduledOperation state="4"/>
</WindowsRE>

With the recovery partition on R:, the commands

md r:\Recovery\WindowsRE
xcopy /h %systemroot%\System32\Recovery\winre.wim r:\Recovery\WindowsRE
reagentc /setreimage /path R:\Recovery\WindowsRE /target %systemroot%
reagentc /enable
succeed and eventually produced this file:

<?xml version='1.0' encoding='utf-8'?>
<WindowsRE version="1.0">
    <WinreBCD id="{30f4463f-add1-11e4-97b2-e8db73286102}"/>
    <WinreLocation path="\Recovery\WindowsRE" id="196858822" offset="1048576" guid="{00000000-0000-0000-0000-000000000000}"/>
    <ImageLocation path="\Recovery\WindowsRE" id="196858822" offset="1048576" guid="{00000000-0000-0000-0000-000000000000}"/>
    <OsInstallLocation path="" id="0" offset="0" guid="{00000000-0000-0000-0000-000000000000}"/>
    <InstallState state="1"/>
    <OsInstallAvailable state="0"/>
    <WinREStaged state="0"/>
    <OperationParam path=""/>
    <OsBuildVersion path="7601.18700.amd64fre.win7sp1_gdr.141211-1742"/>
    <OemTool state="0"/>
    <BootKey state="0"/>
    <IsServer state="0"/>
    <ScheduledOperation state="4"/>
</WindowsRE>

Note that it's apparently impossible to issue the »/enable« command from Recovery Environment because it doesn't support the »/target« switch.

And here are the relevant boot loader entries created by REAgentC for this case:

Windows-Start-Manager
---------------------
Bezeichner              {bootmgr}
device                  partition=\Device\HarddiskVolume1
description             Windows Boot Manager
locale                  de-de
inherit                 {globalsettings}
default                 {current}
resumeobject            {30f44639-add1-11e4-97b2-e8db73286102}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 30

Windows-Startladeprogramm
-------------------------
Bezeichner              {current}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows 7
locale                  de-de
inherit                 {bootloadersettings}
recoverysequence        {30f4463f-add1-11e4-97b2-e8db73286102}
recoveryenabled         Yes
osdevice                partition=C:
systemroot              \Windows
resumeobject            {30f44639-add1-11e4-97b2-e8db73286102}
nx                      OptIn
detecthal               Yes

Windows-Startladeprogramm
-------------------------
Bezeichner              {30f4463f-add1-11e4-97b2-e8db73286102}
device                  ramdisk=[\Device\HarddiskVolume1]\Recovery\WindowsRE\Winre.wim,{30f44640-add1-11e4-97b2-e8db73286102}
path                    \windows\system32\winload.exe
description             Windows Recovery Environment
inherit                 {bootloadersettings}
osdevice                ramdisk=[\Device\HarddiskVolume1]\Recovery\WindowsRE\Winre.wim,{30f44640-add1-11e4-97b2-e8db73286102}
systemroot              \windows
nx                      OptIn
winpe                   Yes

Geräteoptionen
--------------
Bezeichner              {30f44640-add1-11e4-97b2-e8db73286102}
description             Ramdisk Options
ramdisksdidevice        partition=\Device\HarddiskVolume1
ramdisksdipath          \Recovery\WindowsRE\boot.sdi

For the tools to work, the system and recovery partition must be type id 0x27 on an MBR disk. The MBR and GPT partition types are:

Recovery300MBNTFS0x27de94bba4-06d1-4d40-a16a-bfd50179d6ac
ESP100MBFAT320x27c12a7328-f81f-11d2-ba4b-00a0c93ec93b
MSR128MBNTFS0x7e3c9e316-0b5c-4db8-817d-f92df00215ae
OSNTFS0x7ebd0a0a2-b9e5-4433-87c0-68b6b72699c7

Other tools

Helpful tools I've used (apart from REAgentC and bcdedit, obviously) include bcdboot %systemroot% /l en-us /s s: to copy the required files to the boot partition and set the desired locale and the Recovery Environment commands bootsect /nt60 %systemroot%, bootrec /fixboot and bootrec /fixmbr (the latter apparently Windows XP relics) to restore a partition's boot loader.

Thursday, 5 February 2015

Did you know

…you can start WordPad using "write" from the cmd line? Very useful when editing LF-only files as administrator…