Category Archives: Windows 7

Setting up headless Ubuntu server in VMware Virtual Machine

In order to have a headless (no screen) Ubuntu vm running in the background in Windows, first you must install and setup Ubuntu, then launch the virtual machine using vmrun with the nogui option. Below sets up Ubuntu for both ssh and VNC remote desktop access.

  1. Install Ubuntu.
  2. Setup SSH server (Secure shell client and server metapackage).
  3. Set the resolution.
  4. Enable VNC remote desktop: Applications > Desktop Sharing:
    1. Tick Allow other users to view your desktop.
    2. Tick Allow other user to control your desktop.
    3. Untick You must confirm each access to this machine (don’t leave this ticked, otherwise you need to already be viewing the desktop in order to access remotely).
    4. Tick Require the user to enter this password, then enter a password.
    5. Click Close.
  5. Confirm that you can log in to Ubuntu via SSH and/or VNC.
  6. Shutdown virtual machine.
  7. Open the virtual machine from the command prompt with vmrun and the option nogui.

e.g. c:\Program Files (x86)\VMware\VMware Workstation\vmrun start m:\vm\Ubuntu\Ubuntu.vmx nogui

Delete hiberfil.sys on Windows 7

If you don’t use hibernation, hiberfil.sys is a waste of harddrive space. It stores the contains of RAM when the system hibernates, so is the same size as your system RAM. In my case it was taking up over 8GB of space.

  1. Open the Start menu, type in Command, right-click on Command Prompt and select Run as Administrator.
  2. If prompted to confirm click Yes.
  3. Type in powercfg.exe -h off, then press ENTER.

Done. Hibernation is disabled and the file is automatically removed.

Dealing with Windows 7 Time Sync issues

For reasons (I suspect the CMOS battery, but have no replacements), the clock on my Windows 7 PC ceased working correctly. On boot, the time is very close to the time the computer was last shut down, which is often greater than 12hrs behind. It does not automatically pick up the correct time.

I initially thought that this was because there are limits to the maximum time difference when syncing, so that if the clock is too far out the system time is not updated. I tried overriding these limits in the registry, however as the default sync only runs once a week this isn’t a complete fix. My temporary solution (until a new battery is obtained) is to also set up a resync Schedule Task for each boot.

Step 1. Overriding the registry sync limits

  1. Open Regedit.
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config.
  3. Change MaxNegPhaseCorrection and MaxPosPhaseCorrection from d2f0 to ffffffff.
  4. Reboot.

Step 2. Setting up the Scheduled Task

  1. Open Task Scheduler.
  2. In the left panel find and highlight Task Scheduler (local) > Task Scheduler Library > Microsoft > Windows > Time Synchronization.
  3. In the Actions panel (right side) click Create Task….
  4. Enter a Name, e.g. Force sync time.
  5. Click Change User or Group….
  6. Click Advanced….
  7. Click Find Now.
  8. In the Search results list select LOCAL SERVICE., then click Ok and Ok.
  9. Tick Run with highest privileges.
  10. In Configure for select your operating system (why this doesn’t default to Windows 7 I don’t know).
  11. Activate the Triggers tab.
  12. Click New….
  13. Enter how often the Task should run. I set it to: At Startup with 1 minute delay. (I tried without a delay, and it seemed to try to update before the network was up and fail).
  14. Activate the Actions tab.
  15. Click New….
  16. Leave Action as Start a program.
  17. In Program/script enter %windir%\system32\sc.exe. In Add arguments enter start w32time task_started. This ensures the Windows time sync service is running.
  18. Click Ok.
  19. Click New… again, but this time enter a new Start a program with Program/script of %windir%\system32\w32tm.exe with and argument /resync. This synchronises the time.
  20. Activate the Conditions tab.
  21. Tick Start only if the following network connection is available, and leave it set to Any connection (as you need a network connection to synchronise the time). Optionally you can also untick the 1st Power option, as the Task won’t use much  power when using battery.
  22. Activate the Settings tab.
  23. Tick Run task as soon as possible after a scheduled start is missed.
  24. Click Ok.

You can now test the Task by clicking Run. If you clock time was incorrect, it should now be correct.

If the clock issue is that it loses time while running, this could indicate more than a battery problem. A quick fix would be to set up a Scheduled Task as above, but set it to run constantly such as every 15 min.

Undoing the changes

You can easily undo the changes above, by setting the Registry values back to the original values and deleting the Scheduled Task.

Computer won’t boot due to CD/DVD in drive

This has happened to me on 2 different systems (Macbook and Windows desktop PC), and I couldn’t find any useful information online. Maybe this will help someone avoid the trial-and-error testing I had to do.

Symptoms

Computer doesn’t boot, doesn’t even get to BIOS screen. No error indications. On Macbook, none of the startup key combinations did anything.

Cause

Disc in CD/DVD drive… seriously. Was a written DVD in the Macbook, and a music CD on the PC.

Haven’t got a clue why these particular discs in these particular computers caused them to seemingly freeze during the boot process, have never seen the issue before.

Resolution

Remove the discs, problem solved. This was not quite so simple a process with the Macbook however.

Macbooks don’t have the ‘paperclip manual ejection hole’ thingy that seems to be standard on every other CD drive. Possibly this was left out as it ruined the sleek design of the Macbook :rolleyes:

However, when the case over the DVD drive flexes it touches the spinning disc and you can hear the disc rubbing (you usually notice this if you pick up the Macbook while it is accessing a disc). If you squeeze hard enough the disc stops spinning, the Macbook automatically ejects it out and the boot process continues.

Hooray!