Skip to content

Commit

Permalink
setup-disk: set swap mount point to "none" to avoid creating /swap
Browse files Browse the repository at this point in the history
Previously, the swap mount point was set to "swap". This works, but
inadvertently creates the directory /swap when booting. According to
fstab(5), the mount point should be set to "none" for swap.
  • Loading branch information
tom93 authored and ncopa committed Oct 16, 2024
1 parent 5049015 commit 63205eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions setup-disk.in
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ install_mounted_root() {
if [ -n "$SWAP_DEVICES" ]; then
local swap_dev
for swap_dev in $SWAP_DEVICES; do
printf "%s\tswap\tswap\tdefaults\t0 0\n" \
printf "%s\tnone\tswap\tdefaults\t0 0\n" \
"$(uuid_or_device $swap_dev)" \
>> "$mnt"/etc/fstab
done
Expand Down Expand Up @@ -996,7 +996,7 @@ setup_swap_dev() {
SWAP_DEVICES=
for swap_dev in "$@"; do
$MOCK mkswap $swap_dev >/dev/null
printf "%s\tswap\t\tswap\tdefaults 0 0\n" \
printf "%s\tnone\t\tswap\tdefaults 0 0\n" \
"$(uuid_or_device $swap_dev)" >> "${ROOT}etc/fstab"
SWAP_DEVICES="$SWAP_DEVICES $swap_dev"
done
Expand Down
4 changes: 2 additions & 2 deletions tests/setup_disk_test
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ setup_disk_sys_body() {
-o match:"^ext4$"\
awk '$2 == "/boot" {print $3}' mnt/etc/fstab
atf_check \
-o match:"^swap$"\
awk '$2 == "swap" {print $3}' mnt/etc/fstab
-o inline:"none\n"\
awk '$3 == "swap" {print $2}' mnt/etc/fstab
}

setup_disk_install_mounted_root_nvme_body() {
Expand Down

0 comments on commit 63205eb

Please sign in to comment.