[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#904065: initramfs-tools: stderr reports "rmdir: failed to remove '/var/tmp/mkinitramfs_XXXXXX/var/cache/ldconfig': No such file or directory"



Control: severity -1 minor
Control: tags -1 + patch

On 2018-07-19 12:04 +0800, Boyuan Yang wrote:

> Package: initramfs-tools
> Severity: important
> Version: 0.131
>
> Dear initramfs-tools maintainers,
>
> I installed initramfs-tools 0.131 from http://incoming.debian.org/debian-buildd and got the following error messages:
>
> ===========================================================================
> 正在安装新版本配置文件 /etc/initramfs-tools/initramfs.conf ...
> 正在设置 initramfs-tools (0.131) ...
> update-initramfs: deferring update (trigger activated)
> 正在设置 firefox-l10n-zh-cn (61.0.1-1) ...
> 正在处理用于 initramfs-tools (0.131) 的触发器 ...
> update-initramfs: Generating /boot/initrd.img-4.17.0-1-amd64
> rmdir: 删除 '/var/tmp/mkinitramfs_wEihys/var/cache/ldconfig' 失败: 没有那个文件或目录
> ===========================================================================
>
> A manual invocation of update-initramfs got the following output:
>
> ===========================================================================
> % LC_ALL=C sudo update-initramfs -u 
> update-initramfs: Generating /boot/initrd.img-4.17.0-1-amd64
> rmdir: failed to remove '/var/tmp/mkinitramfs_G50d00/var/cache/ldconfig': No 
> such file or directory
> % echo $?
> 0
> ============================================================================
>
> I'm not sure if it is a critical error or not. However, this problem needs to 
> be solved anyway.

Failing to remove a directory because it did not exist in the first
place is not a big deal, so this error message is just cosmetic.  Below
is a patch that fixes it.

>From ca5373c7fee4e6928e50699eeb9cb40e63018957 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenjoac@gmx.de>
Date: Thu, 19 Jul 2018 11:22:04 +0200
Subject: [PATCH] mkinitramfs: Don't try to remove a non-existent directory

The auxiliary ldconfig cache might not exist, in my tests there was
not even a var/ subdirectory in ${DESTDIR}.
---
 mkinitramfs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mkinitramfs b/mkinitramfs
index 89a61a3..58a9ff7 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -340,8 +340,10 @@ if ! ldconfig -r "$DESTDIR" ; then
 fi
 # The auxiliary cache is not reproducible and is always invalid at boot
 # (see #845034)
-rm -f "${DESTDIR}"/var/cache/ldconfig/aux-cache
-rmdir --ignore-fail-on-non-empty "${DESTDIR}"/var/cache/ldconfig
+if [ -d "${DESTDIR}"/var/cache/ldconfig ]; then
+	rm -f "${DESTDIR}"/var/cache/ldconfig/aux-cache
+	rmdir --ignore-fail-on-non-empty "${DESTDIR}"/var/cache/ldconfig
+fi
 
 # Apply DSDT to initramfs
 if [ -e "${CONFDIR}/DSDT.aml" ]; then
-- 
2.18.0


Reply to: