Definition of add_mountroot_fail_hook doesnt match lvm2's usage

Bug #1873614 reported by Nathan O'Sullivan
68
This bug affects 13 people
Affects Status Importance Assigned to Milestone
initramfs-tools
New
Undecided
Unassigned
initramfs-tools (Ubuntu)
Confirmed
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".

Revision history for this message
Nathan O'Sullivan (nathan-mammoth) wrote :

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
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in initramfs-tools (Ubuntu):
status: New → Confirmed
Revision history for this message
Damian (damianw345) wrote :

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

Revision history for this message
lerxst (lerxst) wrote :

I'm noticing the same behavior. Please fix!

Revision history for this message
Blake Anderson (blazelazerson) wrote :

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

Revision history for this message
Hasan Erhan AYDINOGLU (hasanerhan-q) wrote :

I upgraded from 19.10 to 20.04 and happened

Revision history for this message
Hasan Erhan AYDINOGLU (hasanerhan-q) wrote :

Is there any workaround. I can’t boot

Revision history for this message
Andrew (angbor) wrote :

The same for me.

Revision history for this message
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.

Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.