Default user in WSL

The Windows Subsystem for Linux (WSL) defaults to running as the “root” user. In order to change that behavior, just create a Linux user.Let’s imagine this user is named “jdoe”. To have WSL start the session as “jdoe” instead of “root”, just run the following command from a “cmd.exe” window:

C:\Users\JohnDoe> lxrun /setdefaultuser jdoe

Take into account that running any running WSL will be killed inmmediately.

Advertisements

Turn Caps Lock into an additional Control key in Windows

I can’t remember when it was the last time I needed the Caps Lock key on my keyboard. For ages, I have been using support in Linux and Mac OS X to make Caps Lock behave as an additional Control key.

Windows doesn’t seem to have built-in support for doing this so I had to resort to an external utility named Ctrl2Cap by Mark Russinovich, available at http://technet.microsoft.com/en-us/sysinternals/bb897578.aspx. Ctrl2cap is a kernel-mode device driver that filters the system’s keyboard class driver in order to convert caps-lock characters into control characters. People like myself that migrated to NT from UNIX are used to having the control key located where the caps-lock key is on the standard PC keyboard, so a utility like this is essential for our editing well-being.

Another option which does not require installing any drivers (that might potentially cause harm) consists of applying a change to the Windows registry. I learnt about this technique from http://blog.horie.to/2012/06/make-capslock-additional-ctrl-in.html:

Modifying registries may cause system failures. Please take full responsibility for your actions.

  1. Run regedit.exe
  2. Create a new binary entry named “Scancode Map” under “HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlKeyboard Layout”
  3. Input following binary code and close regedit.exe
  4. 00 00 00 00 00 00 00 00
    03 00 00 00 1D 00 3A 00
    00 00 00 00 00 00 00 00

  5. Sign out, then sign in

Reverse scrolling direction in Windows

If you are used to Mac OS X Lion “natural” scrolling behavior, you might be interested in to how to emulate such behavior in Windows.

There is a registry setting named FlipFlopWheel that does allow reversing the scrolling direction, both vertical and horizontal. The exact name of the registry key depends on the HID of the mouse devices and, in computers with multiple input devices, there might be multiple entries.

Look for a key under HKEY_LOCAL_MACHINE that is named like SYSTEMCurrentControlSetEnumHID????????Device Parameters. Change the value for FlipFlopWheel from 0 to 1 to reverse vertical scrolling. In Windows 8, there’s an additional FlipFlopHScroll that allows reversing horizontal scrolling.

IPv6 stateless address configuration in Windows 7 uses randomization by default

Stateless autoconfiguration of IPv6 addresses in Windows 7 (and also Windows Vista) uses, by default, randomization. This is against section 4 of RFC 2464 that mandates that the network identifier part of the IPv6 address is derived from the 48-bit MAC address for Ethernet (and Wireless) interfaces:

4. Stateless Autoconfiguration

The Interface Identifier [AARCH] for an Ethernet interface is based on the EUI-64 identifier [EUI64] derived from the interface’s built-in 48-bit IEEE 802 address. The EUI-64 is formed as follows. (Canonical bit order is assumed throughout.)

The OUI of the Ethernet address (the first three octets) becomes the company_id of the EUI-64 (the first three octets). The fourth and fifth octets of the EUI are set to the fixed value FFFE hexadecimal. The last three octets of the Ethernet address become the last three octets of the EUI-64.

The Interface Identifier is then formed from the EUI-64 by complementing the “Universal/Local” (U/L) bit, which is the next-to-lowest order bit of the first octet of the EUI-64. Complementing this bit will generally change a 0 value to a 1, since an interface’s built-in address is expected to be from a universally administered address space and hence have a globally unique value. A universally administered IEEE 802 address or an EUI-64 is signified by a 0 in the U/L bit position, while a globally unique IPv6 Interface Identifier is signified by a 1 in the corresponding position. For further discussion on this point, see [AARCH].

For example, the Interface Identifier for an Ethernet interface whose built-in address is, in hexadecimal,

34-56-78-9A-BC-DE

would be

36-56-78-FF-FE-9A-BC-DE.

A different MAC address set manually or by software should not be used to derive the Interface Identifier. If such a MAC address must be used, its global uniqueness property should be reflected in the value of the U/L bit.

An IPv6 address prefix used for stateless autoconfiguration [ACONF] of an Ethernet interface must have a length of 64 bits.

The fact that Windows 7 doesn’t seem to adhere to this by default might create interoperability problems in networks where section 4 of RFC 2464 is assumed to be true. Linux, *BSD and Solaris map adhere to RFC 2464 by default, and hence many administrators statically create DNS AAAA RRs for such hosts. However, randomization in Windows makes this unfeasible.

A workaround consists of running the following command, with administrator privileges:

netsh interface ipv6 set global randomizeidentifiers=disabled

