turning OFF encryption for my backup edge case #166
Replies: 17 comments 17 replies
-
I think you've got it.
LMK if you run into anything that sdm can help with. For instance, would it be helpful for you if sdm saved pre-crypt cmdline.txt and fstab? |
Beta Was this translation helpful? Give feedback.
-
what about |
Beta Was this translation helpful? Give feedback.
-
That file is part of the package cryptsetup-initramfs. On my system it looks like it has no useful content in it (everything commented out). Is that the case on your system as well? If so, you can ignore it, since it does nothing. If yours has uncommented content, please post it. |
Beta Was this translation helpful? Give feedback.
-
Also commented here, thanks. I hadn't noticed there were no live lines at all. |
Beta Was this translation helpful? Give feedback.
-
I think this is all I need to do to the image before burning it back. It seems to do what I want on some test files taken from a system encrypted by sdm-cryptconfig. (See below, encrypted and non-encrypted versions)
Also, what about the "rw" in cmdline.txt?
|
Beta Was this translation helpful? Give feedback.
-
New version, also removing "rw":
Just the cmdline.txt, before and after:
|
Beta Was this translation helpful? Give feedback.
-
I had been figuring that I would run this encryptoff script as a fix on the unecncrypted-but-configured-for-encryption backup image, vis sdm --explore, because how could I change them on the actually encrypted live system without messing that up? Now, I wonder if I could run it on the live encrypted system just before backing it up? Then the backup would be ready to burn, and I could un-un-encrypt it (!) via a mirror-image script called encrypton? This would work if all of these config files are really just used at boot, and are just sitting there while running, and therefore could be changed, and changed back, on the live system, without consequence? |
Beta Was this translation helpful? Give feedback.
-
I've finished making a test system for encryption on an sd card (my live pi5 is on an ssd). |
Beta Was this translation helpful? Give feedback.
-
I have my backup image available on a network drive. I run sudo sdm --explore . I intend to run my encryptoff script, pointing it to /etc/fstab, /boot/firmware/cmdline.txt and /etc/crypttab. But there's nothing at /boot/firmware. No files at all. What am I doing? The cmdline.txt file at just /boot is the new "what you want is not here" model, not the previous link, so that doesn't help. |
Beta Was this translation helpful? Give feedback.
-
Curious. What do you get from this?
And then type 'exit' to leave the mount command |
Beta Was this translation helpful? Give feedback.
-
I assume you DIDN'T mean /boot, but did mean just boot, which off the current directory of /mnt/sdm yields /mnt/sdm/boot?
|
Beta Was this translation helpful? Give feedback.
-
I'm very puzzled. I also tried to mount the boot partition from the backup image using RonR's image-mount, and I get nada, nothing at all. Not even what I saw using your --mount command. Does this mean the image is bad? Which could certainly be true, given my hacking on the image-backup software... |
Beta Was this translation helpful? Give feedback.
-
Well. I'm puzzled, and I'm pleased. I tried debugging the backup process a little more, but I couldn't see anything wrong (I'm not the best at debugging other people's code). Despite earlier problems seeing boot or boot/firmware on the backed up image, I just said WTH and burned it to a usb-stick using imager, plugged it into a handy pi4 and it booted, though I got an error, as expected, because though it's actually unecncrypted it was still configured for encryption. Shut it down, plugged it into my pi desktop machine, both bootfs and rootfs automounted off /media/pi, thus giving me access to fstab, cmdline.txt, and crypttab. I pointed my encryptoff script at those locations, it ran and did its thing. Shut down, slugged it back into the pi4, and it booted fully, though with a few complaints, and I'm writing this from that machine. I took some screenshots as it was booting, so I'll go back and see what it was complaining about. But getting a desktop and networking and a browser going seems like it must be close to good. |
Beta Was this translation helpful? Give feedback.
-
Sounds like great progress! Your proof of concept works, now you just need to codify it so you can check the box and life is good 😎 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I'm very glad that I've got some end-to-end way to use my customary backup and restore tools on an encrypted rootfs - even though it's still a little twisty itself. I need to be able to restore my now-encrypted pi5 desktop machine, where lots of things change all the time, in case the media fries out or if I otherwise lose it. Namely, I can encrypt an existing pi using sdm-cryptconfig, continue doing incremental backups to an unencrypted existing backup image using a (slightly) hacked image-backup script, burn the backup image to a device, mount it on a running pi, run my encryptoff script to make the franken-thing think it's not encrypted and at least runnable, and then I can boot it. If I need to re-encrypt the result, back to sdm-cryptconfig, and Voila! I'm back in business. Thank you for your help and review while I figured this out, even though it was never sdm's issue at all, just follow-on stuff after sdm did its encrypting completely correctly. I am tired enough at the moment that I'll hold off on implementing your latest suggestions for a completely clean encryption-removal solution. What I've got at least works, and it only seems to add a 20 second or so wait during the boot. To be clear, this is a different workflow than creating or re-creating initial images, or knocking out single-purpose machines, where sdm itself is my preferred solution. And most of my pi's WON'T be encrypted, so the whole create/backup/restore process there is as simple as always. |
Beta Was this translation helpful? Give feedback.
-
Excellent!
Absolutely! Glad to help.
👍 |
Beta Was this translation helpful? Give feedback.
-
I'm an enthusiastic user of both your sdm (for creating/burning/encrypting images) and RonR's image-backup (part of Image File Utilities - see here) (for creating and incrementally updating backup images). The images created by image-backup are normal images suitable for being burned by Raspberry Pi Imager.
My desired workflow is:
My problem is that neither image-backup nor Imager currently have support for encrypted rootfs. I have worked on some hacks to image-backup to allow it to back up the files from an encrypted rootfs and write them (unencrypted) to a normal pi image. So far so good, a step on the way.
BUT, If I were to restore such images, even if they burned correctly, the software or settings are appropriate for the previously encrypted roots, while the re-burned files and rootfs are NOT encrypted.
My initial desire is just for enough knowledge to go into the backed up image and fiddle it's configuration so as to TURN OFF that expectation of encryption, so when I burn the image the system is functional, though un-encrypted. Then, if desired, I can use sdm-cryptconfig to actually re-encrypt the rootfs and files. Not optimal, but it's a start (Until everyone fully supports encrypted rootfs.)
In glancing through sdm-cryptconfig, I see the following things getting set for encryption:
I imagine (perhaps optimistically), that I just have to reverse these changes to accomplish what I want. What am I missing?
Beta Was this translation helpful? Give feedback.
All reactions