Skip to main content

Deals You Can't Miss

1 Year Subscription

Setting Default User For Imported WSL Distro

I have a dual hard-drive laptop with the primary being an SSD for quick-boot and the secondary being an HDD. The primary one, unfortunate for today's demand is a little too less in space of just 250 GB but the secondary one is good with 1 TB in space. 

 As a discipline, as much as possible I host most of my files and software installations in my largish secondary drive. As with WSL, when you install it from Microsoft Store (earlier known as Windows Store), it defaults to windows operating system location, which becomes my space constrained primary drive. 

To preserve the space in my primary drive, I wanted to change the storage location of my WSL distro to my secondary drive. This is possible with WSL import/export commands. See WSL Cheatsheet for reference. 

After you import a WSL distribution, you may need to tell WSL 2 to start the distribution using the Linux user account you created when you first created the distribution. Unfortunately, this is not taken care of by default from the export/import procedure; see WSL/Issue in Github, if you are curious. 

The Microsoft Docs however proposes a way to change the default user for a distro, which didn't work for me for some reason. This is what you should try first, which is about executing something like `ubuntu config --default-user my_default_username` depending upon the name of your distro executable. 

Microsoft Docs also proposes a distro specific configuration that you can make with `wsl.conf`. This is a per distro launch configuration setting. Using this you can automatically configure certain functionality in WSL that will be applied every time you launch the subsystem using `wsl.conf`. This file is located in `/etc/wsl.conf` of your target distro, where the contents looks like below:

-- --

Now if even this fails, know the DefaultUid of this user who you wanted to make a default one and use that in setting it up manually in the windows registry like below screenshot:


In the screen-shot above, I had exported my Ubuntu-20.04 distro where I had created a default username kartz at the time of its installation from Microsoft Store. Ubuntu-20 is the new distro that was created by importing from the exported image tar file and I wanted to have kartz as the default username in this distro, because I have my working environment all set to this user in this distro created from imported image. Apparently in my case the value turned out to be 1000.

For easy copy-edit-pasting, I share the snippet below as gist:

---- 

Hope that get you going easy with WSL 2!!..

My Popular Posts

Ten Commandments of Egoless Programming

We are nothing but the values we carry. All through my life thus far, I tried to influence people around me with the virtues I value. Thanks to some good reading habits I had inculcated, and the fortune of being in good community of peers and mentors alike, I managed to have read some real good books. This post is about the 10 commands of egoless programming in Weinberg's book. I shall explain the commandments based on my experience here. So very many decades ago, Gerald M. Weinberg authored  The Psychology of Computer Programming . In it, he listed The Ten Commandments of  Egoless Programming , which remains relevant even today for us as not just programmers but as team-members. Weinberg is regarded as a pioneer in taking a people-centric approach to computing, and his work endures as a good guide to intelligence, skill, teamwork, and problem-solving power of a developer. When they appear to inspire and instruct, we find that they can apply to just about every business area, and e

Should I buy refurbished laptop from Amazon?

This post is based on my experience with amazon.in and guess it to be true on all other platforms as well. At least you can check out and verify for these pointers before you make that decision to buy renewed/refurbished laptop on Amazon with your hard earned money. I see this question propping up in several forums and on many different occasions. In the recent past, I had my 5 year old dell laptop that gave up because its motherboard failed. One of the options that I had in my mind was to re-use the HDD and the 16GB DDR4 RAM of that old laptop in the one that I purchase next as secondary.  I had come to a conclusion that it is not worth buying a refurbished/renewed laptop at all. Why? For the following reasons, most of which I see as BIG #RedFlags: You got to remember that Amazon provides a platform for 3rd party sellers to sell their products as well. So in your search for refurbished laptops you wouldn’t want to choose some random 3rd party seller who Amazon doesn’t endorse. You cou

Multi-tenant Architectures

  Multi-tenancy Application Deployment Architecture could be modeled in 4 broad ways: Separate Apps & Separate Databases Shared Apps & Shared Databases Separate Apps & Shared Databases Shared Apps & Separate Databases There is no right or wrong here. It's about choice and consequence that you should consider taking into your business context and constraints. In this post I intend to jot down a some key points to keep in mind for each of these multi-tenant architecture. These are more of quick notes for my quick reference, a cheat-sheet of sorts when I have to make choices. And I guess this can come handy to you too in your wise decision making. Separate Apps & Separate Databases Easiest to implement from development and deployment stand-point. Just automate the deployment infrastructure for every tenant for quick set-up. Most expensive of all the models from infrastructure cost stand-point. Relatively longer deployment t