Live data from Hacker News

A warning about 5.12-rc1

lwn.net

61–70 of 115 posts

Re: A warning about 5.12-rc1

#61

Why are swap files/partitions constant size? Most of the time, I don't need any swap at all, and any swap file/partition is wasted space. While hibernated, I need ~the amount of system ram as swap. While running some horrendous matlab script, I need about 1TB of swap. Yet linux won't dynamically allocate it like other files. I'm forced to constantly resize it manually to save space or be able to do more things.

That sounds like what systemd-swap does. Apparently, hibernation is not quite working yet, though.

https://github.com/Nefelim4ag/systemd-swap

Re: A warning about 5.12-rc1

#62

Earlier quoted context omitted.

While it's the default setup of the auto installer it common (and IMHO best) practice to change it to install with a swap partition. It's just that it's much easier for anyone who just gets started with Linux to have a swap file. For example for hibernation you swap partition needs to have the right size. But people do upgrade their desktop RAM and as such would need to resize the partition, which isn't easy (because…

I used to use a swap partition, but then if you get the partition size wrong you're lumbered with it. Why wouldn't you use a file. At one point in the past I used the default (or recommended) /boot size and got stuck a couple of years later juggling at updates to fit the boot files into the partition. I just use a monolithic partition per OS per disk now and swap files within that. Is that not good practice (for home…

`/home` should be separate from the system so you can reinstall it without trouble. Same for `/var` (or subdirectories) if you value the data of particular services. Other than that, the bootloader and EFI must be able to access certain directories like `/boot` and `/boot/efi`. As long as it works for your use cases, everything is alright.

Edit: A swap file has a little bit of overhead because of the underlying file system. But at the point you notice this, your system is pretty much frozen anyways.

Re: A warning about 5.12-rc1

#64
I used to assume that Linux had a huge test suite with hundreds of thousands of tests, given the crazy feature matrix that the kernel has to support.

And that they would have started requiring tests for new features and bug fixes.

Alas, that's not the case. There are a few external test suites like the Linux Test Project [1], but nothing that looks very extensive.

The process seems to mostly rely on maintainers giving patches a good look, plus developers and first line users, including hardware manufacturers and corps like IBM or Red Hat, running their own software on kernel pre-releases and reporting the bugs.

I realize that most of Linux is device drivers or code that is tightly coupled to hardware, which is more or less impossible to test without a huge test farm and lot's of manual labor, but it's still surprising to me that they don't do it for the more or less device independent functionality.

This particular bug looks like it might have been caught by a relatively straight-forward swap file test case.

[1] https://github.com/linux-test-project/ltp

Re: A warning about 5.12-rc1

#65
post #11
post #6

this is unlikely to hurt you unless you use a swap file , rather than a dedicated swap partition. for performance reasons most any modern linux installation would be using a dedicated swap partition, that is defined as swap-only during the install process with mkswap In my experience some of the reasons for using a swap file were more common maybe 10 or 15 years ago. Nowadays with disk space being less costly and rar…

Swapfiles are quite common when you use FDE (say, LUKS) and you don't want your swap to be in plaintext on disk. (Although, you could just have an entire LUKS-encrypted swap volume instead of a swapfile...)

Even with full-disk encryption you have two options that I'd recommend over a swap file:

- lvm on luks: inside the luks dm-crypt container, create multiple logical volumes: one for swap, one for the root filesystem

- swap on dm-crypt: create a separate encrypted partition for swap

Since the swap data needs no permanence, it's possible to generate a new encryption key every boot. Debian's crypttab supports this out of the box [0]:

    cswap  /dev/sda6  /dev/urandom  cipher=aes-xts-plain64,size=256,hash=sha1,swap
(although I'd recommend using a /dev/disk/by-id/ path there, for obvious reasons. The scripts do check there's no valid signature on the partition before formatting, but still...)

[0] https://manpages.debian.org/buster/cryptsetup-run/crypttab.5...

Re: A warning about 5.12-rc1

#66

Why are swap files/partitions constant size? Most of the time, I don't need any swap at all, and any swap file/partition is wasted space. While hibernated, I need ~the amount of system ram as swap. While running some horrendous matlab script, I need about 1TB of swap. Yet linux won't dynamically allocate it like other files. I'm forced to constantly resize it manually to save space or be able to do more things.

The answer to why a partition is constant size: you are permanently reserving that amount of disk space, that's what a partition is.

Swapfiles aren't dynamic for the same reason, but, you can have multiple swapfiles, and when they are empty, you can discard them. If you really want dynamic swap, you can run swapfiled, which will monitor memory usage and create and mount swapfiles of a given granularity on demand.

If you're going to hibernate, you need that system RAM sized swap space immediately, and what are you going to do if it fails? Right, you need that to be permanently allocated.

If you have a matlab script that needs 1TB of swap, I don't know why you're running it here. Buy a server with a TB of RAM, or rent one. Swapping a terabyte is one of those edge cases where nobody expects the system to be usable for anything else for hours or days.

Re: A warning about 5.12-rc1

#67
post #32

Earlier quoted context omitted.

> It adds plausible deniability. How so?

Because the disk drive has a Windows-styled layout and EFI partition. The encrypted partition just looks like random data. Since the bootloader for my encrypted disk isn't on there, it is harder to determine that it even exists. There is no requirement on what type of partition type you use for your LUKS2 encrypted partition, so ideally you'd use something that isn't going to be apparent. Then, as long as knowledge o…

Since the bootloader for my encrypted disk isn't on there, it is harder to determine that it even exists.

How does make it harder to determine your encrypted partition exists? The usual way encryption aids plausible deniability is through multiple keys, e.g. when one key unlocks a seemingly innocuous-looking installation, while the other unlocks the nasty bits.

Having an encrypted partition in plain sight offers no plausible deniability at all to me, especially if it contains a default LUKS header. You might get away with arguing the disk is unused when the partition has a detached header, but even then you'd have to argue why a non-functioning machine is fully equipped with monitor, keyboard and network connections.

Re: A warning about 5.12-rc1

#68
post #51
post #2

Linus really does write beautifully. Love his style, concise, easily readable, frank, honest with nice human touches.

> So I'm not blaming the developers in question, Much kinder than past Linus writings. I loved it too. "Double ungood" works at least as good as the swearing.

For anyone who didn't recognize it, that's a reference to Orwell's Newspeak (https://en.wikipedia.org/wiki/Newspeak). Which makes me wonder about two things:

- is Linus hinting that he is censoring himself, and if he wasn't, what expression would he have used instead?

- for what kind of incident does he reserve the attribute "double plus ungood"? Probably if such a bug would get into the production kernel?

Re: A warning about 5.12-rc1

#69
post #51
post #2

Linus really does write beautifully. Love his style, concise, easily readable, frank, honest with nice human touches.

> So I'm not blaming the developers in question, Much kinder than past Linus writings. I loved it too. "Double ungood" works at least as good as the swearing.

In my view seeing him writing double ungood worries me.

Don't need to swear, but he could have written "very bad" or something like that.

Re: A warning about 5.12-rc1

#70
post #51
post #2

Linus really does write beautifully. Love his style, concise, easily readable, frank, honest with nice human touches.

> So I'm not blaming the developers in question, Much kinder than past Linus writings. I loved it too. "Double ungood" works at least as good as the swearing.

I can recall a colleague, many years ago, sometimes using "doubleplusungood", often shortened -- in (typical lazy UNIX admin style -- to just

  ++ungood
Later, another cow-orker tried using a slight variant ...

  ++!good
... although that one never really caught on -- apparently it didn't compile or something (maybe because we were using Red Hat's version "2.96" of gcc at the time?).

--

(+10 Internet points if you get the reference(s))

Post reply on HN