Bug#883735: Re: Bug#883735: initramfs-tools: automatic resume doesn't work for lvm swap partitions
Hi, On 07/12/17 01:30, Ben Hutchings wrote: > Control: reopen -1 > Control: tag -1 patch moreinfo > > On Thu, 2017-12-07 at 00:22 +, James Cowgill wrote: >> Hi, >> >> On 07/12/17 00:06, Ben Hutchings wrote: >>> On Wed, 2017-12-06 at 23:48 +, James Cowgill wrote: Package: initramfs-tools Version: 0.130 Severity: normal Hi, I had noticed this bug for quite a while now, but since I rarely turn my machine off I left investigating what the problem was until now. >>> >>> [...] Is it possible (and a good idea) to store the /dev/mapper path instead of the blkid when the swap partition is on LVM? I managed to solve my specific issue by manually setting RESUME to the correct /dev/mapper path. >>> >>> This is the correct way to refer to LVs used as root, /usr or resume >>> partition. The reason for this is that lvm2 only activates VGs that >>> are definitely needed, and there is no way to determine whether a >>> filesystem UUID or label refers to an LV (or which VG it's in). >> >> Ok, but I don't understand why this can't be fixed. Why can't you >> convert the /dev/dm-* path from /proc/swaps into a /dev/mapper path when >> you generate the initramfs and store that instead? > > Oh I see, I failed to parse 'automatic resume' as meaning automatic > selection of the resume device. > > Does the attached patch fix this for you? Thanks, your patch does fix this for me. James signature.asc Description: OpenPGP digital signature
Bug#883735: Re: Bug#883735: initramfs-tools: automatic resume doesn't work for lvm swap partitions
Control: reopen -1 Control: tag -1 patch moreinfo On Thu, 2017-12-07 at 00:22 +, James Cowgill wrote: > Hi, > > On 07/12/17 00:06, Ben Hutchings wrote: > > On Wed, 2017-12-06 at 23:48 +, James Cowgill wrote: > > > Package: initramfs-tools > > > Version: 0.130 > > > Severity: normal > > > > > > Hi, > > > > > > I had noticed this bug for quite a while now, but since I rarely turn my > > > machine off I left investigating what the problem was until now. > > > > [...] > > > Is it possible (and a good idea) to store the /dev/mapper path instead > > > of the blkid when the swap partition is on LVM? > > > > > > I managed to solve my specific issue by manually setting RESUME to the > > > correct /dev/mapper path. > > > > This is the correct way to refer to LVs used as root, /usr or resume > > partition. The reason for this is that lvm2 only activates VGs that > > are definitely needed, and there is no way to determine whether a > > filesystem UUID or label refers to an LV (or which VG it's in). > > Ok, but I don't understand why this can't be fixed. Why can't you > convert the /dev/dm-* path from /proc/swaps into a /dev/mapper path when > you generate the initramfs and store that instead? Oh I see, I failed to parse 'automatic resume' as meaning automatic selection of the resume device. Does the attached patch fix this for you? Ben. -- Ben Hutchings Beware of programmers who carry screwdrivers. - Leonard Brandwein diff --git a/hooks/resume b/hooks/resume index 1032f7b19e77..3c0bef56a89f 100755 --- a/hooks/resume +++ b/hooks/resume @@ -46,11 +46,17 @@ else # Try to autodetect the RESUME partition, using biggest swap? resume_auto=$(grep ^/dev/ /proc/swaps | sort -rnk3 | head -n 1 | cut -d " " -f 1) if [ -n "$resume_auto" ]; then - UUID=$(blkid -s UUID -o value "$resume_auto" || true) + if dm_name="$(dmsetup info -c --noheadings -o name "$resume_auto" 2>/dev/null)"; then + resume_auto_canon="/dev/mapper/$dm_name" + elif UUID=$(blkid -s UUID -o value "$resume_auto"); then + resume_auto_canon="UUID=$UUID" + else + resume_auto_canon= + fi report_auto "The initramfs will attempt to resume from $resume_auto" - if [ -n "$UUID" ]; then - report_auto "(UUID=$UUID)" - resume_auto="UUID=$UUID" + if [ -n "$resume_auto_canon" ]; then + report_auto "($resume_auto_canon)" + resume_auto="$resume_auto_canon" fi report_auto "Set the RESUME variable to override this." fi signature.asc Description: This is a digitally signed message part
Processed: Re: Bug#883735: Re: Bug#883735: initramfs-tools: automatic resume doesn't work for lvm swap partitions
Processing control commands: > reopen -1 Bug #883735 {Done: Ben Hutchings} [initramfs-tools] initramfs-tools: automatic resume doesn't work for lvm swap partitions Bug reopened Ignoring request to alter fixed versions of bug #883735 to the same values previously set > tag -1 patch moreinfo Bug #883735 [initramfs-tools] initramfs-tools: automatic resume doesn't work for lvm swap partitions Added tag(s) moreinfo and patch. -- 883735: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=883735 Debian Bug Tracking System Contact ow...@bugs.debian.org with problems
Bug#883735: Re: Bug#883735: initramfs-tools: automatic resume doesn't work for lvm swap partitions
Hi, On 07/12/17 00:06, Ben Hutchings wrote: > On Wed, 2017-12-06 at 23:48 +, James Cowgill wrote: >> Package: initramfs-tools >> Version: 0.130 >> Severity: normal >> >> Hi, >> >> I had noticed this bug for quite a while now, but since I rarely turn my >> machine off I left investigating what the problem was until now. > [...] >> Is it possible (and a good idea) to store the /dev/mapper path instead >> of the blkid when the swap partition is on LVM? >> >> I managed to solve my specific issue by manually setting RESUME to the >> correct /dev/mapper path. > > This is the correct way to refer to LVs used as root, /usr or resume > partition. The reason for this is that lvm2 only activates VGs that > are definitely needed, and there is no way to determine whether a > filesystem UUID or label refers to an LV (or which VG it's in). Ok, but I don't understand why this can't be fixed. Why can't you convert the /dev/dm-* path from /proc/swaps into a /dev/mapper path when you generate the initramfs and store that instead? James signature.asc Description: OpenPGP digital signature