panic=-1 is completely ignored by the initrd causing unexpected behaviour

Bug #1831252 reported by Oliver Grawert on 2019-05-31
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
initramfs-tools (Ubuntu)
Medium
Unassigned
Xenial
Medium
Unassigned
Bionic
Medium
Unassigned
Disco
Medium
Unassigned
Eoan
Medium
Unassigned

Bug Description

[Impact]
in Ubuntu Core we default to using panic=-1 on the kernel command line (documented at [1]) to speed up the auto-rollback mechanism of the kernel. on a kernel level this works just fine and the system reboots immediately ...

when in the initramfs during boot and a panic occurs, no reboot happens at all, the initrd spawns a shell regardless of the panic= value ...

[Test case]

Before booting change root=$foo to root=x$foo - this will make it panic. Then test that

1) "panic=-1" causes an immediate reboot
2) "panic=5" waits 5 seconds
3) no "panic" drops you to a shell

[Regression potential]
This adds some very specific checks for -1 in places that use ${panic}, as such the regression potential is somewhat limited. If there were a regression, it could be a syntax error (causing boot to fail) or a sleep not working correctly (causing sleep to, well, not sleep) - but that's unrealistic.

[Other info]
this is caused by a filter in /usr/share/initramfs-tools/init

        panic=*)
                panic="${x#panic=}"
                case ${panic} in
                *[![:digit:].]*)
                        panic=
                        ;;
                esac
                ;;

this function only lets positive values through, else panic= simply gets unset

the panic() function itself is also not capable of handling negative values, it has a sleep call that interprets negative values as commandline options instead of simply ignoring a negative sleep time [2] (line 11).

the filter in the init script should allow the -1 value (to comply with the kernel documentation and behaviour) and the panic() function should properly skip the sleep call when a negative value for panic= is set.

[1] https://github.com/torvalds/linux/blob/v4.17/Documentation/admin-guide/kernel-parameters.txt#L2931
[2] https://paste.ubuntu.com/p/mswD8Cd869/

Oliver Grawert (ogra) wrote :

targeting to xenial and bionic since we need this SRUed for Ubuntu Core installs.

description: updated
tags: added: rls-ee-incoming
Changed in initramfs-tools (Ubuntu):
importance: Undecided → Medium
Changed in initramfs-tools (Ubuntu Xenial):
importance: Undecided → Medium
Changed in initramfs-tools (Ubuntu Bionic):
importance: Undecided → Medium
Steve Langasek (vorlon) on 2019-06-06
tags: removed: rls-ee-incoming
tags: added: id-5cf9304627a12b717bdbab7a
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package initramfs-tools - 0.133ubuntu10

---------------
initramfs-tools (0.133ubuntu10) eoan; urgency=medium

  * Add support for panic=-1 value (LP: #1831252)

 -- Julian Andres Klode <email address hidden> Thu, 05 Sep 2019 12:31:43 +0200

Changed in initramfs-tools (Ubuntu Eoan):
status: New → Fix Released
description: updated
Changed in initramfs-tools (Ubuntu Disco):
status: New → In Progress
Julian Andres Klode (juliank) wrote :

Uploads ready in unapproved queues.

Changed in initramfs-tools (Ubuntu Bionic):
status: New → In Progress
Changed in initramfs-tools (Ubuntu Xenial):
status: New → In Progress

Hello Oliver, or anyone else affected,

Accepted initramfs-tools into disco-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/initramfs-tools/0.131ubuntu19.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-disco to verification-done-disco. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-disco. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in initramfs-tools (Ubuntu Disco):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-disco
Changed in initramfs-tools (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed-bionic
Łukasz Zemczak (sil2100) wrote :

Hello Oliver, or anyone else affected,

Accepted initramfs-tools into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/initramfs-tools/0.130ubuntu3.9 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in initramfs-tools (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed-xenial
Łukasz Zemczak (sil2100) wrote :

Hello Oliver, or anyone else affected,

Accepted initramfs-tools into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/initramfs-tools/0.122ubuntu8.16 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in initramfs-tools (Ubuntu Disco):
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers