我下载了 Ubuntu,因为我需要在 PC 上运行 Linux 软件(MUMmer,一种生物信息学工具)。我尝试按照此网站的说明进行操作:https://docs.microsoft.com/en-us/windows/wsl/setup/environment#set-up-your-linux-user-info然后我到了需要更新和升级软件包的步骤,我必须输入:
sudo apt update && sudo apt upgrade
我收到以下错误:第一个错误
我尝试用谷歌搜索它并它说尝试:
sudo apt-get update
但是当我这样做时,我收到了这些错误:
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
Couldn't create temporary file /tmp/apt.conf.waoP04 for passing config to apt-key
Ign:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Ign:3 http://security.ubuntu.com/ubuntu focal-security InRelease
Ign:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Err:5 http://security.ubuntu.com/ubuntu focal-security Release
Could not open file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_focal-security_Release - open (30: Read-only file system) [IP: 91.189.88.152 80]
Err:6 http://archive.ubuntu.com/ubuntu focal-updates Release
Could not open file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_focal-updates_Release - open (30: Read-only file system) [IP: 91.189.88.142 80]
Err:7 http://archive.ubuntu.com/ubuntu focal-backports Release
Could not open file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_focal-backports_Release - open (30: Read-only file system) [IP: 91.189.88.152 80]
Reading package lists... Error!
W: chown to _apt:root of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (30: Read-only file system)
W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (30: Read-only file system)
W: chown to _apt:root of directory /var/lib/apt/lists/auxfiles failed - SetupAPTPartialDirectory (30: Read-only file system)
W: chmod 0700 of directory /var/lib/apt/lists/auxfiles failed - SetupAPTPartialDirectory (30: Read-only file system)
W: Not using locking for read only lock file /var/lib/apt/lists/lock
W: Problem unlinking the file /var/lib/apt/lists/partial/.apt-acquire-privs-test.Auv1Lz - IsAccessibleBySandboxUser (30: Read-only file system)
W: Problem unlinking the file /var/lib/apt/lists/partial/.apt-acquire-privs-test.bTmzQz - IsAccessibleBySandboxUser (30: Read-only file system)
W: Problem unlinking the file /var/lib/apt/lists/partial/.apt-acquire-privs-test.x6Yb4z - IsAccessibleBySandboxUser (30: Read-only file system)
W: Problem unlinking the file /var/lib/apt/lists/partial/.apt-acquire-privs-test.14iUqA - IsAccessibleBySandboxUser (30: Read-only file system)
W: Problem unlinking the file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_focal_InRelease - PrepareFiles (30: Read-only file system)
W: chown to _apt:root of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_focal_InRelease failed - Item::QueueURI (30: Read-only file system)
W: chmod 0600 of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_focal_InRelease failed - Item::QueueURI (30: Read-only file system)
W: chown to root:root of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_focal_InRelease failed - 400::URIFailure (30: Read-only file system)
W: chmod 0644 of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_focal_InRelease failed - 400::URIFailure (30: Read-only file system)
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://archive.ubuntu.com/ubuntu focal InRelease: Couldn't create temporary file /tmp/apt.conf.waoP04 for passing config to apt-key
W: Problem unlinking the file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_focal-updates_InRelease - PrepareFiles (30: Read-only file system)
W: Problem unlinking the file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_focal-security_InRelease - PrepareFiles (30: Read-only file system)
W: Problem unlinking the file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_focal-backports_InRelease - PrepareFiles (30: Read-only file system)
W: Problem unlinking the file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_focal-security_Release - PrepareFiles (30: Read-only file system)
E: The repository 'http://security.ubuntu.com/ubuntu focal-security Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Problem unlinking the file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_focal-updates_Release - PrepareFiles (30: Read-only file system)
E: The repository 'http://archive.ubuntu.com/ubuntu focal-updates Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Problem unlinking the file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_focal-backports_Release - PrepareFiles (30: Read-only file system)
E: The repository 'http://archive.ubuntu.com/ubuntu focal-backports Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (30: Read-only file system)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (30: Read-only file system)
E: Unable to mkstemp /tmp/clearsigned.message.osv9ux - GetTempFile (30: Read-only file system)
E: The package lists or status file could not be parsed or opened.
它说尝试
sudo apt-get install wget ca-certificates
但我收到了这个错误:
W: Not using locking for read only lock file /var/lib/dpkg/lock-frontend
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
跑步后
sudo dpkg --configure -a
我收到此错误:
dpkg: error: unable to access the dpkg database directory /var/lib/dpkg: Read-only file system
我尝试寻找解决方案,但不幸的是,我不知道这一切是什么或意味着什么。我不知道这个 /var/lib/dkkg 目录是什么,也不知道它在哪里,也不知道我需要做什么。
我尝试忽略此错误并继续执行其他步骤,下载 anaconda,然后我需要下载 biocondna,但随后出现此错误:
wget: error while loading shared libraries: /lib/x86_64-linux-gnu/libpsl.so.5: cannot read file data: Input/output error
任何帮助我都会非常感激,因为我开始感到绝望了。提前谢谢您。
编辑:powershell 的输出。输出
编辑编号 2:安装 anaconda 时出现错误,更多 RO 内容。:
/home/noor/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/home/noor/anaconda3] >>>
PREFIX=/home/noor/anaconda3
installing: python-3.7.0-hc3d631a_0 ...
Python 3.7.0
installing: blas-1.0-mkl ...
installing: ca-certificates-2018.03.07-0 ...
installing: conda-env-2.6.0-1 ...
installing: intel-openmp-2019.0-118 ...
installing: libgcc-ng-8.2.0-hdf63c60_1 ...
installing: libgfortran-ng-7.3.0-hdf63c60_0 ...
installing: libstdcxx-ng-8.2.0-hdf63c60_1 ...
installing: bzip2-1.0.6-h14c3975_5 ...
installing: expat-2.2.6-he6710b0_0 ...
installing: fribidi-1.0.5-h7b6447c_0 ...
installing: gmp-6.1.2-h6c8ec71_1 ...
installing: graphite2-1.3.12-h23475e2_2 ...
installing: icu-58.2-h9c2bf20_1 ...
installing: jbig-2.1-hdba287a_0 ...
installing: jpeg-9b-h024ee3a_2 ...
installing: libffi-3.2.1-hd88cf55_4 ...
installing: libsodium-1.0.16-h1bed415_0 ...
installing: libtool-2.4.6-h544aabb_3 ...
installing: libuuid-1.0.3-h1bed415_2 ...
installing: libxcb-1.13-h1bed415_1 ...
installing: lzo-2.10-h49e0be7_2 ...
installing: mkl-2019.0-118 ...
tar: lib/libmkl_vml_avx512.so: Wrote only 1536 of 10240 bytes
tar: lib/libmkl_vml_avx512.so: Cannot utime: Read-only file system
tar: lib/libmkl_vml_avx2.so: Cannot open: Read-only file system
tar: lib/libmkl_vml_avx.so: Cannot open: Read-only file system
tar: lib/libmkl_vml_avx512_mic.so: Cannot open: Read-only file system
tar: lib/libmkl_sequential.so: Cannot open: Read-only file system
tar: lib/libmkl_gnu_thread.so: Cannot open: Read-only file system
tar: lib/libmkl_tbb_thread.so: Cannot open: Read-only file system
tar: lib/libmkl_pgi_thread.so: Cannot open: Read-only file system
tar: lib/libmkl_intel_thread.so: Cannot open: Read-only file system
tar: lib/libmkl_def.so: Cannot open: Read-only file system
tar: lib/libmkl_mc.so: Cannot open: Read-only file system
tar: lib/libmkl_mc3.so: Cannot open: Read-only file system
tar: lib/libmkl_avx.so: Cannot open: Read-only file system
tar: lib/libmkl_avx2.so: Cannot open: Read-only file system
tar: lib/libmkl_avx512.so: Cannot open: Read-only file system
tar: lib/libmkl_core.so: Cannot open: Read-only file system
tar: lib/libmkl_avx512_mic.so: Cannot open: Read-only file system
tar: Exiting with failure status due to previous errors
答案1
我们在评论和聊天中发现,您在安装 WSL 的 Windows 驱动器上耗尽了磁盘空间。这导致 WSL 将该驱动器标记为对 Ubuntu 只读,从而掩盖了真正的问题。
一旦发生这种情况,就不可能恢复来自 Ubuntu。WSL2 使用的虚拟磁盘将生长当文件添加到它时,但它不会自动收缩当数据被删除时。有解决方法,但我认为无论如何你都需要可用的磁盘空间才能使用它们。
因此,由于这是新安装的 Ubuntu,并且您已经删除了以前的版本,我建议我们从卸载所有当前的 WSL 实例(Ubuntu 和 Ubuntu 20.04)开始。这将至少恢复一些空间视窗正常运行,因为您可能也会在那里看到错误。
但是,由于您的磁盘空间相当低,这显然不够。在尝试重新安装 WSL/Ubuntu 和 Anaconda 之前,您需要在 Windows 端释放一些空间。
如果可以的话,我建议 4GB。基础 WSL/Ubuntu 安装大约需要 1.7GB(我记得)。然后你需要进行更新、Anaconda 安装,以及可能的数据。而且 Windows 也需要一些可用磁盘空间来满足其目的。你可以大概让它使用 3GB 工作,但是如果可以的话我真的会尝试 4GB。
我有点惊讶 Windows 没有弹出“磁盘空间不足”警告并提示运行磁盘清理选项,但至少从那里开始。从“开始”菜单中,键入“磁盘清理”,看看可以恢复多少空间。天哪 - 我自己那里就有 27GB!希望你也能这么幸运!
好的,继续此操作,因为您没有太多空间可以回收C:
,但您的驱动器上似乎有更多的空间D:
。
如果尚未删除,请先删除两个现有的 WSL 发行版。这至少应该会给你足够的空间来开始。
然后像以前一样重新安装“Ubuntu”。启动一次以创建您的用户/密码,然后退出。我们已经确定您至少应该有足够的磁盘空间来C:
执行此操作。
现在,转到 PowerShell:
# Modify this first line if you'd like to use a different location
$WSL_BASE = "D:\WSL"
mkdir "$WSL_BASE\instances\Ubuntu"
mkdir "$WSL_BASE\images"
cd "$WSL_BASE"
wsl --export Ubuntu "$WSL_BASE\images\ubuntu.tar"
# The "UbuntuD" in the next line can be whatever you want to name it
wsl --import UbuntuD "$WSL_BASE\instances\Ubuntu" "$WSL_BASE\images\ubuntu.tar" --version 2
wsl ~ -d UbuntuD
您现在应该处于我们在驱动器上安装的 UbuntuD 中D:
。您应该是 root,因为 WSL 在运行时不会“记住”您的默认用户名--import
。我们可以用以下命令进行设置:
重要提示 - 以下代码块是多行命令,大多数应一次运行(不要像其他命令那样逐行运行)。
同样重要的是 - 在粘贴以下内容之前修改此行中的“用户名”:
sudo sh -c "( cat << EOF
[user]
default=username
EOF
) > /etc/wsl.conf"
exit
返回 PowerShell。然后wsl --terminate UbuntuD
从 PowerShell。
从 PowerShell:
wsl --set-default UbuntuD
wsl ~
尝试sudo apt update && sudo apt upgrade
并再次安装 Anaconda。
希望这能为您提供所需的空间。
现在卸载“Ubuntu”,以便您重新获得空间C:
。
请注意,我预计,您的磁盘空间非常低C:
将继续成为其他 Windows 应用程序的主要问题,但至少目前对于 WSL 来说不是。
还建议从 Microsoft Store 安装 Windows Terminal。它将获取你的新 WSL 发行版并自动为其创建配置文件。