Bug 186252 - Cannot mount an encrypted swap file in fstab
Summary: Cannot mount an encrypted swap file in fstab
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: Any Any
: Normal Affects Some People
Assignee: freebsd-bugs mailing list
URL:
Keywords: feature, needs-patch, security
Depends on:
Blocks:
 
Reported: 2014-01-29 19:00 UTC by Mark Voortman
Modified: 2019-02-20 05:16 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Voortman 2014-01-29 19:00:00 UTC
Adding

  md none swap sw,file=/swap 0 0

to /etc/fstab mounts the swap file on boot, but it will be unencrypted. When I make it md.eli (or md0.eli or /dev/md.eli or /dev/md0.eli) the swap file is not mounted. This approach does work for swap partitions (e.g., /dev/ada1.eli).

How-To-Repeat: Create a swap file:

  dd if=/dev/zero of=/swap bs=1024k count=64
  chmod 0600 /swap

and add it to /etc/fstab

  md.eli none swap sw,file=/swap 0 0

and reboot. The (encrypted) swap file will not be available.
Comment 1 Bryan Drewery freebsd_committer 2015-05-14 03:54:01 UTC
For me the basic md vnode swap doesn't work. It just creates the md but does not load the swap on boot. If I mdconfig -d -u 99 and then service swap start (swapon -aq), it works.
Comment 2 Bryan Drewery freebsd_committer 2015-05-14 03:55:56 UTC
At boot there is "swapon: /dev/md0: Read-only file system"
Comment 3 Bryan Drewery freebsd_committer 2015-05-14 04:00:09 UTC
My problem is Bug #195326
Comment 4 Adam Mackler 2015-10-16 16:51:41 UTC
I would use this feature if available, that is configuring an encrypted swap file in /etc/fstab the same way as for a swap partition.  FreeBSD 10.2.
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:50:36 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"