Boot with your install usb/dvd and mount the hard drive in the machine and edit the file /etc/shadow on it. You need to change the sde3 to the root on your drive most likely sda2 in a single drive system installed efi. I show you the procedure on a backup drive.
root@zeus-H370M:~# mount /dev/sde3 /mnt
root@zeus-H370M:~# cat /mnt/etc/passwd | grep zeus
zeus:x:1000:1000:Zeus,,,:/home/zeus:/bin/bash
Here I show you my file the very last part of it sets your login shell change it from the /bin/zsh that will be there back to bash like I have in my file. You would need to use sudo in front of the commands, instead of cat for the second replace it with nano. Save the file when done then use sudo reboot in the terminal to restart to your system.
The procedure on a real install is to take your install drive and boot from it on the machine as if going to do another install. Since Ubuntu lets you try it, you do that. Once at desktop you go to activities and type in Terminal to start that program when it opens you use the commands I show to mount the / partition and edit the file needed with nano. This drive to mount on single drive SATA drive machine will be /dev/sda the partitions /dev/sda1, /dev/sda2 if setup as single partition EFI install or just the /dev/sda1 for MBR single partition install. On EFI it is the 2 you need to mount for the edit of the file on MBR the 1 partition is mounted. Edit the file change it back to bash and when you reboot your machine it is whole again and you can login. If you can find the procedure to mount the drive in Windows you may be able to mount it and do the editing.
wsl -u root
orwsl -d <distrib> -u root
if you have more than one distrib)? If so, you should be able tochsh
the user account from there.wsl -u root
and ranchsh -s $(which bash)
, but when I ran ubuntu, it didn't work. So yes, I could login to the "root account", but running the chsh didn't affect ubuntu.exechsh -s $(which bash)
will change root's default shell; to change a user's shell you would needchsh -s $(which bash) <username>
(where<username>
is replaced by the actual login name of your wsl user)