Microsoft Windows and all that goes with it

Black Screen on Boot After Enabling ReFS

After playing with ReFS a bit, time came for Windows update restart. After initial second or so of booting screen blanked and stayed that way. I waited and waited but there was neither screen nor disk activity. And same thing happened every time I rebooted.

And it got frozen at the worst spot. I have a dual boot and freeze happen to be just before OS selection screen. With one error both installations were dead. And since I used BitLocker on both I wasn’t really in the mood for recovery.

Fortunately, after turning off system few times during boot, I got into Automatic Repair prompt. I entered BitLocker key for my main OS and proceeded with Advanced Options. There I just selected Continue (Exit and continue to Windows 8.1). While this should have technically been exactly the same boot, it was different enough that it actually worked. And then, as soon as system booted up, I removed ReFS capability (this registry file) and rebooted again. All came back successfully.

PS: Even when ReFS functionality is “turned off” you can still use existing ReFS disks. You just cannot format new ones.

ReFS on Windows 8.1

Illustration

I am a big fan of ZFS and I run it on my main file server. It is mature, stable and its syncing feature is a thing of beauty. Regardless, I decided that a new file server for my kids would use Windows 8.1 (yes, I know that is not a server OS). And I figured it is about a time I tried ReFS - a Windows ZFS alternative.

Feature-wise ReFS is definitely an improvement over NTFS. For one it finally includes checksum. It is mandatory on metadata with an option to enable it for user data (integrity streams feature). It is not as fool-proof as SHA-256 ZFS uses, but it is good enough for error detection. And (almost) all volume fixing is done online - no more reboots to CHKDSK. But you cannot use it as boot drive.

Compared to ZFS there are also quite a few things missing. There are no datasets, there is no parity (without Storage Spaces), there is no compression, and there is no sync (I’ll miss that the most). Main improvement (in my opinion) lies in self-management for all things ZFS requires you to micro-manage. Dcrub is self scheduled, memory is handled dynamically, caching just works… While ZFS can be optimized to a specific load a bit better (especially with SSD cache) I didn’t find myself depending on these features that much - especially when setting up client system.

While Windows 8.1 does support ReFS, you cannot just format drive with it - that would be to easy. First you need to create DWORD registry entry AllowRefsFormatOverNonmirrorVolume under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MiniNT and give it value of 1. Or you can import this pre-prepared registry file to do it for you.

Now Explorer will let you format drive but it will do so without integrity streams. Without Storage Spaces, you might not benefit fully as it will only detect corruption without repairing it so that might be as good default as any. As I am a huge believer in copy-on-write, I decided to go to command line and get it enabled:

FORMAT E: /FS:ReFS /Q /I:enable

As format completes don’t forget to remove registry entry you created as it can prevent System Restore working properly and dual boot might act a bit funny. Again, you can go into Registry Editor and delete it manually or you can just import this registry file. ReFS will still work just fine - you just won’t be able to format new drives.

Mostly everything works as expected. Besides the peace of mind I get from having my data checksummed I didn’t notice much difference. Things work as they did before. Depending on the exact data set it might have been a bit faster but it is hard to tell considering it was a fresh drive. Good news is that it is not slower.

Some programs might complain, most notably Google Drive - mind you not because ReFS is not working nor because Google Drive uses something special - it is just because its programmers are lazy hardcoding bunch.

Of course it would help if Microsoft’s own Hyper-V would work properly with integrity streams. While not as annoying as with Google Drive, Hyper-V virtual disks on ReFS do need a special attention. Yes, there might be valid performance reasons but warning message would do same as completely preventing virtual machine from starting. Fortunately fixing is as easy as disabling integrity on a single file:

Set-FileIntegrity -FileName E:\My.vhdx -Enable $False

I find ReFS really refreshing and promising file system. I can only hope that, with time, Microsoft will get this feature properly supported in its client OS. Who knows, maybe I get to install Windows 10 on ReFS boot drive. :)

Windows Installation Media Creation Tool

Illustration

For quite a long time Windows 7 USB/DVD Download Tool was the easiest way to create your bootable USB. Yes, it had its issues (e.g. didn’t work for UEFI) but it usually did its work. Only issue was where to get install media in the first place.

Well, now Microsoft gave us Windows Installation Media Creation Tool. As soon as you start it (no installation possible) you will get a selection of languages, editions (Standard/Pro), and architecture (x86/x64). Afterward you select whether you want to create a bootable USB or save it as an ISO file and, after a lengthy download, you will have your installation media. Perfect!

However, tool is not really perfect. First of all, it seems to have issues with some USB drives. I tried three different SanDisk Cruzer Fit USB drives and neither of them was even recognized by the tool: “We can’t find a USB flash drive. Insert one and try again.” This is first time ever I saw issue like this in any program.

One drive it did recognize (Super Talent’s Pico-C) was deemed too small although it’s size was required 4 GB. Yes, I know disk manufacturers like to count bytes a bit differently but I am puzzled by that 4 GB requirement. Pretty much all Windows installations are just slightly over 3 GB so better approach would be just to compare given flash size to selected installation media. And there is no technical reason since I could manually create a bootable drive from downloaded ISO just fine.

If you have a limited bandwidth, beware. Utility downloads a new file every time. It doesn’t matter if you just downloaded ISO five minutes ago and now you just want to create a bootable media. It will redo the whole download. Seems wasteful to me.

It would also help if default selections would match running system rather than being empty. The whole idea is to give you installation media for your machine and this gets quite a bit annoying if you are inexperienced user trying to guess which release you are currently running.

But all in all, I am happy with this tool for its ISO download capability. It finally makes it possible to do the pristine installation on your machine with original Microsoft media without having to be MSDN subscriber.

PS: If everything else fails, you can always make USB install manually.

Long Awaited Improvement

Illustration

With every new Windows there is a part that gets no attention at all. Good old command prompt keept the same look-and-feel for a decade or so. But Windows 10 are about to change this.

Most noticeable improvement is that Quick edit mode is turned on by default. Yes, there is a semi-good historical reason why this “had to be off” but limiting progress because of a few DOS-era tools is simply unreasonable.

More of good stuff awaits if you decide to turn on the Experimental settings. Most noticeable improvement is the ability to change the window size dynamically. Yes, it took until 2014 to have a command prompt window that can be resized using the mouse.

Interesting choice is that all standard copy/paste keys work. This is a slightly unfortunate in the case of Ctrl+C that traditionally has a slightly different role in the command prompt. For this reason I think that good old Ctrl+Insert and Shift+Insert would be a better choice, although sometimes I feel I am the only one still using them.

It is not all good though. Annoying error that is bound to get fixed really soon is not being able to see last few text rows when Command window is maximized. And I cannot really go over the fact that the window bezel is impossibly thin, practically non-existent. Looks ugly and makes the resize difficult without any reason. And the font selection is still defaulting to raster font and it is unnecessarily limited.

Regardless of these minor issues, these changes are a breath of fresh air for code I though of as abandoned. I just hope all these improvements make it to the final version.

Developer for $20

Finally somebody in Microsoft got their head from the dark place and decided to do what had to be done. There is no more yearly subscription for developing Windows Store applications. All you need is a one-time fee of $20 (close to $25 Google charges) and you are set. All current developers are automatically freed from their yearly burden.

Microsoft wouldn’t be Microsoft if they wouldn’t release multiple editions. This time everything gets divided into Explorer, Expert and Master levels. Everybody, including those that already have published applications, start as Explorer. Quite a nice touch is that you immediately get Architecture and Design Guidance offers. I haven’t tried it but it looks as if developer might get to discuss things with an actual human being. Sweet!

Going toward Expert level seems to depend onto you publishing your application and, I assume, well-being of that application. Master level is black magic and actual details are still somewhat fuzzy.

It is really hard to tell whether this will improve Windows Store or not. My bet is that it won’t change much immediately because Microsoft was giving registration benefits for free even before. Every single developer I know that had Windows Store application published, got to do that at no cost. Rumors are that some were even payed to do it.

Official removal of subscription does lower the bar a bit for hobby developers who, seeing the $100+ cost per year, just gave up and dealt with Android instead. If Microsoft gets those guys interested in platform again, I can see many new applications coming in. Yes, most of them will be bad (as they are in Android store) but with time store will get bigger and there will be more enthusiasm. And that will bring better quality.

Compacting VHD of a Linux Host

At home I use Linux exclusively in virtual machines under Windows. Call me spoiled but I still use Windows as my main OS.

