Sunday, June 13, 2021

WSL Tips

  • Access Linux files from Windows
            After installing WSL and Linux distro, if you type \\WSL$ on the address bar of Windows Explorer, you can see all Linux distro that are installed on your machine. And from that, you can access to the file system of the Linux distro from Windows.

 

  • Access Windows files from Linux
            WSL automatically mount the Windows drive as /mnt. To access C drive, we can use /mnt/c
  • Export/Import a Distro
            If we work with multiple projects and each project need different set of tools, then we can clone the base distro by export and import with a new name.
            Export: wsl --export ...
            Import: wsl --import ...
  • Create a custom Distro from a docker container
    • Firstly, we pull a container from Docker hub 
    • Second step is to start the container with docker run  command.
    • Third step: we add user for WSL
                    useradd -m YOURUSERNAME
                    passwd YOURUSERNAME
    • Then we add /etc/wsl.conf file to let WSL know the user we created
                    echo -e "[user] \ndefault=YOURUSERNAME" > /etc/wsl.conf
    • If we want to add more configuration, we can add at this step.
    • After finish adding the configurations, we can export the Docker container to the Tar file using docker export command.
    • Then we use wsl --import  command to import the Tar file. And now we have a new Distro to run.
  • Create a custom Distro from a docker container using Docker file
            For the manual steps above, we can build a Docker file to create a custom Distro.

Thursday, June 10, 2021

Quote

 “Take the first step in faith. You don't have to see the whole staircase, just take the first step.”

― Martin Luther King Jr.

Sunday, May 16, 2021

How to run Visual Studio Code with WSL

Install Visual Studio Code on Windows.

Then make sure we install Visual Studio Code extension Remote - WSL.

Optional step: Windows has a new terminal tool that is good to communicate with Linux running in WSL. Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and custom themes, styles, and configurations. You can install it here or github.

From the WSL command line tool, in the source code folder, we can start Visual Studio Code using command Code .

And from Windows, we can edit and compile source code in WSL.

Windows Subsystem for Linux

Windows Subsystem for Linux is a great tool that let developers try Linux tools, applications directly in Windows. The Linux kernel and Windows kernel can now share system resources, such as memory and CPU. 
I am trying some open sources that cannot run on Windows. They are working well with WSL2.
  • Rocket.Chat: I compiled and run successfully.
  • Apache Airflow: Run successfully.
Beside that, from Windows, developers can use tools to code or interact with the applications, source code in WSL system. Some are:
  • Windows Terminal supports console to Linux system. 
  • Visual Studio Code supports development with source code in Linux system.

Permission error when running "Power Platform Backup Environment" in Azure DevOps

 When we run action "Power Platform Backup Environment" in Azure Devops with an App Registration account, we get the error "P...