Linux – Fixing ‘Input/output error’ from .bashrc in Windows Subsystem for Linux

bashwindowswindows-subsystem-for-linux

I mistakenly edited the .bashrc file for my WSL (Windows Subsystem for Linux) Bash using a Windows text editor (Notepad++).

Now whenever I run Bash I get the following error:

bash: /root/.bashrc: Input/output error

How can I fix this? I tried saving with Linux file endings (LF only) but that didn't work.

Best Answer

How can I fix this? I tried saving with Linux file endings (LF only) but that didn't work.

There are a couple of solutions:

Use a Linux / Ubuntu app to modify files these files (vim, emacs, nano, etc...).

One person said editing with nano and re-saving the file fixed the issue.

If that doesn't work you can try the nuclear option of re-installing:

In my case, nothing got it fixed. I used following command to delete BashOnWindows and then reinstall it:

lxrun /uninstall /full

lxrun /install /y

Source bash command not work for me after edit .bashrc using ST3


Further Reading

Related Question