安装ttf-mscorefonts-installer时的权限错误/无法删除权限,因为用户’_apt’无法访问文件

我想在16.04上安装Microsoft字体并运行下面的命令,但是有很多错误(或仅警告?)关于用户_apt对下载的.exe文件没有权限。

命令:

 sudo apt install ttf-mscorefont-installer 

错误消息(对每个下载的字体exe重复):

 ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/andale32.exe Get:1 http://downloads.sourceforge.net/corefonts/andale32.exe [198 kB] Fetched 198 kB in 1s (180 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/andale32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) 

但最终它仍然表示安装成功。 那么这只是软件包安装脚本中的一个错误,或者我这边有什么问题吗? 我是否需要采取进一步行动?

完整输出(原始输出与--reinstall相同):

 $ sudo apt install --reinstall ttf-mscorefonts-installer Reading package lists... Done Building dependency tree Reading state information... Done 0 to upgrade, 0 to newly install, 1 reinstalled, 0 to remove and 4 not to upgrade. Need to get 29,5 kB of archives. After this operation, 0 B of additional disk space will be used. Get:1 http://ftp.uni-stuttgart.de/ubuntu xenial/multiverse amd64 ttf-mscorefonts-installer all 3.4+nmu1ubuntu2 [29,5 kB] Fetched 29,5 kB in 0s (280 kB/s) Preconfiguring packages ... (Reading database ... 214933 files and directories currently installed.) Preparing to unpack .../ttf-mscorefonts-installer_3.4+nmu1ubuntu2_all.deb ... mscorefonts-eula license has already been accepted Unpacking ttf-mscorefonts-installer (3.4+nmu1ubuntu2) over (3.4+nmu1ubuntu2) ... Processing triggers for fontconfig (2.11.94-0ubuntu1) ... Processing triggers for update-notifier-common (3.168) ... ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/andale32.exe Get:1 http://downloads.sourceforge.net/corefonts/andale32.exe [198 kB] Fetched 198 kB in 1s (180 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/andale32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/arial32.exe Get:1 http://downloads.sourceforge.net/corefonts/arial32.exe [554 kB] Fetched 554 kB in 1s (466 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/arial32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/arialb32.exe Get:1 http://downloads.sourceforge.net/corefonts/arialb32.exe [168 kB] Fetched 168 kB in 0s (169 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/arialb32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/comic32.exe Get:1 http://downloads.sourceforge.net/corefonts/comic32.exe [246 kB] Fetched 246 kB in 1s (224 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/comic32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/courie32.exe Get:1 http://downloads.sourceforge.net/corefonts/courie32.exe [646 kB] Fetched 646 kB in 1s (472 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/courie32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/georgi32.exe Get:1 http://downloads.sourceforge.net/corefonts/georgi32.exe [392 kB] Fetched 392 kB in 1s (364 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/georgi32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/impact32.exe Get:1 http://downloads.sourceforge.net/corefonts/impact32.exe [173 kB] Fetched 173 kB in 0s (176 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/impact32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/times32.exe Get:1 http://downloads.sourceforge.net/corefonts/times32.exe [662 kB] Fetched 662 kB in 2s (235 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/times32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/trebuc32.exe Get:1 http://downloads.sourceforge.net/corefonts/trebuc32.exe [357 kB] Fetched 357 kB in 1s (307 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/trebuc32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/verdan32.exe Get:1 http://downloads.sourceforge.net/corefonts/verdan32.exe [352 kB] Fetched 352 kB in 4s (85,7 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/verdan32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/webdin32.exe Get:1 http://downloads.sourceforge.net/corefonts/webdin32.exe [185 kB] Fetched 185 kB in 0s (210 kB/s) W: Can't drop privileges for downloading as file '/var/lib/update-notifier/package-data-downloads/partial/webdin32.exe' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) These fonts were provided by Microsoft "in the interest of cross- platform compatibility". This is no longer the case, but they are still available from third parties. You are free to download these fonts and use them for your own use, but you may not redistribute them in modified form, including changes to the file name or packaging format. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/andale32.exe extracting fontinst.inf extracting andale.inf extracting fontinst.exe extracting AndaleMo.TTF extracting ADVPACK.DLL extracting W95INF32.DLL extracting W95INF16.DLL All done, no errors. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/arial32.exe extracting FONTINST.EXE extracting fontinst.inf extracting Ariali.TTF extracting Arialbd.TTF extracting Arialbi.TTF extracting Arial.TTF All done, no errors. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/arialb32.exe extracting fontinst.exe extracting fontinst.inf extracting AriBlk.TTF All done, no errors. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/comic32.exe extracting fontinst.inf extracting Comicbd.TTF extracting Comic.TTF extracting fontinst.exe All done, no errors. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/courie32.exe extracting cour.ttf extracting courbd.ttf extracting courbi.ttf extracting fontinst.inf extracting couri.ttf extracting fontinst.exe All done, no errors. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/georgi32.exe extracting fontinst.inf extracting Georgiaz.TTF extracting Georgiab.TTF extracting Georgiai.TTF extracting Georgia.TTF extracting fontinst.exe All done, no errors. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/impact32.exe extracting fontinst.exe extracting Impact.TTF extracting fontinst.inf All done, no errors. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/times32.exe extracting fontinst.inf extracting Times.TTF extracting Timesbd.TTF extracting Timesbi.TTF extracting Timesi.TTF extracting FONTINST.EXE All done, no errors. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/trebuc32.exe extracting FONTINST.EXE extracting trebuc.ttf extracting Trebucbd.ttf extracting trebucbi.ttf extracting trebucit.ttf extracting fontinst.inf All done, no errors. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/verdan32.exe extracting fontinst.exe extracting fontinst.inf extracting Verdanab.TTF extracting Verdanai.TTF extracting Verdanaz.TTF extracting Verdana.TTF All done, no errors. Extracting cabinet: /var/lib/update-notifier/package-data-downloads/partial/webdin32.exe extracting fontinst.exe extracting Webdings.TTF extracting fontinst.inf extracting Licen.TXT All done, no errors. All fonts downloaded and installed. Setting up ttf-mscorefonts-installer (3.4+nmu1ubuntu2) ... 

