📜  wsl 2 reboot ubuntu - Shell-Bash (1)

📅  最后修改于: 2023-12-03 14:48:35.298000             🧑  作者: Mango

WSL 2 Reboot Ubuntu - Shell-Bash

Introduction

This guide provides detailed instructions on rebooting Ubuntu in Windows Subsystem for Linux (WSL) 2 using Shell-Bash. WSL 2 is a compatibility layer for running Linux binary executables natively on Windows 10 and Windows Server 2019.

Prerequisites

Before rebooting Ubuntu in WSL 2, ensure that the following prerequisites are met:

  • Windows 10 or Windows Server 2019 with WSL 2 installed and enabled.
  • Ubuntu installed in WSL. If not already installed, you can install it from the Microsoft Store or by following the official Ubuntu installation guide.
Steps to Reboot Ubuntu in WSL 2

Follow the steps below to reboot Ubuntu in WSL 2 using Shell-Bash:

Step 1: Launch Shell-Bash
  • Open the Start menu on your Windows system.
  • Search for "Ubuntu" and click on the Ubuntu app to launch WSL.
Step 2: Check WSL Version
  • Open a Bash terminal in Ubuntu.
  • Run the following command to check the WSL version:
wsl --set-version Ubuntu-20.04 2
Step 3: Reboot Ubuntu in WSL 2
  • Once you have confirmed that WSL is set to version 2, you can proceed with the reboot.
  • Run the following command in the terminal to reboot Ubuntu in WSL 2:
sudo reboot
  • Provide the sudo password when prompted and confirm the reboot action.
Step 4: Verify WSL 2 Reboot
  • After the reboot, open a new terminal in Ubuntu.
  • Run the following command to verify that Ubuntu is running in WSL 2:
wsl -l -v
  • The command will display a list of installed distributions and their respective WSL versions. Ensure that the Ubuntu distribution shows version 2.
Conclusion

By following the above steps, you should now be able to reboot Ubuntu in WSL 2 using Shell-Bash. WSL 2 provides an efficient and seamless environment for running Linux tools and applications on a Windows system. Feel free to explore and enjoy the benefits of this powerful combination of Windows and Linux.