我在 Ubuntu 14.04 服务器中运行 update-initramfs 时遇到了问题。
一切都始于尝试恢复无法启动的系统。
从 chroot 控制台(来自 Ubuntu 14.04.3 桌面 CD),当我运行“update-initramfs -v -u -k all”时,我得到以下信息:
dpkg: unrecognized option '--compare-versions'
BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) multi-call binary.
Usage: dpkg [-ilCPru] [-F OPT] PACKAGE
Install, remove and manage Debian packages
-i,--install Install the package
-l,--list List of installed packages
--configure Configure an unpackaged package
-P,--purge Purge all files of a package
-r,--remove Remove all but the configuration files for a package
--unpack Unpack a package, but don't configure it
--force-depends Ignore dependency problems
--force-confnew Overwrite existing config files when installing
--force-confold Keep old config files when installing
很多次,然后
Available versions: 3.13.0-24-generic 3.13.0-46-generic 3.13.0-55-generic 3.16.0-51-generic 3.19.0-25-generic 3.19.0-31-generic
Execute: /usr/sbin/update-initramfs -u -k "3.13.0-24-generic" -b /boot -v -t
update-initramfs: Generating /boot/initrd.img-3.13.0-24-generic
然后出现同样的错误,然后
dpkg: unrecognized option '--print-architecture'
BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) multi-call binary.
Usage: dpkg [-ilCPru] [-F OPT] PACKAGE
Install, remove and manage Debian packages
-i,--install Install the package
-l,--list List of installed packages
--configure Configure an unpackaged package
-P,--purge Purge all files of a package
-r,--remove Remove all but the configuration files for a package
--unpack Unpack a package, but don't configure it
--force-depends Ignore dependency problems
--force-confnew Overwrite existing config files when installing
--force-confold Keep old config files when installing
modprobe: unrecognized option '--set-version=3.13.0-24-generic'
BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) multi-call binary.
Usage: modprobe [-alrqvsDb] MODULE [symbol=value]...
-a Load multiple MODULEs
-l List (MODULE is a pattern)
-r Remove MODULE (stacks) or do autoclean
-q Quiet
-v Verbose
-s Log to syslog
-D Show dependencies
-b Apply blacklist to module names too
然后,其他命令也出现类似的错误。然后我得到
Adding binary /etc/initramfs-tools/conf.d/resume
Adding binary /usr/lib/initramfs-tools/bin/wait-for-root
Adding library /lib/x86_64-linux-gnu/libudev.so.1
Adding library /lib/x86_64-linux-gnu/libc.so.6
Adding library /lib/x86_64-linux-gnu/libcgmanager.so.0
Adding library /lib/x86_64-linux-gnu/libnih.so.1
Adding library /lib/x86_64-linux-gnu/libnih-dbus.so.1
Adding library /lib/x86_64-linux-gnu/libdbus-1.so.3
Adding library /lib/x86_64-linux-gnu/librt.so.1
Adding library /lib64/ld-linux-x86-64.so.2
Adding library /lib/x86_64-linux-gnu/libpthread.so.0
Adding binary /sbin/modprobe
Adding binary /sbin/rmmod
Adding binary /sbin/blkid
Adding library /lib/x86_64-linux-gnu/libblkid.so.1
Adding library /lib/x86_64-linux-gnu/libuuid.so.1
Calling hook compcache
Calling hook fixrtc
Adding binary /bin/date
Adding binary /sbin/hwclock
Adding binary /sbin/dumpe2fs
Adding library /lib/x86_64-linux-gnu/libext2fs.so.2
Adding library /lib/x86_64-linux-gnu/libcom_err.so.2
Adding library /lib/x86_64-linux-gnu/libe2p.so.2
Calling hook fuse
Adding binary /sbin/mount.fuse
最后
Calling hook klibc
Calling hook kmod
Adding binary /bin/kmod
cp: can't create '/tmp/mkinitramfs_6tXmAg/sbin/modprobe': File exists
cp: can't create '/tmp/mkinitramfs_6tXmAg/sbin/rmmod': File exists
E: /usr/share/initramfs-tools/hooks/kmod failed with return 1.
update-initramfs: failed for /boot/initrd.img-3.13.0-24-generic with 1.
所以我猜测它没有使用通常的二进制文件,而是使用了 busybox 中的其他二进制文件。如果我运行“man dpkg”,我确实会看到 --compare-versions 在那里。
我将不胜感激任何帮助。