I’ve sent feedback to Microsoft asking if this is deliberate and why this decision was made in the first place. (Not sure if they will ever reply, though).

Do any of you have any insight on this?

Windows 7 Beta 1 + Apple = no sound

While testing Windows 7 on an Apple MacBook Pro system, I noticed that sound didn’t work at all. Of course, this was after I installed BootCamp drivers and everything was working (more or less as expected) except the sound.

What’s the solution? I found it here. In essence, the solution consists of running the RealTekSetup.exe binary from the Leopard DVD using “Troubleshoot Compatibility“, telling it that “The program worked in earlier versions of Windows” and that it worked fine in “Windows Vista“. After it has been installed no reboot it’s even needed!

Top 10 new features in Windows Server 2008

These are the Top 10 new features in Windows Server 2008: Is this innovation? Maybe. Let me go through them all:

  1. The self-healing NTFS file system:

    A self-healing NTFS file system sounds like a cool feature, but any modern journaling filesystem is pretty good at recovering from errors by replaying the journal (usually at mount time).

  2. Parallel session creation:

    Parallel session creation sounds like a minor improvement to Terminal Services in Windows. Basically, the fact that a Terminal Server can’t concurrently create new user sessions seems like a big deficiency to me. NoMachine’s NX and the old and good X11 system allow for concurrent user session creation since basically there is no writable, shared state between users/sessions. X11 authorization cookies are created in the user’s home directory and the session itself is abstracted by processes and some IPC resources.

  3. Clean service shutdown:

    To be honest here, a malfunctioning daemon could potentially slow down the shutdown of a UNIX system, so improving on this front sounds like a good idea. On the other side, how many times do you have to reboot a UNIX server? Hint: uptime.

  4. Kernel Transaction Manager:

    I’m not entirely familiar with Windows kernel internals, but this sounds like a cool feature. I’m not sure what UNIX systems already implement this, if at all.

  5. SMB2 network file system:

    It’s glad to know that the old, insecure and not very efficient SMB/CIFS network filesystem is being revamped. However, I am wondering what kind of changes is Microsoft introducing and how will they affect open source implementations like SAMBA. I don’t foresee any patent issues on this, though, since file system development (either local or networked) has stalled considerably during the last years, and even ZFS and Reiser4 only bring concepts but I wouldn’t call them revolutionary.

  6. Address Space Load Randomization (ASLR):

    I don’t see anything fascinating here. The Linux kernel has been sporting this with the introduction of Exec Shield.

  7. Windows Hardware Error Architecture (WHEA):

    This seems very Windows-centric, so I don’t see any real innovation here. I would call this another privative feature of an already privative operating system.

  8. Windows Server Virtualization:

    Nothing to see here. Xen support is extremely well integrated in Linux (read as in Red Hat Enterprise Linux, CentOS or SUSE Novell Enterprise) and NetBSD, and it offers support for paravirtualized and HVM-based virtualization. Xen has proven mature enough for production use, has lots of cool features and it’s open and free and has an exceptional performance. In fact, hypervisor-based virtualization had been in used by IBM’s POWER architecture for quite some time — IIRC starting with VM/370 — so no innovation here.

  9. PowerShell:

    Although a nice addition to Windows, UNIX has always had powerful shells like tcsh, zsh, bash or even PERL for years and also new scripting languages like Python or Ruby are starting to be used to develop more complex scripts.

    A powerful shell scripting environment has proven useful for automating tasks and administering systems. PowerShell sounds like the same tune to me.

  10. Server Core:

    Finally, it seems Microsoft starts to understand that useless and insecure features, like Windows Media Player, are only meant for desktop systems and not for servers. They cripple the operating system, increase complexity and bring nothing, so removing them completely is a good idea. It’s a pity, however, that it took Microsoft more than 10 years to realize what UNIX already had 40 years ago.

Conclusion

While many of the ideas and features commented here are good, I can’t seem to see much innovation here. I’m wondering how many patents did Microsoft file for such simple, tried-and-true ideas.

Windows Vista (y IV)

Definitivamente, tras unos cuantos intentos de conseguir mantener un sistema usable con Windows Vista Beta 2, he decidido desinstalarlo. La mayoría de las aplicaciones que necesito no funcionan:

  • NX client
  • Cygwin
  • VMware Server

Mi experiencia con Vista ha sido francamente desagradable. No sólo la instalación es horriblemente lenta, sino que el sistema es inestable, la mayoría de las aplicaciones no funcionan o no se instalan, consume una barbarie de recursos hardware, y el rendimiento del sistema es francamente penoso.

Por ello, vuelvo a ocupar los dos discos duros con un RAID-0 y Ubuntu Linux.

Quizá en otra ocasión, cuando Vista deje de ser algo más que una Beta de exhibición, vuelva a instalarlo para probar cómo se comporta con una carga de trabajo real. A día de hoy, para mí, es francamente inútil.