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

Bug#609964: use blkid to correctly set UUID for RESUME



Package: initramfs-tools
Version: 0.98.7
Severity: important
Tags: patch

Hi,

while looking at initramfs-tools.preinst code, I noticed that it still
uses vol_id, which is no longer shipped in squeeze.
As a result, UUID will never be set.

The attached patch used blkid, which is both shipped in lenny and
squeeze (e2fsprogs resp. util-linux). Both are essential packages, so I
added no further checks.

A quick test with the attached patch  on a lenny and squeeze system was
successful.

Cheers,
Michael


-- Package-specific info:
-- initramfs sizes
-rw-r--r-- 1 root root 13M Jan 12 22:47 /boot/initrd.img-2.6.32-5-686
-rw-r--r-- 1 root root 11M Jan  7 04:51 /boot/initrd.img-2.6.37
-- /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-2.6.37 root=UUID=9a6d2bd2-58d1-4a75-baff-166b8637e3cc ro quiet splash

-- resume
RESUME=LABEL=Swap
-- /proc/filesystems
	ext2
	ext3
	ext4
	fuseblk

-- lsmod
Module                  Size  Used by
ppp_async               5321  0 
ipw2200               109276  0 
michael_mic             1498  4 
arc4                     986  2 
ecb                     1417  2 
lib80211_crypt_tkip     6563  1 
aes_i586                6820  1 
aes_generic            25726  1 aes_i586
lib80211_crypt_ccmp     3593  1 
sco                     6144  2 
rfcomm                 23650  8 
bnep                    7540  2 
l2cap                  27437  16 rfcomm,bnep
binfmt_misc             4925  1 
acpi_cpufreq            4513  0 
mperf                    803  1 acpi_cpufreq
ppdev                   4145  0 
cpufreq_userspace       1396  0 
lp                      5693  0 
cpufreq_stats           1944  0 
cpufreq_powersave        614  0 
vboxnetadp              5278  0 
cpufreq_conservative     6154  0 
vboxnetflt             12943  0 
vboxdrv               125804  2 vboxnetadp,vboxnetflt
fuse                   46818  3 
usblp                   7831  0 
snd_intel8x0           19539  1 
snd_intel8x0m           8112  0 
snd_ac97_codec         77252  2 snd_intel8x0,snd_intel8x0m
pcmcia                 25159  0 
ac97_bus                 718  1 snd_ac97_codec
btusb                   8113  2 
libipw                 18299  1 ipw2200
snd_pcm                47284  3 snd_intel8x0,snd_intel8x0m,snd_ac97_codec
cfg80211               96303  2 ipw2200,libipw
bluetooth              38051  9 sco,rfcomm,bnep,l2cap,btusb
yenta_socket           16338  0 
snd_seq                34617  0 
i2c_i801                6218  0 
lib80211                2746  4 ipw2200,lib80211_crypt_tkip,lib80211_crypt_ccmp,libipw
pcmcia_rsrc             7344  1 yenta_socket
snd_timer              12129  2 snd_pcm,snd_seq
pcmcia_core             8201  3 pcmcia,yenta_socket,pcmcia_rsrc
smsc_ircc2              8948  0 
psmouse                39035  0 
snd_seq_device          3661  1 snd_seq
parport_pc             15927  1 
snd                    33366  9 snd_intel8x0,snd_intel8x0m,snd_ac97_codec,snd_pcm,snd_seq,snd_timer,snd_seq_device
processor              21812  2 acpi_cpufreq
shpchp                 18255  0 
rng_core                2298  0 
parport                22182  3 ppdev,lp,parport_pc
soundcore               3390  1 snd
video                   9844  0 
serio_raw               2912  0 
snd_page_alloc          4921  3 snd_intel8x0m,snd_intel8x0,snd_pcm
pci_hotplug            16947  1 shpchp
rfkill                 10452  4 cfg80211,bluetooth
irda                   71565  1 smsc_ircc2
crc_ccitt               1043  2 ppp_async,irda
tpm_tis                 5452  0 
pcspkr                  1215  0 
evdev                   5796  16 
joydev                  7007  0 
thermal_sys             9274  2 processor,video
tpm                     8097  1 tpm_tis
tpm_bios                3577  1 tpm
output                  1216  1 video
button                  3626  0 
container               1865  0 
battery                 4306  0 
ac                      1700  0 
dm_mod                 47476  0 
ppp_generic            16504  1 ppp_async
slhc                    3551  1 ppp_generic
loop                   10615  0 
autofs4                16222  7 
hid_microsoft           1931  0 
usbhid                 26611  0 
hid                    51772  2 hid_microsoft,usbhid
usb_storage            30441  0 
uas                     5555  0 
radeon                621388  2 
uhci_hcd               15810  0 
ttm                    36671  1 radeon
ehci_hcd               28136  0 
wbsd                    8558  0 
drm_kms_helper         19531  1 radeon
sg                     15973  0 
8139too                14414  0 
drm                   118815  4 radeon,ttm,drm_kms_helper
usbcore                95726  8 usblp,btusb,usbhid,usb_storage,uas,uhci_hcd,ehci_hcd
firewire_ohci          19546  0 
sr_mod                 11018  0 
mmc_core               45379  1 wbsd
8139cp                 13066  0 
firewire_core          35038  1 firewire_ohci
cdrom                  26530  1 sr_mod
i2c_algo_bit            3389  1 radeon
crc_itu_t               1013  1 firewire_core
mii                     2694  2 8139too,8139cp
nls_base                4489  1 usbcore

