Bug 1141700 - Do not autoactivate swaps on machine running live images
Summary: Do not autoactivate swaps on machine running live images
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: spin-kickstarts
Version: 22
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jeroen van Meeuwen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:7bbee9d4e3332a8bc2b607e5e1a...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-15 09:30 UTC by Vratislav Podzimek
Modified: 2016-07-19 12:08 UTC (History)
18 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1114786
Environment:
Last Closed: 2016-07-19 12:08:12 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Vratislav Podzimek 2014-09-15 09:30:19 UTC
+++ This bug was initially created as a clone of Bug #1114786 +++

Description of problem:
1. Prior F21 installation.
2. Click on one of the prior install partitions, and chose to delete it, and ticked box to remove all related partitions.
3. The prior swap is being used by the live environment so it can't be deleted. Selected it, ticket the Reformat box and clicked Update settings.
CRASH

Version-Release number of selected component:
anaconda-core-21.45-1.fc21.x86_64

The following was filed automatically by anaconda:
anaconda 21.45-1 exception report
Traceback (most recent call first):
  File "/usr/lib/python2.7/site-packages/blivet/devices.py", line 1039, in _setFormat
    raise errors.DeviceError("cannot replace active format", self.name)
  File "/usr/lib/python2.7/site-packages/blivet/devices.py", line 1600, in _setFormat
    StorageDevice._setFormat(self, fmt)
  File "/usr/lib/python2.7/site-packages/blivet/devices.py", line 1048, in <lambda>
    lambda d,f: d._setFormat(f),
  File "/usr/lib64/python2.7/site-packages/pyanaconda/ui/gui/spokes/custom.py", line 807, in _do_reformat
    device.format = old_format
  File "/usr/lib64/python2.7/site-packages/pyanaconda/ui/gui/spokes/custom.py", line 120, in decorated
    return func(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/pyanaconda/ui/gui/spokes/custom.py", line 1147, in _save_right_side
    encrypted, selector, fs_type)
  File "/usr/lib64/python2.7/site-packages/pyanaconda/ui/gui/spokes/custom.py", line 2490, in on_update_settings_clicked
    self._save_right_side(self._current_selector)
  File "/usr/lib64/python2.7/site-packages/pyanaconda/ui/gui/utils.py", line 241, in _run_once_one_arg
    self._func(*args, **kwargs)
DeviceError: ('cannot replace active format', 'sda6')

Additional info:
cmdline:        /usr/bin/python  /sbin/anaconda --liveinst --method=livecd:///dev/mapper/live-base
cmdline_file:   BOOT_IMAGE=/syslinux/vmlinuz0 elevator=deadline nomodeset enforcing=0 root=live:UUID=82A4-FF9A rw rd.live.image overlay=UUID=82A4-FF9A
executable:     /sbin/anaconda
hashmarkername: anaconda
kernel:         3.16.0-0.rc2.git1.1.fc21.x86_64
other involved packages: python-blivet-0.59-1.fc21.noarch, anaconda-gui-21.45-1.fc21.x86_64
product:        Fedora
release:        Fedora release 21 (Rawhide)
type:           anaconda
version:        rawhide

--- Additional comment from Chris Murphy on 2014-06-30 22:34:14 EDT ---



--- Additional comment from Chris Murphy on 2014-06-30 22:34:16 EDT ---



--- Additional comment from Chris Murphy on 2014-06-30 22:34:18 EDT ---



--- Additional comment from Chris Murphy on 2014-06-30 22:34:25 EDT ---



--- Additional comment from Chris Murphy on 2014-06-30 22:34:27 EDT ---



--- Additional comment from Chris Murphy on 2014-06-30 22:34:28 EDT ---



--- Additional comment from Chris Murphy on 2014-06-30 22:34:29 EDT ---



--- Additional comment from Chris Murphy on 2014-06-30 22:34:31 EDT ---



--- Additional comment from Chris Murphy on 2014-06-30 22:34:34 EDT ---



--- Additional comment from Chris Murphy on 2014-06-30 22:34:36 EDT ---



--- Additional comment from Chris Murphy on 2014-09-06 16:25:59 EDT ---

Still get this when reformatting an existing active swap partition, which is the only way I can see how to reuse an existing swap partition in the UI. I'd rather be allowed to just add the current swap leaving it active, rather than reformat it.

anaconda-21.48.4-1.fc21.i686
python-blivet-0.62-1.fc21.noarch

--- Additional comment from Fedora Blocker Bugs Application on 2014-09-06 16:31:08 EDT ---

Proposed as a Blocker for 21-beta by Fedora user chrismurphy using the blocker tracking app because:

 When using the custom partitioning flow, the installer must be able to: Assign mount points to existing storage volumes.

Strictly speaking swap isn't a mount point, but we can take our pick. I should be able to either reuse an existing swap partition, or reformat it, and in any case not get a crash.

--- Additional comment from Vratislav Podzimek on 2014-09-08 02:57:39 EDT ---

I'm not sure blivet could fix this. Existing swap in use can hardly be reformatted or deactivated by blivet. And using a swap device without reformatting for a new system can be quite dangerous as it can be being used by the other system at that point (hibernated system or anything else). Maybe anaconda could turn off those swap devices when starting? Or maybe we should disable automatic swap activation in the live system? The latter seems to me as the best option. Brian, what is your opinion on this?

