当我尝试:
sudo apt dist-upgrade
我收到以下错误:
vagrant@ubuntu-16:~$ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up initramfs-tools (0.122ubuntu8.1) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.122ubuntu8.1) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-21-generic
cp: omitting directory '/etc/udev/rules.d/70-persistent-net.rules'
E: /usr/share/initramfs-tools/hooks/udev failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-21-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
很抱歉再次提出一个老问题,但我在尝试修复它时偶然发现了它,却没有找到明确的答案。
以下内容在我的构建中修复了此问题:
rm -rf /etc/udev/rules.d/70-persistent-net.rules
touch /etc/udev/rules.d/70-persistent-net.rules
这将删除文件夹并创建一个文件,正如 initramfs 所期望的那样,
您可能需要在删除文件夹之前检查它是否为空。