[Bug 1957863] Re: coding errors in update-motd-fsck-at-reboot script

Brendan Lewis 1957863 at bugs.launchpad.net
Tue Feb 14 03:19:43 UTC 2023


While this bug still exists I've enabled a workaround. I only want to
know about fsck checks when the system boots, not when I SSH in. So I
disable the fsck checks for interactive logins by adding the following
to to the top of /usr/lib/update-notifier/update-motd-fsck-at-reboot.

# Disable if interactive user login to avoid spinning up drives on login
tty -s && exit

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1957863

Title:
  coding errors in update-motd-fsck-at-reboot script

Status in update-notifier package in Ubuntu:
  Confirmed

Bug description:
  The script /usr/lib/update-notifier/update-motd-fsck-at-reboot contains some coding errors.
  One of the errors hides the other error:

  1. It sets two variables NEEDS_FSCK_CHECK and NEED_FSCK_CHECK (missing
  'S') but only checks one of them (NEEDS_FSCK_CHECK).  Because of this
  error, the script doesn't always initialize the value of
  NEEDS_FSCK_CHECK at the start of the script, so whatever value might
  happen to be passed in from the environment of the script could force
  a check even if the script would not itself do so.

  Rename variable NEED_FSCK_CHECK to NEEDS_FSCK_CHECK and always run
  your Bourne shell scripts with the "-u" (check for undefined
  variables) option enabled:  #!/bin/sh -u

  2. It sets the variables with values "no" and "yes", but *any* value set in the variables means "yes".  (It doesn't check that the value is actually "yes", so even "no" means "yes".)  Because of coding error #1, this coding error #2 has no effect on the script operation, so if you fix coding error #1 without fixing this one, the script will incorrectly always run.  You have to fix both.
  Change:

      if [ -n "$NEEDS_FSCK_CHECK" ]; then

  to actually check for a "yes":

      if [ "$NEEDS_FSCK_CHECK" = 'yes' ]; then

  P.S. This script uses dumpe2fs that waits for all the disks on your
  system to spin up, which can significantly delay an ssh login to your
  system, as well as cause unnecessary wear on all your normally idle
  disks since the script seems to run frequently.  If you don't like
  this behaviour (and don't need the fsck information it generates), you
  can render the script inactive by adding this line to /etc/crontab:

      01 * * * * root f=/var/lib/update-notifier/fsck-at-reboot ; test
  -e $f && touch $f

  It would be nice if there were a cleaner way (perhaps something in
  /etc/default/?) to disable all this disk-spin-up activity, but that
  would be a different bug report.

  ProblemType: Bug
  DistroRelease: Ubuntu 20.04
  Package: update-notifier-common 3.192.30.10
  ProcVersionSignature: Ubuntu 5.11.0-46.51~20.04.1-generic 5.11.22
  Uname: Linux 5.11.0-46-generic x86_64
  ApportVersion: 2.20.11-0ubuntu27.21
  Architecture: amd64
  CasperMD5CheckResult: skip
  Date: Thu Jan 13 23:40:37 2022
  EcryptfsInUse: Yes
  InstallationDate: Installed on 2020-10-07 (463 days ago)
  InstallationMedia: Lubuntu 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731)
  PackageArchitecture: all
  SourcePackage: update-notifier
  UpgradeStatus: No upgrade log present (probably fresh install)
  modified.conffile..etc.apt.apt.conf.d.10periodic: [modified]
  mtime.conffile..etc.apt.apt.conf.d.10periodic: 2020-10-08T05:49:47.646282

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/1957863/+subscriptions




More information about the foundations-bugs mailing list