--- Additional comment from Chris Murphy on 2014-09-08 14:54:25 EDT ---

The test system uses EFI/GPT, and swap partition has the linux swap partition type GUID set, therefore systemd auto-activates it even though it's not in the live install media fstab. This is probably not common yet, the common case is swap on LVM LV, which is not auto-activated. 

I'm not super familiar with the systemd autoactivate swap code, but it does seem to have a check whether there's a hibernation image in place on swap so I don't think you have to worry about this. In which case the right automatic thing to do is keep it active, and do nothing. It doesn't even need to be added to fstab.

So it's actually an interesting UI/UX issue. If this active swap is left alone, it will be used by the newly installed system via systemd autoactivation. So which is better for Manual Partitioning UI when the user clicks the blue link to create things automatically? a.) Don't include swap partitions with GPT partition type GUID, even though it is being used and will be used in the new install; b.) "fib" by showing it listed as part of the current installation but don't put it in fstab; c.) show it listed as part of the installation but do include it in fstab; d.) create a new swap partition.

I'd say d is not great. It wastes space. I'd opt for b or c, more likely b. It's more truth than fib, even though an fstab entry isn't being created.

--- Additional comment from bcl on 2014-09-09 17:19:53 EDT ---

First off, we shouldn't traceback so we should figure out a clean way to deal with it.

I don't think swap should be auto-activated by booting a live image -- we shouldn't be touching the user's disks until they tell us to. The live script should be disabling automounting, and if this also happens with non-live we should do the same in lorax.

--- Additional comment from Vratislav Podzimek on 2014-09-11 04:53:05 EDT ---

(In reply to bcl from comment #15)
> First off, we shouldn't traceback so we should figure out a clean way to
> deal with it.
Anaconda shouldn't allow reformatting a device that is in use, resassigning back to anaconda.

> 
> I don't think swap should be auto-activated by booting a live image -- we
> shouldn't be touching the user's disks until they tell us to. The live
> script should be disabling automounting, and if this also happens with
> non-live we should do the same in lorax.
It happens only in live installations. What is the right component to clone this bug to?

--- Additional comment from bcl on 2014-09-11 11:35:38 EDT ---

(In reply to Vratislav Podzimek from comment #16)
> (In reply to bcl from comment #15)
> > First off, we shouldn't traceback so we should figure out a clean way to
> > deal with it.
> Anaconda shouldn't allow reformatting a device that is in use, resassigning
> back to anaconda.

But python-blivet really shouldn't traceback either.

> > I don't think swap should be auto-activated by booting a live image -- we
> > shouldn't be touching the user's disks until they tell us to. The live
> > script should be disabling automounting, and if this also happens with
> > non-live we should do the same in lorax.
> It happens only in live installations. What is the right component to clone
> this bug to?

spin-kickstarts

--- Additional comment from Michael Catanzaro on 2014-09-12 22:38:12 EDT ---

Comment 1 Kalev Lember 2014-09-15 09:44:37 UTC
> I don't think swap should be auto-activated by booting a live image -- we
> shouldn't be touching the user's disks until they tell us to. The live
> script should be disabling automounting, and if this also happens with
> non-live we should do the same in lorax.

Any suggestion how the live media should be disabling automatic swap activation?

Comment 2 Michael Catanzaro 2014-09-15 15:31:23 UTC
systemd activates swap partitions based on two different mechanisms, both are executables in /usr/lib/systemd/system-generators. The generators are run on start-up and create native systemd units for mounts. The first, systemd-fstab-generator, reads the fstab to generate units, including a unit for swap. The second, systemd-gpt-auto-generator inspects the root disk to generate units. It operates on GPT disks only, and can identify swap partitions by their type code 82. [1]

So I guess we need to somehow disable only the swap functionality of these generators....

[1] https://wiki.archlinux.org/index.php/Swap#Activation_by_systemd

Comment 3 Adam Williamson 2014-09-15 17:09:43 UTC
Note https://bugzilla.redhat.com/show_bug.cgi?id=1114786#c19 . I think there's some misunderstanding going on here, and it may not be systemd activating the swaps at all; there is code in the 'livesys' service that runs on live image boot to activate all swaps it finds on the system, and that code has been there for years.

Comment 4 Petr Schindler 2014-10-03 13:51:54 UTC
I tried to reproduce this. I installed disk without using lvm (/boot, / and swap), then I used anaconda to delete all (even with custom partitioning as described here) and no error appeared. Is this bug still valid?

When I run free in console, system used old swap and after anaconda reformated the disk the live system seemed to use new swap.

Comment 5 Michael Catanzaro 2014-10-03 14:12:25 UTC
Do you have a GPT partition table?

Anyway, this is really the same issue as bug #1114786; there's been some discussion there recently....

Comment 6 Adam Williamson 2014-10-03 17:41:57 UTC
Discussed at 2014-10-03 blocker review meeting: http://meetbot.fedoraproject.org/fedora-blocker-review/2014-10-03/f21-blocker-review.2014-10-03-15.58.log.txt . We're not sure if it's useful to have a second bug open or not so we won't dupe this, but we'll at least state that for blocker review purposes, we'll consider #1114786 as the bug that holds potential blocker status, therefore we're 'un-nominating' this one.

Comment 7 Jaroslav Reznik 2015-03-03 16:17:43 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 8 Fedora End Of Life 2016-07-19 12:08:12 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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