Introducing Windows Subsystem for Linux WSL Overview #blogtober

Introducing Windows Subsystem for Linux WSL Overview #blogtober

server storage I/O data infrastructure trends

Updated 1/21/2018

Introducing Windows Subsystem for Linux WSL and Overview. Microsoft has been increasing their support of Linux across Azure public cloud, Hyper-V and Linux Integration Services (LIS) and Windows platforms including Windows Subsystem for Linux (WSL) as well as Server along with Docker support.

WSL installed with Ubuntu on Windows 10

WSL with Ubuntu installed and open in a window on one of my Windows 10 systems.

WSL is not a virtual machine (VM) running on Windows or Hyper-V, rather it is a subsystem that coexists next to win32 (read more about how it works and features, enhancements here). Once installed, WSL enables use of Linux bash shell along with familiar tools (find, grep, sed, awk, rsync among others) as well as services such as ssh, MySQL among others.

What this all means is that if you work with both Windows and Linux, you can do so on the same desktop, laptop, server or system using your preferred commands. For example in one window you can be using Powershell or traditional Windows commands and tools, while in another window working with grep, find and other tools eliminating the need to install things such as wingrep among others.

Installing WSL

Depending on which release of Windows desktop or server you are running, there are a couple of different install paths. Since my Windows 10 is the most recent release (e.g. 1709) I was able to simply go to the Microsoft Windows Store via desktop, search for Windows Linux, select the distribution, install and launch. Microsoft has some useful information for installing WSL on different Windows version here, as well as for Windows Servers here.

Get WSL from Windows Store

Get WSL from Windows Store or more information and options here.

Microsoft WSL install

Click on Get the app

Select which Linux for WSL to install

Select desired WSL distribution

SUSE linux for WSL

Lests select SUSE as I already have Ubuntu installed (I have both)

WSL installing SUSE

SUSE WSL in the process of downloading. Note SUSE needs an access code (free) that you get from https://www.suse.com/subscriptions/sles/developer/ while waiting for the download and install is a good time to get that code.

launching WSL on Windows 10

Launching WSL with SUSE, you will be prompted to enter the code mentioned above, if you do not have a code, get it here from SUSE.

completing install of WSL

The WSL installation is very straight forward, enter the SUSE code (Ubuntu did not need a code). Note the Ubuntu and SUSE WSL task bar icons circled bottom center.

Ubuntu and SUSE WSL on Windows 10

Provide a username for accessing the WSL bash shell along with password, confirm how root and sudo to be applied and that is it. Serious, the install for WSL at least with Windows 10 1709 is that fast and easy. Note in the above image, I have WSL with Ubuntu open in a window on the left, WSL with SUSE on the right, and their taskbar icons bottom center.

Windows WSL install error 0x8007007e

Enable Windows Subsystem for Linux Feature on Windows

If you get the above WSL error message 0x8007007e when installing WSL Ubuntu, SUSE or other shell distro, make sure to enable the Windows WSL feature if not already installed.

Windows WSL install error fix

One option is to install additional Windows features via settings or control panel. For example, Control panel -> Programs and features -> Turn Windows features on or off -> Check the box for Windows Subsystem for Linux

Another option is to install Windows subsystem feature via Powershell for example.

enable-windowsoptionalfeature -online  -featurename microsoft-windows-subsystem-linux

Using WSL

Once you have WSL installed, try something simple such as view your present directory:

pwd

Then look at the Windows C: drive location

ls /mnt/c -al

In case you did not notice the above, you can use Windows files and folders from the bash shell by placing /mnt in front of the device path. Note that you need to be case-sensitive such as User vs. user or Documents vs. documents.

As a further example, I needed to change several .htm, .html, .php and .xml files on a Windows system whose contents had not yet changed from https://storageio.com to https://storageio.com. Instead of installing wingrep or some tools, using WSL such as with Ubuntu finding files can be done with grep such as:

grep "https://storageio.com" /mnt/c/Users/*.xml

And then making changes using find and sed such as:

find /mnt/c/Users -name \*.xml -exec sed  -i "s,https://storageio.com,https://storageio.com,g" {} \;

Note that not all Linux apps and tools can use file via /mnt in which case a solution is to create a symbolic link.

For example:

ln -s "/mnt/c/Users/Test1/Documents"  /home/Test1/Projects

Where To Learn More

Learn more about related technology, trends, tools, techniques, and tips with the following links.

Additional learning experiences along with common questions (and answers), as well as tips can be found in Software Defined Data Infrastructure Essentials book.

Software Defined Data Infrastructure Essentials Book SDDC

What This All Means

If you primarily work on (or have a preference for) Linux systems and need to do some functions from development to the administration or other activity on a Windows system, Windows Subsystem for Linux (WSL) provides a bash shell to do familiar tasks. Likewise, if you are primarily a Windows person and need to brush up on your Linux skills, WSL can help. If you need to run Linux server applications or workloads, put those into a Docker container, Hyper-V instance or Azure VM.

Overall I like WSL for what it is, a tool that eliminates the need of having to install several other tools to do common tasks, plus makes it easier to work across various Linux and Windows systems including bare metal, virtual and cloud-based. Now that you have been introduced to Windows Subsystems for Linux WSL and an overview including install as well as using, add it to your data infrastructure toolbox.

By the way, if you have not heard, its #Blogtober, check out some of the other blogs and posts occurring during October here.

Ok, nuff said, for now.

Gs

Greg Schulz – Microsoft MVP Cloud and Data Center Management, VMware vExpert 2010-2017 (vSAN and vCloud). Author of Software Defined Data Infrastructure Essentials (CRC Press), as well as Cloud and Virtual Data Storage Networking (CRC Press), The Green and Virtual Data Center (CRC Press), Resilient Storage Networks (Elsevier) and twitter @storageio. Courteous comments are welcome for consideration. First published on https://storageioblog.com any reproduction in whole, in part, with changes to content, without source attribution under title or without permission is forbidden.

All Comments, (C) and (TM) belong to their owners/posters, Other content (C) Copyright 2006-2024 Server StorageIO and UnlimitedIO. All Rights Reserved. StorageIO is a registered Trade Mark (TM) of Server StorageIO.

Fixing the Microsoft Windows 10 1709 post upgrade restart loop

Fixing the Microsoft Windows 10 1709 post upgrade restart loop

server storage I/O data infrastructure trends

Updated 1/21/2018

Recently I needed to upgrade one of my systems to Microsoft Windows 10 1709 (e.g. the September 2017) release that post upgrade resulted in Windows Explorer, desktop and taskbar going into an endless loop. For those not familiar with Windows 10 1709 learn more here, and here including on how to get the bits (e.g. software). Windows 10 1709 is a semi-annual channel (SAC) Microsoft is following to enable a faster cadence or pace of releases making new features available faster. Note that there is a Windows 10 1709 SAC, as well as Windows Server 2017 SAC (more on that here).

All was well with the 1709 install on Windows 10 until post upgrade when I logged into my account on my laptop (Lenovo X1). Once logged in initially everything looked good until about 10 to 20 seconds later, the screen flickered, the desktop refreshed as did the taskbar. All was well for about another 10 to 20 seconds and again the desktop refreshed as did the taskbar. Trying to use the Windows key plus other keys was no success, likewise trying to use command prompt, Powershell or other tools was futile given how quick the refresh occurred.

Powering off the system and rebooting seemed normal, until once logged in and again the desktop and taskbar reset in the same looping fashion. Once again did a shutdown and restart, logged in and the same result.

The Safe Mode Fix

Unless you can access a command prompt or Powershell with administrator privileges, boot into Windows Safe mode.

The solution to the post Windows 10 1709 upgrade desktop and taskbar restart loop was to boot into safe mode and run the following three commands.

sfc /scannow

dism.exe /online /cleanup-image /scanhealth
dism.exe /online /cleanup-image /restorehealth

Before you can run the above commands, access Windows Safe Mode. Tip if your Windows 10 system presents a login screen, in the lower right corner select the Shutdown, Restart icon holding down the SHIFT key and select Restart. Your system should reboot presenting you with the following options, selecting Troubleshoot.

Windows 10 Troubleshoot

Next select Advanced options shown below.

Windows 10 Advanced Repair Options

Next select Startup Settings shown below. Note that this sequence of commands are also used for other troubleshooting scenarios including boot problems, restore image or to a previous protection point among other options.

Windows 10 System Repair Options

The following Startup Settings screen appears, select Restart to enter Safe Mode.

Windows 10 Startup Settings

Your system should then present the following options, select Safe Mode with Command Prompt (option 6).

Windows Safe Mode Options

Next your system should display a Command Prompt where the following three commands are run:

sfc /scannow
dism.exe /online /cleanup-image /scanhealth
dism.exe /online /cleanup-image /restorehealth

Windows Command Prompt in safe mode

Exit, shutdown, reboot and all should be good.

Some Tips and Recommendations

Before any upgrade, make sure you have good backups to enable various recovery points if needed.

If you have not done so recently, make sure you have system restore enabled, as well as underlying hypervisors or storage system snapshot.

If you have bitlocker enabled, before you do any upgrade, make sure to have a copy of your keys handy if you need to use them.

If you rely on PIN or fingerprint for login, make sure you have your real password handy.

If you have not done so recently, make sure your secondary standby emergency access account is working, if you dont have one, create one.

Where To Learn More

Learn more about related technology, trends, tools, techniques, and tips with the following links.

Additional learning experiences along with common questions (and answers), as well as tips can be found in Software Defined Data Infrastructure Essentials book.

Software Defined Data Infrastructure Essentials Book SDDC

What This All Means

For those who are planning on upgrading to Windows 10 1709 or any system for that matter, being ready for the unexpected can help when the unexpected does occur. While the above is focused on Windows 10 1709 upgrade, the tips and tools including safe mode are used for many other situations. Keep in mind that if something can go wrong sometime, sometime it will go wrong, so be prepared. As for Microsoft Windows 10 1709 post upgrade, all is good and it is running well on my different systems including physical as well as virtual devices.

By the way, if you have not heard, its Blogtober, check out some of the other blogs and posts occurring during October here.

Ok, nuff said, for now.

Gs

Greg Schulz – Microsoft MVP Cloud and Data Center Management, VMware vExpert 2010-2017 (vSAN and vCloud). Author of Software Defined Data Infrastructure Essentials (CRC Press), as well as Cloud and Virtual Data Storage Networking (CRC Press), The Green and Virtual Data Center (CRC Press), Resilient Storage Networks (Elsevier) and twitter @storageio. Courteous comments are welcome for consideration. First published on https://storageioblog.com any reproduction in whole, in part, with changes to content, without source attribution under title or without permission is forbidden.

All Comments, (C) and (TM) belong to their owners/posters, Other content (C) Copyright 2006-2024 Server StorageIO and UnlimitedIO. All Rights Reserved. StorageIO is a registered Trade Mark (TM) of Server StorageIO.