#encrypted swap not working + screenshare on wayland
1 messages · Page 1 of 1 (latest)
org.kde.xwaylandvideobridge: Could not select sources QDBusError("org.freedesktop.portal.Error.InvalidArgument", "Unavailable cursor mode 4")
DESKTOP-OUNAE5C /opt # dd if=/dev/zero of=swap count=8192 bs=1M
8192+0 records in
8192+0 records out
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 4.02722 s, 2.1 GB/s
DESKTOP-OUNAE5C /opt # btrfs subvolume create swap_vol
Create subvolume './swap_vol'
DESKTOP-OUNAE5C /opt # chattr +C swap_vol
DESKTOP-OUNAE5C /opt # fallocate -l 8G swap_vol/swapfile
DESKTOP-OUNAE5C /opt # chmod 600 swap_vol/swapfile
DESKTOP-OUNAE5C /opt # swapon swap
swapon: /opt/swap: insecure permissions 0644, 0600 suggested.
swapon: /opt/swap: read swap header failed
DESKTOP-OUNAE5C /opt # chmod 600 swap_vol/swapfile
DESKTOP-OUNAE5C /opt # swapon swap
swapon: /opt/swap: insecure permissions 0644, 0600 suggested.
swapon: /opt/swap: read swap header failed
DESKTOP-OUNAE5C /opt # ```
DESKTOP-OUNAE5C /opt # dd if=/dev/zero of=swap count=8192 bs=1M
8192+0 records in
8192+0 records out
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 4.02722 s, 2.1 GB/s
DESKTOP-OUNAE5C /opt # btrfs subvolume create swap_vol
Create subvolume './swap_vol'
DESKTOP-OUNAE5C /opt # chattr +C swap_vol
DESKTOP-OUNAE5C /opt # fallocate -l 8G swap_vol/swapfile
DESKTOP-OUNAE5C /opt # chmod 600 swap_vol/swapfile
DESKTOP-OUNAE5C /opt # swapon swap
swapon: /opt/swap: insecure permissions 0644, 0600 suggested.
swapon: /opt/swap: read swap header failed
DESKTOP-OUNAE5C /opt # chmod 600 swap_vol/swapfile
DESKTOP-OUNAE5C /opt # swapon swap
swapon: /opt/swap: insecure permissions 0644, 0600 suggested.
swapon: /opt/swap: read swap header failed
DESKTOP-OUNAE5C /opt # emerge -pv util-linux
These are the packages that would be merged, in order:
Calculating dependencies... done!
Dependency resolution took 2.13 s.
[ebuild R ] sys-apps/util-linux-2.39.1::gentoo USE="(audit) (caps) cramfs cryptsetup hardlink logger ncurses nls pam readline (selinux) (split-usr) su suid (unicode) -build -fdformat -kill -magic -python (-rtas) -slang -static-libs -systemd -test -tty-helpers -udev -verify-sig" ABI_X86="32 (64) (-x32)" PYTHON_TARGETS="python3_11 -python3_10" 0 KiB
Total: 1 package (1 reinstall), Size of downloads: 0 KiB
* IMPORTANT: 19 news items need reading for repository 'gentoo'.
* Use eselect news read to view new items.
DESKTOP-OUNAE5C /opt #
try ```sh
cryptsetup --type plain -d /dev/urandom open path_to_swapfile swap
mkswap path_to_swapfile
swapon path_to_swapfile
after creating the btrfs subvolume and the swapfile
"Then, edit /etc/fstab and either /etc/crypttab (if using systemd) or /etc/conf.d/dmcrypt (if using OpenRC) to automatically active the swap file: ..."
i think this swapon: /opt/swap: read swap header failed is because you didnt mkswap first
also im not sure what doing cryptsetup on the file will do if the whole partition is already encrypted maybe try w/o just mkswap
also it's not recommended to use scripts unless you wrote them, or understand what the script(s) are doing
I wrote it
Changed my username though
ah I see
Ohh ok thanks
How would I undo all the steps I did already
Like creating the subvolume and stuff?
Btrfs subvolume delete swap_vol
rm swap
swapoff swap```
Like that?
you probably dont need to undo that just pick up where the last thing worked
like the subvol is probably good
was I supposed to swapon the file called 'swap' or should I have just did the swapfile in the volume?
should there be two separate files btw? Swap and swapfile?
im not sure why there's the two files
im scared that the 'swap' file was created by cryptsetup as the "mapped name" idk what those args do
it does appear as if you've successfully made and mounted swap_vol/swapfile tho
maybe try cryptsetup again with swap_vol/swapfile as both the last args?
was it the cryptsetup command that created swap?
No, the dd if=swap command
oh okay
yeah thats just a zero file rn you can delete it
cuz it looks like the other things you did worked
i dont know how to check if cryptsetup worked like the command returned success
i dont know what the command does lol i just picked it out of the wiki
cryptsetup created an encrypted subvolume
shouldn't it say [swap] next to it?
uhhh maybe
can you check if its functioning as swap
check top or something
see if you have swap
I do not see swap
ah the dmcrypt one then
ye
and you gotta enable the service
concerning rn tho is that the swapfile isnt working
maybe try swapon <file> again?
uh fuser /opt/swap_vol/swapfile ?
returned nothing
hmm
wth
maybe try again but without cryptsetup
see if that gets you swap at least
i mean
delete swap_vol/swapfile
fallocate it again
and just swapon it
and see if that works as swap
alright 👍
rm: cannot remove 'swap_vol/swapfile': Operation not permitted
I think I'd have to swapoff everything
lemme try rebooting and see if everything works first
okay yeah
uhhh yes lmao?
i mean its not gonna break anything important
yeah i think it was cryptsetup --type plain -d /dev/urandom open path_to_swapfile swap this that was wrong
and it should be cryptsetup --type plain -d /dev/urandom open path_to_swapfile path_to_swapfile
Ahh
maybe
Should I type no and then redo it?
nah you should type YES
and see what happens
maybe it works who knows
it looks like it almost wants to work
I think I might have to restart the process but thank you
I might call it a night due to that jui jitsu injury plus I've got a headache but thank you for all the help
yeah np lmk if it works later or not
Do you think you would be able to help me out later today @tardy crest
yeah sure
oh wait are you free rn
yeah
aight sick
what did you do yesterday with the yes/no thing
did you end up checking it out
or going and restarting or something
@whole pilot
I don't think any of it ended up working
I just switched to my Gentoo system btw
From windows
yeah just swapoff it and delete the swapfile
maybe swapoff isnt needed
just delete the swapfile and fallocate a new one
then try to swapon it without cryptsetup-ing it so we know the btrfs stuff works
basically just follow Swap Files - Creation on https://wiki.gentoo.org/wiki/Swap
dont do the Encrypted Swap bit
lol fair enough
yee sure
ok
back to square one
I'm pulling up thw wiki @tardy crest
it'll probably show [swap] if I reboot
should I?
yeah im not sure if the subvolume/swapfile should appear as a block device
maybe not
swapon --show is a good sign that its worked
now you can try to decipher the crpytsetup command and make that work if you want
also id uh unify your boot partition
you dont need two partitions for a uefi boot system
like the 8gb partition is doing nothing (?) except being the mountpoint for another partition your actual esp
cd /opt
btrfs subvolume create swap_vol
chattr +C swap_vol
cd swap_vol
dd if=/dev/zero of=swap count=8192 bs=1M
cryptsetup --type plain -d /dev/urandom open swap swap
mkswap swap
chmod 600 swap
swapon swap
swapon --show
#/etc/fstab
/opt/swap_vol/swap none swap sw 0 0
yeah that looks about right actually
#/etc/conf.d/dmcrypt
swap=swap
source=/opt/swap_vol/swap
youll want a dmcrypt entry too to automatically activate it
rc-update add dmcrypt boot
# If you are only using local swap partitions, you should not change
# this file. Otherwise, you need to uncomment the below rc_before line
# followed by the appropriate rc_need line.
rc_before="!localmount"
#
# If you are using swap files stored on local file systems, uncomment
# this line.
rc_need="localmount"
#
# If you are using swap files stored on network file systems or swap
# partitions stored on network block devices such as iSCSI, uncomment
# this line.
#rc_need="netmount"
did i post it well
alright, I have set it up
it works?
it was being weird
so
i got this once i unlocked my drive
then it said some weird stuff about hashing or something regarding swap
and then said dmcrypt failed to start
but now it started so idk
it's really weird
also idk why it's giving me that modprobe error
I only ran modprobe once a really long time ago on that kernel module
this is in lsblk btw
no [swap]
when i run swapon --show it doesn't work btw
like
there's no output
meaning it's not being autostarted
i ran swapon /opt/swap_vol/swap and it shows up under it but I don't have much of a way of checking it
oh wait c:
so it works but it's not autostarted
Not sure how to fix the autostart
I might be able to take a picture of the error but it's only on the screen for a split second
@timber flame could you possibly take a look?
video
I shall share my screen momentarily
Btw not a vid but how would I fix this warning
Regarding modules
And then involving swap, I'm not sure what to do
Around where decrypt is
@grave glen can you read for me please
WARNING: The --hash parameter is being ignored in plain mode with keufile specified
WARNING: Device /opt/swap_vol/swap already contains a 'swap' superblock signature
Detected device signature(s) on /opt/swap_vol/swap. Proceeding further may damage existing data.
I don’t think you were supposed to format it
Should have been an empty file
Or partition
#1134980581365665883 message
@timber flame this is what I had run
and then I have the files I edited and their contents up there too
you have to have it in a subvolume for btrfs and for encryption, you need the files that were specified
mkswap: unable to erase bootable sectors
Failed to setup dm-crypt devices
ERROR: dmcrypt failed to start
This is what it says after saying 'YES' btw
hello @timber flame are you possibly availible to look at it?
I don't think dmcrypt is the right place to setup (create) an encrypted block. If you're going to run a custom script anyway just create your own init script or call the script in local. Also why always recreate the block?
He’s doing encrypted swap because if you don’t need hibernation it is simpler than putting it inside the luks container. Especially compared to swap files on btrfs.
Random encryption key at startup means you don’t need to store the key somewhere, which also reduces complexity.
Ok I see the point. The warnings can be probably be avoided by running a few dd writes against the existing block before create.
The "unable to erase bootable sectors" however needs to be reproduced in the command-line first.
The insmod errors on the other hand... I'm not sure how to fix them... it's odd that openrc doesn't use modprobe instead. Modprobe wouldn't complain if they're alreaded loaded. In this case they're already loaded as builtin.
I wonder if this is what is happening
I think it's best to just avoid use of crypttab as well since it's just a disposable LUKS. Again better just create your own init.l script. You'll have full control over dependencies.
Oh he formatted it as swap: use wipefs -a /dev/path/to/swap/partition
I don't see i though. I think an update of what he's done so far needs to be given.
Unable to erase bootable sectors
You are right this is too confusing
I dont know if hes on file or partition now
It worked when I did it but then again I always use wipefs when changing a disk around, and I didn’t try to mkswap partition
And it was not a file, making it a file on btrfs has the chattr +C requirement, and it has to be on it’s own subvolume because any subvolume containing a swap file btrfs will refuse to snapshot