Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add swapoff flag #454

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

pmaterer
Copy link

This is a fix for #450.

Adds a flag --swapoff which enables the features added in #421.

So now, by default, swapoff -a will not run during the reboot phase. Only when you have a ZFS swap device would you need to pass the --swapoff flag. This way users who are using a swap device during the install won't have things break.

docs/cli.md Show resolved Hide resolved
docs/cli.md Show resolved Hide resolved
@@ -619,7 +625,9 @@ if [[ ${phases[reboot]} == 1 ]]; then
if command -v zpool >/dev/null && [ "\$(zpool list)" != "no pools available" ]; then
# we always want to export the zfs pools so people can boot from it without force import
umount -Rv /mnt/
swapoff -a
if [[ ${swapoff} == "y" ]]; then
swapoff -a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I don't like about this change is that it breaks the export the when people have swap on ZFS.
People shouldn't need to have adding a flag to make nixos-anywhere work.

Copy link
Member

@Mic92 Mic92 Feb 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something like this is more sensible:

Suggested change
swapoff -a
# turn all swap devices that are baked by zfs.
swapon --show --noheadings | awk '/^\/dev\/zd/ {print $1}' | while read device; do
swapoff "$device"
done

You would need to have your system not have swap in zfs. However you need to do this anyway because with 1GB you would run into deadlock issues with zfs if you would try to have it in the pool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants