失败后如何让 apt autoremove 进行清理?

失败后如何让 apt autoremove 进行清理?

在尝试设置 cron 作业来自动删除软件包时,我遇到了apt autoremove -y命令失败的问题,现在我无法看到如何重新运行该操作。这是我尝试过的:

  1. 在 shell 中,我运行了sudo apt autoremove它,它向我提供了要删除的“linux-aws-headers”类型包的列表。

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages will be REMOVED:
      linux-aws-headers-4.4.0-1090 linux-aws-headers-4.4.0-1092 linux-aws-headers-4.4.0-1094 linux-aws-headers-4.4.0-1095 linux-aws-headers-4.4.0-1096 linux-aws-headers-4.4.0-1098 linux-aws-headers-4.4.0-1099 linux-aws-headers-4.4.0-1100 linux-aws-headers-4.4.0-1101 linux-aws-headers-4.4.0-1102 linux-aws-headers-4.4.0-1104 linux-aws-headers-4.4.0-1105 linux-aws-headers-4.4.0-1106 linux-headers-4.4.0-1090-aws linux-headers-4.4.0-1092-aws linux-headers-4.4.0-1094-aws linux-headers-4.4.0-1095-aws linux-headers-4.4.0-1096-aws
      linux-headers-4.4.0-1098-aws linux-headers-4.4.0-1099-aws linux-headers-4.4.0-1100-aws linux-headers-4.4.0-1101-aws linux-headers-4.4.0-1102-aws linux-headers-4.4.0-1104-aws linux-headers-4.4.0-1105-aws linux-headers-4.4.0-1106-aws linux-image-4.4.0-1090-aws linux-image-4.4.0-1092-aws linux-image-4.4.0-1094-aws linux-image-4.4.0-1095-aws linux-image-4.4.0-1096-aws linux-image-4.4.0-1098-aws linux-image-4.4.0-1099-aws linux-image-4.4.0-1100-aws linux-image-4.4.0-1101-aws linux-image-4.4.0-1102-aws linux-image-4.4.0-1104-aws
      linux-image-4.4.0-1105-aws linux-image-4.4.0-1106-aws linux-modules-4.4.0-1090-aws linux-modules-4.4.0-1092-aws linux-modules-4.4.0-1094-aws linux-modules-4.4.0-1095-aws linux-modules-4.4.0-1096-aws linux-modules-4.4.0-1098-aws linux-modules-4.4.0-1099-aws linux-modules-4.4.0-1100-aws linux-modules-4.4.0-1101-aws linux-modules-4.4.0-1102-aws linux-modules-4.4.0-1104-aws linux-modules-4.4.0-1105-aws linux-modules-4.4.0-1106-aws
    0 upgraded, 0 newly installed, 52 to remove and 54 not upgraded.
    After this operation, 1,746 MB disk space will be freed.
    Do you want to continue? [Y/n]
    
  2. 我创建了一个 cron 来apt autoremove -y代替

  3. cron 作业运行了,但没有像我预期的那样清理空间。我检查了 /usr/src/ ,所有 linux-aws-headers 内容仍然存在,但随后的运行sudo apt autoremove显示没有要删除的软件包

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.
    
  4. 在另一台机器上,我运行 cron 来apt autoremove -y > somefile检查输出,输出如下:

    Reading package lists...
    Building dependency tree...
    Reading state information...
    The following packages will be REMOVED:
      linux-aws-headers-4.4.0-1090 linux-aws-headers-4.4.0-1092
      linux-aws-headers-4.4.0-1094 linux-aws-headers-4.4.0-1095
      linux-aws-headers-4.4.0-1096 linux-aws-headers-4.4.0-1098
      linux-aws-headers-4.4.0-1099 linux-aws-headers-4.4.0-1100
      linux-aws-headers-4.4.0-1101 linux-aws-headers-4.4.0-1102
      linux-aws-headers-4.4.0-1104 linux-aws-headers-4.4.0-1105
      linux-aws-headers-4.4.0-1106 linux-headers-4.4.0-1090-aws
      linux-headers-4.4.0-1092-aws linux-headers-4.4.0-1094-aws
      linux-headers-4.4.0-1095-aws linux-headers-4.4.0-1096-aws
      linux-headers-4.4.0-1098-aws linux-headers-4.4.0-1099-aws
      linux-headers-4.4.0-1100-aws linux-headers-4.4.0-1101-aws
      linux-headers-4.4.0-1102-aws linux-headers-4.4.0-1104-aws
      linux-headers-4.4.0-1105-aws linux-headers-4.4.0-1106-aws
      linux-image-4.4.0-1090-aws linux-image-4.4.0-1092-aws
      linux-image-4.4.0-1094-aws linux-image-4.4.0-1095-aws
      linux-image-4.4.0-1096-aws linux-image-4.4.0-1098-aws
      linux-image-4.4.0-1099-aws linux-image-4.4.0-1100-aws
      linux-image-4.4.0-1101-aws linux-image-4.4.0-1102-aws
      linux-image-4.4.0-1104-aws linux-image-4.4.0-1105-aws
      linux-image-4.4.0-1106-aws linux-modules-4.4.0-1090-aws
      linux-modules-4.4.0-1092-aws linux-modules-4.4.0-1094-aws
      linux-modules-4.4.0-1095-aws linux-modules-4.4.0-1096-aws
      linux-modules-4.4.0-1098-aws linux-modules-4.4.0-1099-aws
      linux-modules-4.4.0-1100-aws linux-modules-4.4.0-1101-aws
      linux-modules-4.4.0-1102-aws linux-modules-4.4.0-1104-aws
      linux-modules-4.4.0-1105-aws linux-modules-4.4.0-1106-aws
    0 upgraded, 0 newly installed, 52 to remove and 54 not upgraded.
    After this operation, 1,746 MB disk space will be freed.
    dpkg: warning: 'ldconfig' not found in PATH or not executable
    dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
    dpkg: error: 2 expected programs not found in PATH or not executable
    Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
    

PATH从输出中可以看出,显然是有问题的。我在 cron 作业中设置了 PATH,但手动运行sudo apt autoremove仍然显示,0 to remove尽管磁盘空间仍在使用中。我的 apt 现在是否一团糟,我需要从 /usr/src 手动 rm ?

相关内容