Bug 1186908 - Systemd boot sequence waits FOREVER for impossibiiity
Summary: Systemd boot sequence waits FOREVER for impossibiiity
Keywords:
Status: CLOSED DUPLICATE of bug 1096910
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 21
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-28 20:53 UTC by David A. De Graaf
Modified: 2015-02-05 20:30 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-02-05 20:30:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description David A. De Graaf 2015-01-28 20:53:23 UTC
Description of problem:
Systemd waits with NO LIMIT for filesystem that's unavailable


Version-Release number of selected component (if applicable):



How reproducible:
Perfectly


Steps to Reproduce:
1. See below
2.
3.

Actual results:
Frozen boot


Expected results:
Successful boot


Additional info:

Oh what a joy to discover yet another screwup in that Tower of Babel
we know as systemd.  This one has rendered my IBM T30 laptop
unbootable.

The screen shows the boot process waiting for an anonymous filesystem
to become available.  It is waiting with "no limit"; thus far over 15
hours with no end in sight.

This is an attempt to boot to single-user mode - I appended an "s" to
the grub kernel line - because the same infinite wait occurred on a
normal boot.  In olden days, single user mode guaranteed an emergency
shell prompt, whence repairs could be made.  No more.

The critical missing filesystem is the swap partition, which is
encrypted.  How I got to this impasse involves several other defects
in the installer, grub2, and encryption, but let me be clear that this
bugzilla is to report the stupid choice to wait with NO LIMIT for
something - anything - to become available during boot.
I note that the time waited and the time to wait are now reported.
That's one small step for logic.

1 - systemd should NEVER wait forever during boot.
2 - systemd must NEVER prevent single user mode from arriving at an
emergency shell.


Because it's relevant I will describe the comedy of screwups that led
to this situation.

Prior to installing F21, this laptop was configured with standard
partitions of
  /dev/sda1      /boot
  /dev/sda5      /f19          encrypted
  /dev/sda6      /     (F20)   encrypted
  /dev/sda7      /home         encrypted
  /dev/sda8      swap          encrypted
The /boot partition contained a mishmash of kernels for both F19 and
F20 and the grub.cfg contained paragraphs for all of them.
This scheme worked fine in the days of grub, but grub2 makes a
terrible mess of it, as reported in earlier BZs (837430).
So in the sequence of annoying bugs, here's #3:

3 - grub2 can't sort out multiple systems in /boot.

I determined to segregate F21 from F20, putting their respective boot
files into their own /boot subdirectories in the separate root
filesystems.  The /boot partition would be repurposed as /mainboot
and would contain a handcrafted grub.cfg that would switch to grub.cfg
in one or the other root filesystem.

This required the root filesystems to be de-encrypted.  What better
way to accomplish this than to freshly install F21 into a newly
formatted and unencrypted /dev/sda5, while retaining the existing
encryption of /home and swap.

I soon discovered that the installer cannot cope with formatting a
previously encrypted partition.  I reverted to a properly competent
partition manager - gparted-live - which handily reformatted
/dev/sda5.  So here's #4:

4 - installer cannot reformat an encrypted partition

Despite the unwieldy user interface, I was able to attach the (still
encrypted) /home partition to the new F21 configuration without
reformatting it or otherwise disturbing its contents.  Likewise for
the encrypted /dev/sda6 /f20 mountpoint.
But nothing would allow me to similarly attach the swap partition.
So I went ahead without a swap partition.

5 - installer has no means to attach an existing swap partition.

The new F21 installation booted up nicely, except it lacked swap
space.  So, I added an entry to /etc/fstab, copying the one that
worked from /f20/etc/fstab for the encrypted swap partition.
Since the encryption passphrase is the same for all three encrypted
partitions, I thought this would surely be OK.  It wasn't.

6 - the installer, grub2, systemd, whatever, can't deal competently
with encrypted partitions.

I suspect that I was expected to add something to /etc/crypttab when I
added swap to /etc/fstab.  If I can find a way to regain access to the
machine, I'll try that.  Otherwise, I'll have to trash the installation
and start over.

LATER ---
System is recovered.  I booted from Live Xfce4 USB stick, mounted the
new /f20 filesystem, edited /etc/fstab to remove the swap line, and
rebooted.
Then with the new F20 system running (without swap), I edited
/etc/crypttab, adding the swap partition entry copied from the F19
filesystem, and reedited /etc/fstab to also restore the swap line.

Rebooted.  All is well.  The old encrypted swap partition is in use.

It shouldn't be this hard...

Comment 1 Jan Synacek 2015-01-29 09:25:53 UTC
(In reply to David A. De Graaf from comment #0)
> Additional info:
> 
> Oh what a joy to discover yet another screwup in that Tower of Babel
> we know as systemd.  This one has rendered my IBM T30 laptop
> unbootable.

Way to go about reporting bugs. You'll be glad if the good people of the systemd team won't ignore you.

Comment 2 Zbigniew Jędrzejewski-Szmek 2015-01-31 00:56:57 UTC
There are no good people in the systemd team. Only tough bastards are left.

(Unless you define "good people" as Ford Maddox Ford did: "It would have been better if they went at each other's eyes with carving knives, but they were what is called 'good people'". :))

Comment 3 Lennart Poettering 2015-02-04 19:16:08 UTC
If a mount or swap device is not critical for boot, then mark it as such with "nofail". If you don't specify that we'll wait for 90s for it, and then enter a recovery console, by default.

"nofail" is not an invention of systemd btw, it existed on sysvinit already.

For security reasons we cannot continue boot if a file system that is marked critical cannot be found. Otherwise attackers might be able to trigger bugs that happen because some files are missing, are not writable, or because some files are revealed that are normally overmounted.

Closing.

Comment 4 Zbigniew Jędrzejewski-Szmek 2015-02-04 23:52:05 UTC
IIUC, the bug is about not going to a rescue shell properly.

Comment 5 David A. De Graaf 2015-02-05 16:18:34 UTC
Thank you, Zbigniew Jędrzejewski-Szmek.
Yes, this bug is exactly about failure to reach a rescue shell,
and about defensive programming, or lack thereof.

Yes, the man page for mount(8) does say:
  nofail   Do not report errors for this device if it does not exist.
         
and that is exactly NOT what is appropriate here.  If a device is not
available I expect systemd to complain LOUDLY, and then do something
sensible.  If this is a normal boot sequence, it should fail, maybe
even lock up.  But if this is a boot into single user mode, the boot
should fail, and devolve to a rescue prompt.  Freezing up should NOT
be an option.

Mr. Poettering seems to want to transfer responsibility for the needed
defensive programming to the user.  I would hope for something better.

I cannot recall an instance where sysV ever failed to reach a rescue
prompt in single user mode when the boot could not be completed,
without user intervention.

Comment 6 Zbigniew Jędrzejewski-Szmek 2015-02-05 20:30:06 UTC
I think you're reading too much into Lennarts' response. Your posts are very long and it is hard to find the important part: that the boot effectively hung. 
Anyway, this seems to be a duplicate.

*** This bug has been marked as a duplicate of bug 1096910 ***


Note You need to log in before you can comment on or make changes to this bug.