Score:0

Ooops, I deleted /etc but I do have a backup

in flag

On Debian 12, I somehow managed to delete most of /etc (using rclone sync, still have to figure out what went wrong).

I can no longer run sudo or su as root, which complicates things.

I do have a backup but as it was made using rclone sync to a pCloudDrive, owner, group and permissions are missing. I know realise I should probably better create a tar of /etc before copying it to pCloud but that is too late.

I can no longer run sudo or su as root, which complicates things.

Is there anything I can try before booting a livecd and try restoring files and setting the owner-group-permissions by hand (tedious) ?

Cheers.

jp flag
Not an answer, but if you had [`etckeeper`](https://etckeeper.branchable.com/README/) installed, the recovery would have been easier. Maybe try it for the future.
HBruijn avatar
in flag
As the answer below suggests, you should be able to log in from the console as root. Then copy the `/etc/*` files and directories back and follow a recipe that uses the fact that packages contain the default permissions of the files they provide. Either extract those permissions and re-apply or reinstall all packages as for example explained here: https://www.matoski.com/article/debian-restore-var-ownership-permissions/
ballatom avatar
in flag
@Esa Jokinen : great idea. Just had a look at the presentation page and though I know have a script that works, it is even better to use versioning as it provides even more control than the 'rewind' feature of pCloud.
ballatom avatar
in flag
@HBruijn Thanks, your suggestion was part of the solution.
Score:1
cn flag

If the system boots from grub then you should be able to edit the kernel boot parameters in the boot process. The kernel line will look something like:

linux /boot/vmlinuz-5.14.21-150400.24.74-default root=UUID=a19111c9-5087-4821-9922-0f367e993b72 splash=silent preempt=full mitigations=auto quiet security=apparmor

Change it to:

linux /boot/vmlinuz-5.14.21-150400.24.74-default rw init=/bin/bash

This will give you a shell within the initrd image. From there you may be able to mount and rescue your system

ballatom avatar
in flag
Thanks for the idea. I did manage to get to the grub command line but somehow did not manage to get your trick to work for me. It inspired me and I used the cmd shell of a gParted live cd to do the job.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.