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

Bug#787231: mktemp: failed to create directory via template ‘/var/tmp/mkinitramfs_XXXXXX



Package: initramfs-tools
Version: 0.120
Severity: normal
Tags: patch

Dear Maintainer,

First of all, thank you very much for maintaining
Debain's initramfs-tools package.

I love to see generous and civic minded people.

When I was upgrading the kernel with

    $ aptitude install linux-image-686-pae

I happened to notice that it failed with

    The following partially installed packages will be configured:
      linux-image-4.0.0-1-686-pae linux-image-686-pae 
    No packages will be installed, upgraded, or removed.
    0 packages upgraded, 0 newly installed, 0 to remove and 2486 not upgraded.
    Need to get 0 B of archives. After unpacking 0 B will be used.
    Setting up linux-image-4.0.0-1-686-pae (4.0.2-1) ...
    /etc/kernel/postinst.d/initramfs-tools:
    update-initramfs: Generating /boot/initrd.img-4.0.0-1-686-pae
    mktemp: failed to create directory via template ‘/var/tmp/mkinitramfs_XXXXXX’: No such file or directory
    update-initramfs: failed for /boot/initrd.img-4.0.0-1-686-pae with 1.
    run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
    Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-4.0.0-1-686-pae.postinst line 634.
    dpkg: error processing package linux-image-4.0.0-1-686-pae (--configure):
     subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of linux-image-686-pae:
     linux-image-686-pae depends on linux-image-4.0.0-1-686-pae; however:
      Package linux-image-4.0.0-1-686-pae is not configured yet.

So the kernel wasn't upgraded.

I believe the problem is that the /var/tmp/
directory did not exist.

Since /var/tmp is specified in Debian's Filesystem
Hierarchy Standard[1], it seems to me that it was
somehow deleted.

However, I have no clue as to who, what, when,
where or how.

/var/tmp was also reported to be missing in bug
report #696771[2], so it's not just me.

Humble suggestion: 

Since /var/tmp is specified in our FHS, is
required to update the kernel, and is being
deleted, patch /usr/sbin/mkinitramfs to check if
it exists, and if it doesn't, create it.

Here's a patch.

I hope it makes sense, and is in an acceptable
format.

--- /usr/sbin/mkinitramfs       2015-03-01 15:18:25.000000000 -0800
+++ /tmp/mkinitramfs    2015-05-29 21:53:16.420497308 -0700
@@ -162,6 +162,10 @@
 if [ ! -e "${MODULESDIR}/modules.dep" ]; then
        depmod ${version}
 fi
+                                                                            # /var/tmp is specified in the Filesystem Hierarchy Standard.
+if ! test -d /var/tmp ; then                                                # Does it exist?
+    mkdir -m 1777 /var/tmp                                                      # No, so create it.
+fi
 
 [ -n "${TMPDIR}" ] && [ ! -w "${TMPDIR}" ] && unset TMPDIR
 DESTDIR="$(mktemp -d ${TMPDIR:-/var/tmp}/mkinitramfs_XXXXXX)" || exit 1

Thanks,
Kingsley

References

[1] Debian's Filesystem Hierarchy Standard for
/var/tmp https://www.debian.org/doc/packaging-manuals/fhs/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE

[2] Debian bug report #696771 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696771

-- Package-specific info:
-- initramfs sizes
-rw-r--r-- 1 root disk 6.0M Aug 12  2011 /boot/initrd.img-2.6.18-4-k7
-rw-r--r-- 1 root disk 6.8M Aug 12  2011 /boot/initrd.img-2.6.25-2-686
-rw-r--r-- 1 root disk 6.8M Mar 11  2010 /boot/initrd.img-2.6.25-2-686.bak
-rw-r--r-- 1 root disk 8.3M Aug 12  2011 /boot/initrd.img-2.6.32-5-686
-rw-r--r-- 1 root disk 8.0M Feb 10  2011 /boot/initrd.img-2.6.32-5-686.bak
-rw-r--r-- 1 root disk  11M May 25 15:23 /boot/initrd.img-3.0.0-1-686-pae
-rw-r--r-- 1 root disk  15M May 27 14:06 /boot/initrd.img-4.0.0-1-686-pae
-- /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.0.0-1-686-pae root=UUID=a9792df8-2513-4185-bb81-589f5f9d508d ro quiet

-- resume
RESUME=/dev/hdc3
-- /proc/filesystems
	ext3
	ext2
	ext4
	fuseblk
	vfat

