Troubleshooting Installation Errors

A few days ago I installed some malware by mistake, and decided it was time for reinstalling Windows. I’m a huge fan of fresh installs, and do it at least once or twice a year.

Since I use SugarSync online backup for all my important files, I like to heep them handy, all inside a single folder, out of Windows/Users folders (actually they are in a different partition, which helps me to format Operating System partitions without fear). Since I have all important files outside of their default locations, I always have to reconfigure the location for Documents, Pictures, and other folders. Also, since natively you can only change the location for some very specific folders, my fresh installs usually contain some junctions. And since in a few cases I also need to redirect on a file-basis, I also use hard links, which help me to keep safe some individual-files like Filezilla bookmarks, and hosts file.
(Click here to learn more about junctions, hardlinks, and mount points).

With that design, I never have to worry about formating the OS partition, and don’t have to worry about backing up multiple subfolders. It’s all backed up daily in real-time.

To keep that scenario I also have detailed step-by-step instructions on how to configure Windows the way I like it, which include:

  • Dual boot on SSD. One Windows for serious work, and the other for testing different software and installing things that I don’t use very frequently.
  • Ubuntu on another HD partition for open-source work.
  • Small TEMP partition on the start of a HD, for faster writes
  • Paging file on fast TEMP partition
  • TEMP/TMP environment variables pointing to TEMP partition

The instructions include some tips and reminders like:

  • Using YUMI to create bootable USB
  • Which Windows Updates should be skipped and which should be installed
  • Drivers downloaded for offline usage (specially network adapter, in case Windows does not install automatically)
  • How to configure SSD for optimal performance
  • Reconfigure Power Options, Regional Settings,
  • Configure /etc/hosts
  • Which programs to reinstall, in which order (e.g. SQL Server before Visual Studio), and some configurations.

During this last Windows Reinstall, I faced some problems with OneNote, which was not pasting images correctly. Calling onenote /safeboot and clearing cache and settings (which is a default solution for many problems) didn’t help at all. So I had to do the troubleshooting myself.

I fired up Process Monitor, which traces all read/write attempts both to filesystem and registry, and tried to paste into OneNote again. Then I reviewed the log, filtering only for Onenote.exe, and filtering out all “Success”. I was pretty sure that it was a problem in filesystem, and not in registry (because all my changes were related to filesystem, partitions, and folders), so I also filtered out everything related to registry. This is what was left:

I noticed that OneNote was trying to open C:\Windows\TEMP\Drizin, and it was being reparsed (by a junction) to T:\Drizin. My suspect was that the reparse point (junction) was the problem (and not permissions). So I replaced my environment variables (TEMP and TMP) to point directly to T:\%USERNAME%, instead of pointing to C:\Windows\TEMP\%USERNAME% which was being reparsed.

Replacing environment variables for current user and for all new users:

reg add "HKEY_CURRENT_USER\Environment" /v TEMP /t "REG_EXPAND_SZ" /d T:\%USERNAME% /f 
reg add "HKEY_CURRENT_USER\Environment" /v TMP /t "REG_EXPAND_SZ" /d T:\%USERNAME% /f 

reg add "HKEY_USERS\.DEFAULT\Environment" /v TEMP /t "REG_EXPAND_SZ" /d T:\^%USERNAME^% /f 
reg add "HKEY_USERS\.DEFAULT\Environment" /v TMP /t "REG_EXPAND_SZ" /d T:\^%USERNAME^% /f 

PS: Please note that the circunflex before the percent (^%USERNAME^%) is necessary for the HKEY_USERS, or else the command would automatically expand the %USERNAME% variable and then all users would have environment variables pointing to T:\Drizin. :-)

After restarting OneNote, everything started working again.

comments powered by Disqus