Since I have multiple machines quite often I use dynamic disks (Microsoft VHD format) so I can fit them all on my notebook. With usage some of them simply grow to large and a compact is needed.

In order for compact to work, we need to zero-out all free disk space. While dd is a popular choice, I personally prefer zerofree. As always, first step is to install it:

sudo apt-get install zerofree
...

Again, there are ways to do it on-line but I prefer to play it safe. Upon system reboot, just pressand you’ll be greeted by Grub’s menu. Go to Recovery and select root. Once single user prompt is shown, everything is ready for zerofree:

zerofree /dev/sda1

Once command has completed (and it’ll take a while) shut machine down.

As Linux virtual machine is powered off we are ready for Windows part. Everything here is done in the diskpart:

DISKPART> **select vdisk file "C:\VMs\Mint\Mint.vhd"**
DiskPart successfully selected the virtual disk file.

DISKPART> **attach vdisk readonly**
DiskPart successfully attached the virtual disk file.

DISKPART> **compact vdisk**
DiskPart successfully compacted the virtual disk file.

After this is done, your virtual disk should be much smaller than before.

Modern UI and the Remote Procedure Call Failed

Illustration

New Windows 8.1 updates have arrived so I had to make quick visit to Windows Update Modern UI application. There I was greeted with The remote procedure call failed. So I tried to open Control Panel - same issue. All Modern UI application suddenly didn’t work. Ok, when I say suddenly, it might have been days - I am not really using Modern UI applications in my daily work. But, since I needed one now, it was a time to do a cleanup.

First order of business was running System File Checker utility:

SFC /scannow
 Beginning system scan.  This process will take some time.
 Beginning verification phase of system scan.
 Verification 100% complete.
 Windows Resource Protection found corrupt files but was unable to fix some
 of them. Details are included in the CBS.Log windir\Logs\CBS\CBS.log. For
 example C:\Windows\Logs\CBS\CBS.log. Note that logging is currently not
 supported in offline servicing scenarios.

As soon as it finished repairs, I could use my Modern UI applications once more, including Control Panel and Windows Update. But some corruption was left. In order to determine what exactly, I extracted parts of CBS log:

FINDSTR /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"

In newly created sfcdetails.txt I found this damning entry:

[SR] Cannot repair member file [l:36{18}]"Amd64\CNBJ2530.DPB" of prncacla.inf, Version = 6.3.9600.16384, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type = [l:24{12}]"driverUpdate", TypeName neutral, PublicKey neutral in the store, hash mismatch