-- lsmod
Module                  Size  Used by
nls_utf8               16384  1 
nls_cp437              16384  1 
vfat                   20480  1 
fat                    57344  1 vfat
usb_storage            45056  1 
ipheth                 16384  0 
snd_hrtimer            16384  1 
binfmt_misc            20480  1 
nf_log_ipv4            16384  3 
nf_log_common          16384  1 nf_log_ipv4
xt_LOG                 16384  3 
iptable_mangle         16384  0 
iptable_filter         16384  1 
iptable_nat            16384  0 
ip_tables              20480  3 iptable_filter,iptable_mangle,iptable_nat
nf_conntrack_ipv4      20480  1 
nf_defrag_ipv4         16384  1 nf_conntrack_ipv4
nf_nat_ipv4            16384  1 iptable_nat
nf_nat                 20480  1 nf_nat_ipv4
nf_conntrack           73728  3 nf_nat,nf_nat_ipv4,nf_conntrack_ipv4
x_tables               20480  4 ip_tables,xt_LOG,iptable_filter,iptable_mangle
bridge                 94208  0 
stp                    16384  1 bridge
llc                    16384  2 stp,bridge
usblp                  20480  0 
nouveau              1167360  2 
mxm_wmi                16384  1 nouveau
wmi                    20480  2 mxm_wmi,nouveau
video                  20480  1 nouveau
ttm                    73728  1 nouveau
serio_raw              16384  0 
evdev                  20480  6 
pcspkr                 16384  0 
powernow_k8            28672  0 
kvm_amd                53248  0 
kvm                   364544  1 kvm_amd
edac_mce_amd           24576  0 
edac_core              40960  0 
drm_kms_helper         90112  1 nouveau
parport_serial         16384  0 
snd_ens1371            24576  2 
drm                   233472  5 ttm,drm_kms_helper,nouveau
i2c_algo_bit           16384  1 nouveau
sp5100_tco             16384  0 
i2c_piix4              20480  0 
i2c_core               36864  5 drm,i2c_piix4,drm_kms_helper,i2c_algo_bit,nouveau
asus_atk0110           20480  0 
8250_fintek            16384  0 
shpchp                 32768  0 
button                 16384  1 nouveau
acpi_cpufreq           20480  0 
processor              28672  2 powernow_k8,acpi_cpufreq
thermal_sys            28672  2 video,processor
k8temp                 16384  0 
snd_via82xx            28672  0 
snd_mpu401_uart        16384  1 snd_via82xx
snd_seq_dummy          16384  0 
snd_seq_midi           16384  0 
snd_seq_midi_event     16384  1 snd_seq_midi
snd_seq                53248  4 snd_seq_midi_event,snd_seq_dummy,snd_seq_midi
snd_rawmidi            24576  3 snd_mpu401_uart,snd_ens1371,snd_seq_midi
snd_seq_device         16384  4 snd_seq,snd_rawmidi,snd_seq_dummy,snd_seq_midi
snd_ac97_codec         98304  2 snd_via82xx,snd_ens1371
snd_pcm_oss            45056  0 
snd_mixer_oss          24576  1 snd_pcm_oss
snd_pcm                81920  4 snd_via82xx,snd_pcm_oss,snd_ac97_codec,snd_ens1371
snd_timer              28672  3 snd_hrtimer,snd_pcm,snd_seq
snd                    57344  16 snd_via82xx,snd_pcm_oss,snd_ac97_codec,snd_timer,snd_pcm,snd_seq,snd_rawmidi,snd_mpu401_uart,snd_ens1371,snd_seq_device,snd_mixer_oss
soundcore              16384  1 snd
ac97_bus               16384  1 snd_ac97_codec
gameport               16384  2 snd_via82xx,snd_ens1371
psmouse                98304  0 
tulip                  57344  0 
fuse                   81920  3 
parport_pc             28672  1 parport_serial
ppdev                  20480  0 
lp                     20480  0 
parport                36864  3 lp,ppdev,parport_pc
autofs4                36864  2 
ext4                  462848  3 
crc16                  16384  1 ext4
mbcache                20480  1 ext4
jbd2                   77824  1 ext4
sg                     32768  0 
sr_mod                 24576  0 
sd_mod                 40960  9 
cdrom                  49152  1 sr_mod
ata_generic            16384  0 
hid_generic            16384  0 
usbhid                 45056  0 
hid                    90112  2 hid_generic,usbhid
aic7xxx               118784  0 
scsi_transport_spi     24576  1 aic7xxx
pata_atiixp            16384  2 
ohci_pci               16384  0 
floppy                 57344  0 
ahci                   28672  5 
libahci                28672  1 ahci
libata                163840  4 ahci,libahci,ata_generic,pata_atiixp
scsi_mod              180224  7 sg,scsi_transport_spi,usb_storage,libata,aic7xxx,sd_mod,sr_mod
ohci_hcd               45056  1 ohci_pci
ehci_pci               16384  0 
ehci_hcd               65536  1 ehci_pci
atl1                   36864  0 
mii                    16384  1 atl1
usbcore               176128  8 usblp,usb_storage,ohci_hcd,ohci_pci,ehci_hcd,ehci_pci,ipheth,usbhid
usb_common             16384  1 usbcore

-- /etc/initramfs-tools/modules

-- /etc/kernel-img.conf
do_bootloader = no
do_initrd = Yes

-- /etc/initramfs-tools/initramfs.conf
MODULES=most
BUSYBOX=y
KEYMAP=n
COMPRESS=gzip
DEVICE=
NFSROOT=auto

-- /etc/initramfs-tools/update-initramfs.conf
update_initramfs=yes
backup_initramfs=no

-- mkinitramfs hooks
/etc/initramfs-tools/hooks/:

/usr/share/initramfs-tools/hooks:
busybox
dmsetup
fsck
fuse
keymap
klibc
kmod
ntfs_3g
resume
thermal
udev
zz-busybox
zz_nvidia-blacklists-nouveau


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 4.0.0-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages initramfs-tools depends on:
ii  busybox            1:1.22.0-15
ii  cpio               2.11+dfsg-4.1
ii  klibc-utils        2.0.4-2
ii  kmod               20-1
ii  module-init-tools  20-1
ii  udev               215-18

Versions of packages initramfs-tools recommends:
ii  busybox  1:1.22.0-15

Versions of packages initramfs-tools suggests:
ii  bash-completion  1:2.1-4.1

-- no debconf information


Reply to: