![在 WSL 中的 Ubuntu 18.04.4 LTS 上安装软件包时出现权限问题](https://linux22.com/image/923495/%E5%9C%A8%20WSL%20%E4%B8%AD%E7%9A%84%20Ubuntu%2018.04.4%20LTS%20%E4%B8%8A%E5%AE%89%E8%A3%85%E8%BD%AF%E4%BB%B6%E5%8C%85%E6%97%B6%E5%87%BA%E7%8E%B0%E6%9D%83%E9%99%90%E9%97%AE%E9%A2%98.png)
我在尝试安装 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