Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkdir: cannot create directory ‘test’: Read-only file system #4833

Closed
ravitej177 opened this issue Jan 21, 2020 · 4 comments
Closed

mkdir: cannot create directory ‘test’: Read-only file system #4833

ravitej177 opened this issue Jan 21, 2020 · 4 comments
Labels

Comments

@ravitej177
Copy link

ravitej177 commented Jan 21, 2020

So After updating to the windows build 19546.

I'm not able to create any files it says "mkdir: cannot create directory ‘test’: Read-only file system". I tried shutting down my wsl with "wsl --shutdown". But the issue still persists.

I tried running "sudo dmesg -w"

This is the output:

[...]
[   61.817914] WSL2: Performing memory compaction.
[   75.181138] scsi 0:0:0:1: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 5
[   75.181751] sd 0:0:0:1: Attached scsi generic sg1 type 0
[   75.182805] sd 0:0:0:1: [sdb] 536870912 512-byte logical blocks: (275 GB/256 GiB)
[   75.182807] sd 0:0:0:1: [sdb] 4096-byte physical blocks
[   75.182952] sd 0:0:0:1: [sdb] Write Protect is off
[   75.182954] sd 0:0:0:1: [sdb] Mode Sense: 0f 00 00 00
[   75.183216] sd 0:0:0:1: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   75.187010] sd 0:0:0:1: [sdb] Attached SCSI disk
[   75.205015] EXT4-fs (sdb): warning: mounting fs with errors, running e2fsck is recommended
[   75.207945] EXT4-fs (sdb): recovery complete
[   75.208576] EXT4-fs (sdb): mounted filesystem with ordered data mode. Opts: discard,errors=remount-ro,data=ordered
[...]
@0xbadfca11
Copy link

0xbadfca11 commented Jan 21, 2020

[ 0.948745] EXT4-fs (sdb): warning: mounting fs with errors, running e2fsck is recommended

Your Linux filesystem has corrupted.
Run sudo e2fsck /dev/sdb -p manually.
WSL does not have a mechanism to automatically execute fsck at startup.

If that doesn't work, you will need to reinstall the WSL distribution.

@therealkenc
Copy link
Collaborator

Your Linux filesystem has corrupted.

Looks like. Use e2fsck -n because...

...in general it is not safe to run e2fsck on mounted filesystems. The only exception is if the -n option is specified, and -c, -l, or -L options are not specified.

This submission could in principle be coerced into a feature request to run e2fsck in WSL /init automatically if the filesystem is corrupt and mounted read-only (like systemd). But that's probably better as a standalone new issue, with 0xbadfca11's answer as standard operating procedure in the meantime. "WSL /init should do more stuff" death-march to systemd type requests (#2530) at least historically haven't gotten a lot of traction.

@ravitej177
Copy link
Author

Thank you @0xbadfca11 @therealkenc.
Running sudo e2fsck /dev/sdb -p then restarting wsl fixed my issue.

@Abdulmuhaimin-Ali
Copy link

Hey guys @0xbadfca11 @therealkenc.

This is what I get after I run sudo e2fsck /dev/sdb -p.
sudo: unable to execute /usr/sbin/e2fsck: Input/output error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants