this post was submitted on 30 Apr 2024
223 points (97.9% liked)

linuxmemes

21126 readers
1249 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack members of the community for any reason.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn. Even if you watch it on a Linux machine.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.

  • Please report posts and comments that break these rules!

    founded 1 year ago
    MODERATORS
     
    all 34 comments
    sorted by: hot top controversial new old
    [–] [email protected] 1 points 4 months ago

    saved to remembering btrfs snapshots

    [–] [email protected] 2 points 5 months ago

    Absolutely amazing. Been daily driving with Arch and its such a breeze to roll back in case of problems.

    [–] [email protected] 1 points 5 months ago

    Spent like a few hours learning about and setting up snapshots, only to never every use them lol. I guess I just don't break my computer often enough nowadays. Copy-on-write is great tho, especially for making quick backups of a large directory structure before running that risky shell one-liner.

    [–] [email protected] 2 points 6 months ago

    I just use snapshots for taking backups. This ensures that I get a consistent state when the backup occurs. It seems to work well for that.

    [–] [email protected] 6 points 6 months ago

    I don't now how to use them but have btrfs snapshots set up by default on SUSE nonetheless

    [–] [email protected] 1 points 6 months ago

    It's awesome! The easiest way you can try it out is with Linux Mint and BtrFS and TimeShift utility

    It's saved my ass quite a few times because for some reason on my old laptop updating the Nvidia driver from GUI would completely fuck the system

    [–] [email protected] 3 points 6 months ago

    I've been using snapshots for a couple of years. So far I've only had to restore a snapshot once, but it and it worked fine. The snapshots are created almost instantly and they don't use much disk space unless a lot of stuff has been changed.

    [–] [email protected] 2 points 6 months ago* (last edited 6 months ago)

    Missed previous highway exit:

    Use Debian stable / Ubuntu LTS

    [–] [email protected] 0 points 6 months ago

    I upgraded 3 major versions of Devuan with a snapshot between each upgrade, and I have a script running doing hourly/daily/weekly snapshots.

    The only hassle was updating grub to boot on the new snapshot, while still being able to boot the old, I had to dig up a boot USB when I messed it up.

    [–] [email protected] 2 points 6 months ago (1 children)

    I want to setup snapshots but I don’t really understand how to do that properly yet in a way that lets me shoot the snapshots over to my smb storage like Apple’s Time Machine does.

    [–] [email protected] 2 points 6 months ago (1 children)

    A snapshot isn't a backup so you can't move it outside of the drive. It is literally just a change log.

    [–] [email protected] 1 points 5 months ago (1 children)

    | A snapshot isn’t a backup so you can’t move it outside of the drive

    You can tho https://wiki.archlinux.org/title/Btrfs#Send/receive

    [–] [email protected] 2 points 5 months ago
    [–] [email protected] 32 points 6 months ago

    Me:

    1. make the snapshot after the system is already broken
    2. Break it more
    3. Don't restore the snapshot because its old and you can fix it
    [–] [email protected] 4 points 6 months ago

    Snapshots are definitely a hit or miss with me. I nearly never use them, but when I need to recover a file it's awesome. The only system related problem I had with Nvidia drivers but it was actually better to reinstall so it does all the install configuration itself

    Although the most problems I had with it is backup of data. I tend to hoard too much

    [–] [email protected] 3 points 6 months ago (1 children)

    Too confusing, why can I create them with one command but not restore them in the same way? Last time I was gonna use them to fix an issue I spent an hour trying to figure out how to restore it and then just ended up fixing the issue manually in much less time.

    [–] [email protected] 6 points 6 months ago

    Why dont you just use timeshift ?

    [–] [email protected] 2 points 6 months ago
    [–] [email protected] 8 points 6 months ago

    The FS feature is great, it's just cumbersome to use without a tool.

    Snapper works well for a local backup like history both against botched updates and accidental deletion, but eats up the free space with the default settings.

    Timeshift is an easy to use GUI but doesn't support non-default partitions.

    Also the quota support had a nasty side effect: freezing the whole system on snapshot deletion.

    [–] [email protected] 2 points 6 months ago (1 children)

    If you use btrfs snapshots and systemd-boot instead of grub, then be carefull restoring updates from before a kernel update.

    If I understand it correctly, with systemd-boot the kernel lives in the EFI partition, while the kernel modules live in the main (btrfs) partition. If you restore a snapshot with a different kernel version, it doesn't restore the kernel itself, but the kernel modules have different filenames, which stops the system from being able to boot.

    At least that is my understanding of the problem, from having to debug it twice (just start a live-boot system and use Timeshift to restore the system to after the update again). The next time I install Linux, I think I'll go with grub instead of systemd-boot.

    That being said, I really like btrfs snapshots as a sort of "almost backup" (still do regular backups on an external drive). They are quick and easy, and most packet managers can be setup to automatically make a snapshot before installing/updating stuff.

    [–] [email protected] 3 points 6 months ago (1 children)

    The kernel in the EFI partition is used as a tool to bootstrap hardware and memory for your proper kernel, which is chainloaded.

    There is a simple reason for that: The Linux kernel can do anything a bootloader needs to do, especially for itself, so why not use it as one?

    That said, in most setups there is another bootloader before that, which loads the kernel itself and the initramfs for that kernel. That can be for example systemd-boot, formerly known gummiboot, a minimal bootloader meant to (auto-)discover EFI compatible stuff it can load.

    Dracut creates a setup / boot chain like that.

    [–] [email protected] 2 points 6 months ago (2 children)

    Thanks for explaining it! So systemd-boot finds the kernel in the EFI partition, which it then loads, and then that kernel loads another kernel from the main partition, which is then the full OS.

    Is there a reason it's done this way, and not just the bootloader loads the main kernel?

    Also, are the two kernels the same, or does this use two different kernels?

    [–] [email protected] 2 points 5 months ago (1 children)

    Sorry for the late reply btw, responses were broken for me

    [–] [email protected] 1 points 5 months ago

    No problem, thanks for replying.

    [–] [email protected] 2 points 5 months ago* (last edited 5 months ago) (1 children)

    In the case of Dracut, I'm not sure what it does exactly, but the kernels will almost definitely not be identical. In the "EFI kernel", uneeded modules (meaning most of them) are usually omitted.

    You could probably also have different kernels in terms of version number, although it might complicate things. Kinda depends on whether they recycle data structures from the first kernel and whether those remain compatible. I don't really know whether this is actually done tho.

    The reason why multiple kernels (or bootloaders for that matter) are used is that there are different levels of "readiness" in your system. Say you have LVM and a LUKS encrypted partition (in whatever order). Systemctl-boot will load the kernel and it's initramfs, but can't be bothered to deal with complicated file system shenanigans. That would complicate the whole program significantly.

    So it just loads a Linux kernel which has these capabilities. That kernel can deal with LVM, decrypt the LUKS partition (or ask for a password), mount whatever btrfs nonsense is inside and then hand it over to the proper kernel. The proper kernel can in turn rely on having all its stuff mounted and ready, instead of having to worry about all this.

    You could do with just one kernel, but Dracut allows you to rapidly create bootable kernel + initramfs pairs of which you might need multiple (e.g. for dual booting, backup). Moreover, you probably wouldn't really want it to fiddle with your kernel all the time, especially when it's customised already.

    [–] [email protected] 1 points 5 months ago

    That makes sense. It looks like a really clever way of letting the boot process allow for basically any arangement. Thanks!

    [–] [email protected] 5 points 6 months ago

    Very good. Saved me a couple of times. It's a really hassle free way of preventing update fuckery

    [–] [email protected] 5 points 6 months ago

    They're set up in Nobara by default, haven't had to use them yet but every once in a while I see them in the journalctl and get a warm feeling.

    [–] [email protected] 7 points 6 months ago

    But It's just a corrupt driver dude, I know I can fix it.

    [–] [email protected] 40 points 6 months ago (1 children)

    They are set up automatically on OpenSUSE and make a new snapshot before and after every program installation, update and removal. Awesome for general peace of mind and especially when you're up to strange shenanigans.

    [–] [email protected] 21 points 6 months ago* (last edited 6 months ago)

    Also, for people on distros that don't have an OOTB solution like OpenSUSE have, I recommend snapper and btrfs-assistant. You just install both packages, open the assistant GUI and create a profile for your root partition.

    You can then also install a snapper plugin for your package manager, if one exists (I know DNF and pacman have one), which automatically take pre/post snapshots like OpenSUSE does, so you can quickly roll back if something goes wrong after a particular update/install/removal.

    I've been using the above with EndeavourOS for a year now and it's come in very handy on a couple of occasions.

    [–] [email protected] 12 points 6 months ago

    Been using it on a fedora workstation and a Debian server for 2 years and it has been stable and amazing for backups and regressions. So fast and easy to use. I use timeshift to handle organizing and scheduled backups.

    FWIW, I set up these distros to separate my home directory from the OS, so backups aren't clogged with random files in my /home directory. I use Pika Backup to handle the /home directories to a separate backup site.

    It's basically automated, reliable, and sooo fast. Love it.

    [–] [email protected] 6 points 6 months ago

    Used them to debug a problem. Forgot to remove them. Wondered why I ran out of disk space a few weeks later.