Well, it was the time to get the big guns out. Here comes [Deployement Image Service and Management](http://technet.microsoft.com/en-us/library/hh825265.aspx) utility (DISM for friends):

C:> DISM /Online /Cleanup-image /Restorehealth

Deployment Image Servicing and Management tool Version: 6.3.9600.17031

Image Version: 6.3.9600.17031

[==========================100.0%==========================] The restore operation completed successfully. The component store corruption was repaired. The operation completed successfully.


After a long time (overnight actually) and few megabytes DISM has updated the system. Short verification proved the same:

C:> SFC /scannow

Beginning system scan. This process will take some time.

Beginning verification phase of system scan. Verification 100% complete.

Windows Resource Protection did not find any integrity violations.


I'll probably never know what exactly caused this, but fix worked as a charm. More cynical side of me cannot help noticing that Windows is becoming more and more like Linux in the extensive use of a command line tools to fix GUI issues. Not sure that is improvement though. ;)

PS: You might as well ignore progress bar for DISM. It only updates every 20%. Idiotic.

The Logon Attempt Failed

Illustration

Ever since I moved to USA, I have been using TeamViewer as a connection platform of choice. Reasoning was simple; it works over any firewall you can throw at it and my move was only to last for a few months. Few months turned into years so I finally decided to get myself a bit better wireless router. And since it supports VPN, I could start using Microsoft Windows Remote Desktop Connection again. Serves same purpose as TeamViewer, but I find it a bit nicer to use.

First computer to get remote desktop was one kids used. Configuration was as annoyingly clickable as ever. First go to System, then Advanced system setting and check Allow remote connections to this computer on Remote tab. If you have password-less user (as I did), setup a password for user and (optionally) use Autologon utility so you don’t need to enter it every time. Not the most secure setup but good enough for something that runs Worms and Dungeon Keeper 90% of time.

However, something obviously went wrong as I was greeted with The logon attempt failed error. Running Wireshark on destination computer proved that packets were coming in but, for some reason my authentication failed. And no, I didn’t have a wrong password. Quick check from my mobile phone proved as much; my Android connected without any issues. Only issues were on Windows 8.1 to Windows 8.1 front.

After some time I figured what the issue was. I had my computer synchronized with Microsoft Account. My kids’ account was a local one. Somebody in Microsoft decided that, if you have Microsoft Account on one side, Remote Desktop Connection would assume you had it on other side too. Pretty stupid if you ask me, especially because you cannot see it anywhere if you enter user name manually (you do get to see it in small print if you leave user name empty).

Solution was simple enough once I knew what I was dealing with. Since workgroup on destination computer was named Medved, I have entered Medved\Username as an user name. Remote Desktop Connection was fortunately still smart enough to turn off Microsoft Account stupidity and my connection was established.

PS: Don’t misunderstand me. Having a possibility of using Microsoft Account in Remote Desktop Connection is quite a nice thing. However, I hate when program changes my input without letting me know. And it is not as if they couldn’t support it both ways - every Microsoft Account is in e-mail address format. Why not use MicrosoftAccount domain only for those? Or just show me somewhere in small letters which domain you are using. Don’t leave me in the dark.

Windows 8.1 Just Keeps on Getting Better

Illustration

Let’s face it, Windows 8 was a hell for desktop users. It took until Windows 8.1 for things to be better. It wasn’t anything big - for me it was mostly boot to desktop that made it worthwhile update. There were some bumps left but nothing that bothered me on daily basis.

Microsoft is going further with Windows 8.1 Update. First major thing that awaits is proper Start Menu. It’s look is similar to what we used to have since Windows XP with a side made of Metro tiles. Since Desktop will be default for non-touch PCs (currently you must change a setting to get it), finally a desktop user can work without ever going to (mostly useless) tiles.

Speaking of which, they are suddenly not annoying that much. First of all, gone is annoying right-click behavior which would open menu at screen’s bottom. While not a problem for touch, desktop users had their mouse travel miles and miles for no good reason. Finally menu will open right over tile as logic dictates. It will take some time for other “modern” applications to update their behavior but it will no doubt happen.

For couple of useful metro applications welcome change is possibility to have them in taskbar. Not only that that makes them pinnable but it also allows for preview window interaction. And when you select them you will be greeted with titlebar. It doesn’t offer anything more than what you could do now, but it does allow closing without hitting Alt+F4.

Major feature that will make developers happy is possibility to target Phone, Tablet and Desktop with same code. If this gets executed correctly it will be best thing that happened to Store and it might make WinRT development actually a worthwhile task. Experience with last platform that promised the same (WPF anyone) is making me cautiously optimistic since platforms might drift apart already in next revision.

Manufacturers will be happy with free Windows license for anything smaller than 9" and lower memory usage on RT platform. It still remains to be seen whether this will result in cheaper devices but at least nobody will blame Microsoft for high prices any more. Licensing for “normal” Windows remains pretty much the same.

Of course, nothing of this has been released yet and thus it is a subject to change. There is more than enough time to screw make things more “touch-friendly”.

PS: Yes, I know that Modern UI interface is not called Metro anymore…

PPS: To see all these features in action and more, you can watch BUILD 2014 keynote.

Creating Certificate Signing Request Under Windows

Illustration

Certificate that I use for code signing was about to expire so I went to StartSSL to get a new one. After going through standard identity verifications only thing remaining was to submit certificate signing request (CSR). Last time I created one on my Linux machine using openssl. This time I wanted to create it under Windows.

It turns out this is not difficult at all. First step was to download openssl installation for Windows. Message about missing Visual C++ 2008 Redistributables could be safely ignored and after annoying setup procedure (why would anybody think you want to install stuff to root directory) everything was ready.

Creating certificate signing request was exactly the same command as on Linux:

openssl req -new -newkey rsa:4096 -nodes -out my.csr -keyout my.key

After answering a few questions, all that was left to do was to open resulting my.csr file in any text editor and copy/paste it to the certificate authority. Not as easy as on Linux (where openssl is usually part of OS) but close enough for me.

PS: In order to get PFX certificate based on private key and certificate file, you can also use openssl:

openssl pkcs12 -export -inkey my.key -in my.cer -out my.pfx