[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian Graphical Installer: why does it format swap?



On Wed 08 Jan 2020 at 20:48:53 (+0100), Linux-Fan wrote:
> Michael Stone writes:
> 
> > […] Perhaps some discussion sent to the BTS about alternate
> > behaviors would be useful, rather than just rants that "something" is
> > "broken"?
> 
> I am not the OP, yet I have often wondered about this behaviour of
> formatting swap. I think existing swap partitions can be present under
> various circumstances:
> 
> * A single swap partition from a previous installation.
>   In this case (which I would consider the most common one?), there
>   is no real difference whether the swap is formatted again or not.
> 
> * A single swap partition from other (actively used or not) installations.
>   In this case, changing the UUID _breaks_ all other installations at the
>   expense of the new installation. I agree that sharing a swap space is
>   bad with suspend-to-disk scenarios in general. Yet I think that not
>   reformatting and actually sharing the swap between multiple installations
>   works in two (very common?) scenarios:
>   (1) No suspend to disk used
>   (2) Resumption after suspend to disk always happens for the "correct"
>   Linux installation even if multiple ones are present. I am not exactly
>   sure how suspend to disk behaves (as I did not use it since I switched
>   to Linux...), but I remember that on Windows it would bypass the regular
>   BIOS screens and directly resume the OS. Hence, is the chance that the
>   "wrong" sytstem is resumed (causing all kinds of havoc) so high actually?
> 
> * Multiple swap partitions.
> 
> My proposal would be as follows:
> 
> * If a swap partition is already present, do not use it by default.
>   As some people always point out: Today, there are a lot of users not
>   needing/wanting any swap.
> 
> * If the user selects the existing partition (i.e. not created in this
>   installer session) for "use as: swap", then the installer gives a dialog
>   with this text (or similar in better English...):
> 
> | You have selected a previously existent swap partition to be used for
> | swap.
> |
> | While this is tecnically possible without reformatting, sharing swap
> | between multiple Linux installations (Debian or not) is explicitly
> | advised against (see <<<URL>>> for details).
> |
> | Format this swap?
> |
> | [YES, Format Swap]  [NO, Use existing UUID]
> 
>   <<<URL>>> would be replaced by a link to the documentation elaborating
>   on the dangers of sharing swap and the constraints under which it might
>   be reasonable.
> 
> Btw. thanks for sharing the bug report (here is a link):
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=905793
> 
> My typical use of systems
> 
> * All systems have swap because I run out of RAM multiple times per year.
>   Yes I know I should upgrade RAM, but my most "powerful" system is
>   maxed out at 32GB RAM, thus I am left with buying a new system
>   [planned] or swap and the swap made things work which were otherwise
>   "impossible" -- one of the reasons for using Linux in the end...
>   And then, when it comes to buying a new system it might seem overkill to
>   have enough RAM for "all of the times", instead of "most of the times"
>   which is my reason for believing that swap is not going away anytime soon?
> 
> * No suspend to disk
> 
> * No multi-boot configuration.
>   I fail to see how multiple Linux boots are still such a common use
>   case now that all kinds of technology simplify the process of running
>   multiple distributions "under another" (VMs and Containers come to mind).
>   But then again, I am among the "Linux for doing the otherwise impossible"
>   group of people thus I like to see advances in Linux technology also
>   outside the areas that I am using it for :)
> 
> * Final point: I know that I got problems with this reformatting in the
>   past although reading my "typical use", I should not ever come to see
>   any negative consequences from it...
>   For me it boils down to: Formatting is a surprising default?

I would agree, and just add that when creating and formatting a swap
partition *is* requested¹, the screen should allow setting a LABEL,
which is the same as with filesystem partitions.

One other point while I'm here. Does anyone know why the installation
manual emphatically emphasises (tautology, I know), that you
shouldn't use swapon from a shell yourself:

    "Doing things manually from the shell may interfere with the
    installation process and result in errors or an incomplete
    installation. In particular, you should always use let the
    installer activate your swap partition and not do this yourself
    from a shell."

Until I realised that I could restore the LABEL on the swap partition
later in the installation, I used to swapon immediately after the
partitioning step and before "Install the base system"².

¹ the default would be leaving them alone, the same as for pre-
  existing filesystem partitions.

² disclaimer: kids, don't do this at home.

Cheers,
David.


Reply to: