在 WSL 中的 Ubuntu 18.04.4 LTS 上安装软件包时出现权限问题

在 WSL 中的 Ubuntu 18.04.4 LTS 上安装软件包时出现权限问题

我在尝试安装 Gazebo 时遇到了这个权限问题:

The following packages will be upgraded:
  gcc-8-base libgcc1 libstdc++6
3 upgraded, 258 newly installed, 0 to remove and 33 not upgraded.
Need to get 0 B/147 MB of archives.
After this operation, 530 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Extracting templates from packages: 100%
Selecting previously unselected package fontconfig.
(Reading database ... 29242 files and directories currently installed.)
Preparing to unpack .../fontconfig_2.12.6-0ubuntu2_amd64.deb ...
dpkg: unrecoverable fatal error, aborting:
 unable to install updated status of 'fontconfig': Permission denied
E: Sub-process /usr/bin/dpkg returned an error code (2)
root@DESKTOP-U522U9A:/mnt/c/Windows/system32#

我已经在 WSL 上重新安装了 Ubuntu,但问题仍然存在。我在管理 Windows 命令提示符内打开了 bash,但没有成功。

这些是我安装后运行的唯一命令:

$ sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'   
$ wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
$ sudo apt-get update       
$ sudo apt-get install gazebo9

相关内容