这是#1543280的错误,虽然是一个相当无害的bug。 安装成功完成。 W:表示这只是一个警告。

另请注意,这与包ttf-mscorefonts-installer ,相反,只要apt访问已经下载的文件,您就会看到此警告。 它也适用于离线存储库。 我有离线存储库,我用它来更新没有Internet的软件包,我自己也总是在Xenial(16.04)中看到这个。 根本不是一个大问题。

为方便起见,我将展示从本地存储库重新安装xrdp的输出。

 sudo apt-get --reinstall install xrdp Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 398 not upgraded. Need to get 0 B/215 kB of archives. After this operation, 0 B of additional disk space will be used. Get:1 file:/media/Linux/linux_debs_repo/xenial_new xrdp 0.6.1-2 [215 kB] (Reading database ... 612447 files and directories currently installed.) Preparing to unpack ..././debs/xrdp_0.6.1-2_amd64.deb ... Unpacking xrdp (0.6.1-2) over (0.6.1-2) ... Processing triggers for systemd (229-4ubuntu6) ... Processing triggers for ureadahead (0.100.0-19) ... ureadahead will be reprofiled on next reboot Processing triggers for man-db (2.7.5-1) ... Setting up xrdp (0.6.1-2) ... N: Can't drop privileges for downloading as file '/media/Linux/linux_debs_repo/xenial_new/./debs/xrdp_0.6.1-2_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) 

查看关于Apt在Unix和Linux SE apt-get update退出状态中的状态的问题

另一个相关的错误是#1570141

根本问题

无法删除下载权限,因为用户’_ apt’无法访问文件’/var/lib/update-notifier/package-data-downloads/partial/webdin32.exe’。

这表明_apt用户无权写入/var/lib/update-notifier/package-data-downloads/partial目录或其中的任何现有文件。 因此,安装将无法提取字体文件 – 反过来 – 更新(或第一次安装)指示的字体。

我认为因为当前接受的答案( https://askubuntu.com/a/812152/269638 )不正确安装包。

你该怎么办?

首先,您需要使用以下命令validation您是否拥有_apt用户:

 getent passwd _apt 

如果由于某种原因您没有_apt用户并需要安装说明,请转到上面指示的链接 。

接下来,您需要将指示的目录以及其中包含的所有文件和子目录分配给_apt用户。 您将希望保留与root超级用户组关联的权限,从而保留root用户帐户。 在重新分配目录的所有权之后,我们应该执行一些目录清理,然后最终确保正确安装了包及其依赖项。

你需要的命令……

…在validation_apt用户确实存在之后:

 sudo chown -R _apt:root /var/lib/update-notifier/package-data-downloads/partial/ sudo rm /var/lib/update-notifier/package-data-downloads/partial/*.FA‌​ILED sudo apt install --reinstall update-notifier-common ttf-mscorefonts-installer 

试试这个对我有用。

 wget http://httpredir.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.6_all.deb sudo dpkg -i ttf-mscorefonts-installer_3.6_all.deb