0

Background

I was downloading cuda-toolkit-10-1, following the guideline in https://docs.nvidia.com/cuda/wsl-user-guide/index.html, including updating my WSL from version 1 to 2. Near the end of my installation via apt-get install when my memory presumably ran out while unpacking with the error message: dpkg: error processing archive /tmp/<cuda_vers>.deb: error setting permissions of <file.so>: Read-only file system with an error code (2).

I've freed some memory and tried re-installing via apt-get, but an error message dpkg was interrupted, you must manually run 'sudo dpkg --configure -a to correct the problem, for which I tried with failure dpkg: error: unable toa ccess dpkg status area: Read-only file system.

Problem

I now cannot run most commands. Here are a few with their respective error messages ls: -bash: /bin/ls: Input/output error df -u: Sorry, command-not-found has crashed! Please file a bug report..., Python version: ...

Please let me know anything I can do to resolve this issue, or what other information is necessary.

0

2 Answers 2

11

Presumably it's too late to help the original asker, but I had the same issue today, found this question while troubleshooting it, and did manage to fix my WSL installation, so I figured I'd leave some instructions for anyone else who finds this page.

Ordinarily, the virtual hard disk (VHD) that WSL uses will resize itself automatically as you store more and more data on it. However, it will stop growing if your Windows computer is running out of space (this is what happened to me), and even if you do have space available, it won't grow larger than 256 GB on its own.

  • If you're low on space on your actual hard drive: free up some space within Windows, then open PowerShell and run wsl --shutdown to force WSL to restart. (By default, WSL stays running in the background even when you've closed all your terminal windows, so you have to do this manually.) Next time you open a WSL terminal, the VHD should grow automatically, and you should be able to access the filesystem normally again.

  • If you have space on your actual hard drive but you've hit the 256 GB limit for the VHD, you can follow these instructions in the WSL docs to manually resize the image and then restart WSL.

It's probably a good idea to run e2fsck after this. (In my case, it didn't report any errors, but it's better to be on the safe side.)

3
  • 1
    Welcome to the site. Please be assured that since questions and answers on this site are intended not only to provide immediate help to the original poster but also serve as reference for anyone who might stumble upon this or a similar problem in the future, "late" contributions to questions are always appreciated.
    – AdminBee
    Commented Jul 15, 2021 at 7:57
  • 1
    In my case, I have more than enough space on my windows (~300 GB), yet I had the same error in my WSL, just shutting it down and restarting it did the trick. Commented Sep 28, 2021 at 7:38
  • UPDATE: the link to the docs doesn't work anymore, try this instead. Commented Mar 8, 2022 at 17:00
0

Generally, the text “input/output error” means that an EIO error occurred. This is usually an indication that the disk or file system is having a problem. In your case, it may be either the emulated file system for WSL, or your actual hard disk. This is supported by the fact that you also get “read-only file system,” since ext4 mounts your file system read only when it detects an integrity problem.

I'd first run a disk check on your system to make sure your actual hard disk is okay. If so, you'll want to run sudo e2fsck -p on your drive, and you'll also need to specify the device. You can find the device by running sudo dmesg -n and finding the device (e.g., if you see sda having I/O errors, then use /dev/sda) or by running sudo file -sL /dev/sd* and finding the one that has an ext4 file system specified.

If your system is so broken that you can't find the device or run e2fsck, then you'll need to reinstall your WSL system.

2
  • e2fsck won't run, so I guess the only option would be to reinstall WSL? Could you explain how running out of disk space while installing a package could result in this kind of EIO error?
    – rhdxor
    Commented Dec 19, 2020 at 9:23
  • I suspect that's going to be your only option. Normally running out of disk space doesn't result in this error; that's a condition that the OS usually handles gracefully. So I'd say it's either a WSL problem or an existing issue with your instance that just manifested at that point.
    – bk2204
    Commented Dec 19, 2020 at 18:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .