Definition of add_mountroot_fail_hook doesnt match lvm2's usage

Bug #1873614 reported by Nathan O'Sullivan on 2020-04-19
68
This bug affects 13 people
Affects Status Importance Assigned to Milestone
initramfs-tools
Undecided
Unassigned
initramfs-tools (Ubuntu)
Undecided
Unassigned

Bug Description

Package lvm2 contains a init-premount script named /usr/share/initramfs-tools/scripts/init-premount/lvm2

In this script there is the function call:
add_mountroot_fail_hook "20-lvm2"

Which is defined in /usr/share/initramfs-tools/scripts/functions

In focal's 0.136ubuntu6 , this is defined as:

add_mountroot_fail_hook()
{
        mkdir -p /tmp/mountroot-fail-hooks.d
        ln -s "$0" /tmp/mountroot-fail-hooks.d/"$0"
}

The final line of the function will execute as
ln -s "/scripts/lvm2" /tmp/mountroot-fail-hooks.d/"/scripts/lvm2"

And fail, because directory /tmp/mountroot-fail-hooks.d/scripts does not exist.

It is clear from lvm2's invocation that it expects the symlink to be named "20-lvm2" , and if we look at bionic's 0.130ubuntu3.6 that is the case:

add_mountroot_fail_hook()
{
        mkdir -p /tmp/mountroot-fail-hooks.d
        ln -s "$0" /tmp/mountroot-fail-hooks.d/"$1"
}

focal's version needs to be updated to either support the "$1" argument or strip the directory from "$0".

Forgot to mention, in the current bugged state the following message is shown during boot:

ln: /tmp/mountroot-fail-hooks.d//scripts/init-premount/lvm2: No such file or directory

Presumedly the fail hook will not be invoked either.

description: updated
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in initramfs-tools (Ubuntu):
status: New → Confirmed
Damian (damianw345) wrote :

Please fix this, affects me after upgrading to 20.04 from 18.04

lerxst (lerxst) wrote :

I'm noticing the same behavior. Please fix!

Blake Anderson (blazelazerson) wrote :

Confirmed, I get the message in #1 every boot. 20.04

I upgraded from 19.10 to 20.04 and happened

Is there any workaround. I can’t boot

Andrew (angbor) wrote :

The same for me.

Tamas Szerb (toma) wrote :

As a workaround in the

/usr/share/initramfs-tools/scripts/functions

replace the line

ln -s "$0" /tmp/mountroot-fail-hooks.d/"$0"

with

n -s "$0" /tmp/mountroot-fail-hooks.d/"$1"

in add_mountroot_fail_hook() dunction as suggested above, then run

# update-initramfs -uk all

as root.

Johannes Vass (johannes-vass) wrote :

How would I execute the workaround if I cannot boot? Did anybody else who couldn't boot solve the issue?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers