Microsoft Warns Bash on Windows Users About Linux File Changes
Microsoft may love Linux, but that love has some technical limitations, at least when it comes to using Windows tools to alter Linux files.
This week, Microsoft offered the equivalent of a nun's ruler smack to users of Bash on Windows, a command-line shell that's more usually known as a tool for Linux developers and IT pros. Apparently, some Bash on Windows users have been trying to alter Linux files using Microsoft tools, including poking at hidden files in the local Linux file folder, which is known as %localappdata%\lxss\.
Bash on Windows, and other Windows tools, just shouldn't be used to alter Linux files, Microsoft warned in an announcement.
"DO NOT, under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc.,"the announcement stated.
The Linux Virtual File System saves file metadata in a way that's different from the Windows NTFS approach. This metadata information gets lost when using Windows tools to alter Linux files. It can lead to files getting corrupted, and even more problems to fix, Microsoft warned.
"Creating/changing Linux files from Windows will likely result in data corruption and/or damage your Linux environment requiring you to uninstall & reinstall your distro!," Microsoft's announcement added.
Microsoft's warnings seemed to irk Hacker News readers, based on this commentary series. The comments range from accusatory, saying that Microsoft did not provide proper warnings or preventative measures, to supportive ones suggesting that Microsoft did try to hide the files at least.
Microsoft's statement, "Remember: There's a reason we gave the %localappdata%\lxss\ folder 'hidden' & 'system' attributes," seems to have generated particular ire, perhaps because the message seemed to be telling users what they could and could not do. However, one reader commented that Microsoft isn't saying that the files can't be changed, it's just that Microsoft's tools shouldn't be used.
The Hacker News comments sometimes described contradictory experiences. For instance, one respondent stated that when a user tries to see the hidden Linux files, a warning appears, indicating that the system can be harmed if the files get modified. Another respondent said that there's no such warning at all.
Bash on Windows is still at the preview stage and is based on Ubuntu Linux code provided by Canonical. It taps the Windows Subsystem for Linux that's natively built into Windows 10, which Microsoft unveiled back in late March. Microsoft's idea in adding Bash shell capabilities to Windows was simply to make the tooling easier to access for organizations that run Linux-based workloads alongside Windows-based ones. Users also get access to scripts and expertise from the Linux side of things with Bash on Windows.
Microsoft has lots of resources to understand the differences between the Linux Virtual File System and Windows NTFS file system and what its engineers did to make the Bash shell run natively on Windows, which is highlighted in this blog post. There's also a video series on the topic, featuring Microsoft experts.
The nuts and bolts of the Windows Subsystem for Linux are diagrammed by Microsoft's Sven Groot, Ph.D., in this post. He explained that NTFS uses "extended attributes" to handle Linux files, but those attributes get lost when the files are copied or modified using Windows tools.
"You can see all of your [Linux] files in Windows, but if you copy a file from somewhere else into this folder and then go into Bash, you won't see it," Groot said. "Because that file doesn't have the extended attributes on it, so we don't know what to do with it. And, unfortunately, if you go into here and you open a file with Notepad or whatever and try to edit it, a lot of the time text editors, when you save a file, they'll create a new file and replace the old one, which means now the extended attributes are gone, and again we don't know what to do with the file."
Kurt Mackie is senior news producer for the 1105 Enterprise Computing Group.