libpam systemd-安装错误 ubuntu 14.04 无法安装更新

libpam systemd-安装错误 ubuntu 14.04 无法安装更新

昨天,我试图构建一个可信赖的 i386 的自定义 iso。在第一次尝试中,快结束时(在我决定标记所有升级并安装它们之后),出现了错误消息 - 在反复尝试修复损坏的软件包并使用 -f 选项删除和安装软件包后,我不得不放弃该项目。以下是来自终端的消息

# sudo dpkg --configure -a
Setting up linux-image-3.13.0-27-generic (3.13.0-27.50) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
initrd.img(/boot/initrd.img-3.13.0-27-generic
) points to /boot/initrd.img-3.13.0-27-generic
 (/boot/initrd.img-3.13.0-27-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-3.13.0-27-generic.postinst line 491.
vmlinuz(/boot/vmlinuz-3.13.0-27-generic
) points to /boot/vmlinuz-3.13.0-27-generic
 (/boot/vmlinuz-3.13.0-27-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-3.13.0-27-generic.postinst line 491.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-27-generic /boot/vmlinuz-3.13.0-27-generic
run-parts: executing /etc/kernel/postinst.d/dkms 3.13.0-27-generic /boot/vmlinuz-3.13.0-27-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-27-generic /boot/vmlinuz-3.13.0-27-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-27-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.13.0-27-generic /boot/vmlinuz-3.13.0-27-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.13.0-27-generic /boot/vmlinuz-3.13.0-27-generic
run-parts: executing /etc/kernel/postinst.d/zz-extlinux 3.13.0-27-generic /boot/vmlinuz-3.13.0-27-generic
P: Checking for EXTLINUX directory... found.
P: Writing config for /boot/vmlinuz-3.13.0-27-generic...
P: Installing debian theme... done.
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.13.0-27-generic /boot/vmlinuz-3.13.0-27-generic
/etc/kernel/postinst.d/zz-update-grub: 22: /etc/kernel/postinst.d/zz-update-grub: Syntax error: "fi" unexpected
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 2
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.13.0-27-generic.postinst line 1025.
dpkg: error processing package linux-image-3.13.0-27-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of libpam-systemd:i386:
 libpam-systemd:i386 depends on systemd-services (= 204-5ubuntu20); however:
  Version of systemd-services on system is 204-5ubuntu20.2.

dpkg: error processing package libpam-systemd:i386 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.13.0-27-generic; however:
  Package linux-image-3.13.0-27-generic is not configured yet.

dpkg: error processing package linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 3.13.0.27.33); however:
  Package linux-image-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-extra-3.13.0-27-generic:
 linux-image-extra-3.13.0-27-generic depends on linux-image-3.13.0-27-generic; however:
  Package linux-image-3.13.0-27-generic is not configured yet.

dpkg: error processing package linux-image-extra-3.13.0-27-generic (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-3.13.0-27-generic
 libpam-systemd:i386
 linux-image-generic
 linux-generic
 linux-image-extra-3.13.0-27-generic

请帮我...

答案1

我在尝试使用 fakechroot 创建自己的自定义 Ubuntu 14.04 发行版时遇到了这个问题,我想出了一个似乎可行的解决方案。在(诚然过时的)Ubuntu Live CD 定制指南,提到了一个涉及 initctl 的错误。我使用了相同的方法来阻止invoke-rc.d 运行,libpam-systemd 的配置也使用了这种方法。invoke-rc.d 是一个用于启动和停止 initd 脚本的实用程序,它不需要在 chroot 中运行:

dpkg-divert --rename --add /usr/sbin/invoke-rc.d
ln -s /bin/true /usr/sbin/invoke-rc.d
#Run apt-get, dpkg etc...
rm /usr/sbin/invoke-rc.d
dpkg-divert --rename --remove /usr/sbin/invoke-rc.d

通过转移,invoke-rc.d 总是返回成功并且不执行任何操作,这正是 chroot 中期望的行为。

答案2

是一个众所周知的错误:(参见Launchpad 上的 Bug #1325142);我在 chroot 中构建自己的 Live 时也遇到了这个问题,并且我解决了它(如果“解决”是正确的词...让我们创建一个新词,比如“workarounded”),方法是:

在 chroot 中,完成所有安装后,我声明不要更新 libpam-systemd:

echo "libpam-systemd  hold"|dpkg --set-selections

然后我对我的发行版进行了 dist-upgrade,而(显然)没有出现任何错误,最后我制作了我的现场 DVD。

为了测试我的解决方法是否有效,我从该 iso 在 VM 上安装了 trusty,登录并从 shell 中撤销了 iso 上关于不升级 libpam-systemd 的指令:

sudo -i
echo "libpam-systemd install"|dpkg --set-selecions

最后,我再次对全新系统进行了 dist-upgrade:没有错误。

我认为这只是在 chroot 环境中发生的问题。

干杯,

西尔维娅

相关内容