-- /etc/initramfs-tools/modules

-- /etc/kernel-img.conf
# Kernel image management overrides
# See kernel-img.conf(5) for details
do_symlinks = no
relative_links = yes
do_bootloader = no
do_bootfloppy = no
do_initrd = yes
link_in_boot = no

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

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

-- /etc/crypttab
# <target name>	<source device>		<key file>	<options>

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

/usr/share/initramfs-tools/hooks:
busybox
cryptgnupg
cryptopenct
cryptopensc
cryptpassdev
cryptroot
dmsetup
keymap
klibc
plymouth
thermal
udev


-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.37 (SMP w/1 CPU core)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages initramfs-tools depends on:
ii  cpio                          2.11-6     GNU cpio -- a program to manage ar
ii  findutils                     4.4.2-1+b1 utilities for finding files--find,
ii  klibc-utils                   1.5.20-1   small utilities built with klibc f
ii  module-init-tools             3.12-1     tools for managing Linux kernel mo
ii  udev                          164-3      /dev/ and hotplug management daemo

Versions of packages initramfs-tools recommends:
ii  busybox                       1:1.17.1-8 Tiny utilities for small and embed

Versions of packages initramfs-tools suggests:
ii  bash-completion               1:1.2-3    programmable completion for the ba

-- no debconf information
diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst
index bb58684..4c587b7 100644
--- a/debian/initramfs-tools.preinst
+++ b/debian/initramfs-tools.preinst
@@ -20,11 +20,7 @@ case "$1" in
 		# First time install.  Can we autodetect the RESUME partition?
 		if [ -r /proc/swaps ]; then
 			RESUME=$(tail -n $(($(wc -l /proc/swaps | awk ' { print $1 } ') - 1)) /proc/swaps | sort -rk3 | head -n 1 | awk ' { print $1 } ')
-			if command -v vol_id >/dev/null 2>&1; then
-				UUID=$(vol_id -u "$RESUME" || true)
-			elif [ -x /lib/udev/vol_id ]; then
-				UUID=$(/lib/udev/vol_id -u "$RESUME" || true)
-			fi
+			UUID=$(blkid -o value -s UUID "$RESUME" || true)
 			if [ -n "$UUID" ]; then
 				RESUME="UUID=$UUID"
 			fi

Reply to: