How to Install Fedora 36 with Snapper and Grub-Btrfs

Поделиться
HTML-код
  • Опубликовано: 14 окт 2024

Комментарии • 54

  • @SysGuides
    @SysGuides  2 года назад +2

    Some updates:
    *Update 1:* Because snapshot booting is now enabled, you must make modifications to the /𝚋𝚘𝚘𝚝/𝚎𝚏𝚒/𝙴𝙵𝙸/𝚏𝚎𝚍𝚘𝚛𝚊/𝚐𝚛𝚞𝚋.𝚌𝚏𝚐 file as well. Add 𝚜𝚎𝚝 𝚋𝚝𝚛𝚏𝚜_𝚛𝚎𝚕𝚊𝚝𝚒𝚟𝚎_𝚙𝚊𝚝𝚑="𝚢𝚎𝚜" to the file at the beginning.
    𝚜𝚎𝚍 -𝚒 '𝟷𝚒 𝚜𝚎𝚝 𝚋𝚝𝚛𝚏𝚜_𝚛𝚎𝚕𝚊𝚝𝚒𝚟𝚎_𝚙𝚊𝚝𝚑="𝚢𝚎𝚜"' /𝚋𝚘𝚘𝚝/𝚎𝚏𝚒/𝙴𝙵𝙸/𝚏𝚎𝚍𝚘𝚛𝚊/𝚐𝚛𝚞𝚋.𝚌𝚏𝚐
    *Update 2:* As the author has updated the grub-btrfs package, use the following command instead to enable the grub-btrfs service.
    𝚜𝚢𝚜𝚝𝚎𝚖𝚌𝚝𝚕 𝚎𝚗𝚊𝚋𝚕𝚎 --𝚗𝚘𝚠 𝚐𝚛𝚞𝚋-𝚋𝚝𝚛𝚏𝚜𝚍
    *Update 3:* After a successful rollback, always ensure that the grub.cfg file is updated so that the snapshots on the grub-btrfs menu are always in sync.
    𝚐𝚛𝚞𝚋𝟸-𝚖𝚔𝚌𝚘𝚗𝚏𝚒𝚐 -𝚘 /𝚋𝚘𝚘𝚝/𝚐𝚛𝚞𝚋𝟸/𝚐𝚛𝚞𝚋.𝚌𝚏𝚐

  • @runatrix
    @runatrix 2 года назад +3

    I had to came back to this video to say thank you! This saved me from a recent update that broke a few things for me in Fedora, in that case the undochanges didn't work, but the book from snapshot + rollback + reboot worked. Amazing tutorial.

  • @garvinphillips3551
    @garvinphillips3551 2 года назад +2

    Thank you for the updated video, I've recently started getting into fedora, and since my friend who would usually help me is currently out of town, I was stuck because I had to reinstall fedora. Thank you for the video. :)
    (I also decided to subscribe)

    • @SysGuides
      @SysGuides  2 года назад +1

      Glad I could help! And thanks for subscribing. 😊

  • @Keelvin321
    @Keelvin321 2 года назад

    Really helpful video thank you!! But wasn't it supposed to create the swap partition too?

    • @SysGuides
      @SysGuides  2 года назад +1

      Hi Kelvin Matheus, there is no need for a separate swap partition because Fedora creates a swap on ZRAM at startup. To view the swap details, use the '𝚜𝚠𝚊𝚙𝚘𝚗 -𝚟' command. Also, thanks for subscribing. 😊

    • @Keelvin321
      @Keelvin321 2 года назад +1

      @@SysGuides I didn't know this, that's great, thanks again.

  • @raflisugiarto9534
    @raflisugiarto9534 2 года назад +1

    Thanks, what is /usr-local directory used for?

    • @SysGuides
      @SysGuides  2 года назад +1

      Hi, Rafli Sugiarto. It is just a subvolume for the /usr/local directory. Because Fedora's Anaconda installer won't let you create a subvolume with a name like 'usr/local' when installing, you have to name it as 'usr-local'. It is a common practice. So, '/usr-local' is same as '/usr/local' but is only displayed in two places.
      Even if this won't affect the operating system anyway, if you want to do things right, take the following actions.
      # 𝚌𝚙 -𝚊𝚛𝚟 /𝚞𝚜𝚛/𝚕𝚘𝚌𝚊𝚕/ /𝚞𝚜𝚛/𝚕𝚘𝚌𝚊𝚕-𝚘𝚕𝚍
      # 𝚞𝚖𝚘𝚞𝚗𝚝 /𝚞𝚜𝚛/𝚕𝚘𝚌𝚊𝚕
      # 𝚋𝚝𝚛𝚏𝚜 𝚜𝚞𝚋𝚟𝚘𝚕𝚞𝚖𝚎 𝚍𝚎𝚕𝚎𝚝𝚎 /𝚞𝚜𝚛-𝚕𝚘𝚌𝚊𝚕
      # 𝚛𝚖𝚍𝚒𝚛 /𝚞𝚜𝚛/𝚕𝚘𝚌𝚊𝚕
      # 𝚋𝚝𝚛𝚏𝚜 𝚜𝚞𝚋𝚟𝚘𝚕𝚞𝚖𝚎 𝚌𝚛𝚎𝚊𝚝𝚎 /𝚞𝚜𝚛/𝚕𝚘𝚌𝚊𝚕
      # 𝚌𝚙 -𝚊𝚛𝚟 /𝚞𝚜𝚛/𝚕𝚘𝚌𝚊𝚕-𝚘𝚕𝚍/ /𝚞𝚜𝚛/𝚕𝚘𝚌𝚊𝚕/
      # 𝚛𝚎𝚜𝚝𝚘𝚛𝚎𝚌𝚘𝚗 -𝚁𝙵𝚟 /𝚞𝚜𝚛/𝚕𝚘𝚌𝚊𝚕/
      Update subvolume name '𝚜𝚞𝚋𝚟𝚘𝚕=𝚞𝚜𝚛-𝚕𝚘𝚌𝚊𝚕' with '𝚜𝚞𝚋𝚟𝚘𝚕=𝚞𝚜𝚛/𝚕𝚘𝚌𝚊𝚕' in /etc/fstab.
      # 𝚛𝚎𝚋𝚘𝚘𝚝
      If everything went well (it should), then delete the /usr/local-old directory. Let me know how it worked out for you.

  • @dannymaupin5498
    @dannymaupin5498 2 года назад

    Hey! Followed your older guide on Feodra 35 and just saw this and decided to give it a go (only a recent install so nothing drastic to redo).
    I know very little about btrfs, what was the change to fedora 36 that necessitated this new format. I also saw the addition of tmp and opt...were those still part of the system on your first guide but mow have been pulled out to avoid being in snapshots?

    • @SysGuides
      @SysGuides  2 года назад +2

      The most significant change in Fedora 36 is the move of the RPM database from /var to /usr, enabling snapshot and rollback regime similar to OpenSUSE. Earlier, because the RPM database was in /var, you were compelled to keep it as part of the root files system, or else the system would fail when you rolled it back.
      The second significant adjustment I made was to make the 'root file system' a main volume rather than a separate subvolume, like OpenSUSE does. This makes root file system snapshot rollbacks considerably easier and error-free.
      Lastly, third-party and manually installed packages are kept in /var and /usr/local, respectively. You might not want them to be disturbed when the snapshots are rolled back. It is not necessary to create a separate subvolume for each of them; it is only a design choice. As with the /tmp directory, it contains temporary files that are not necessary when taking a snapshot.
      Check out my blog article for a thorough explanation.
      sysguides.com/install-fedora-36-with-snapper-and-grub-btrfs

  • @christoph1998
    @christoph1998 2 года назад +1

    Wow, thank you very much, that was very thorough!

    • @SysGuides
      @SysGuides  2 года назад

      You're very welcome! 😊

  • @ВладимирЭмирян-т3о

    That's amazing guide, thank you. But can I hide grub by default, when my system booting, and open it, only when I want it?

    • @SysGuides
      @SysGuides  Год назад

      Yes you can! Just run the following command:
      𝚜𝚞𝚍𝚘 𝚐𝚛𝚞𝚋𝟸-𝚎𝚍𝚒𝚝𝚎𝚗𝚟 - 𝚜𝚎𝚝 𝚖𝚎𝚗𝚞_𝚊𝚞𝚝𝚘_𝚑𝚒𝚍𝚎=𝟷
      Then, verify that the setting is enabled.
      𝚜𝚞𝚍𝚘 𝚐𝚛𝚞𝚋𝟸-𝚎𝚍𝚒𝚝𝚎𝚗𝚟 - 𝚕𝚒𝚜𝚝
      You should get 𝚖𝚎𝚗𝚞_𝚊𝚞𝚝𝚘_𝚑𝚒𝚍𝚎=𝟷 as output. Now reboot. The GRUB menu will be hidden. To show GRUB menu, just press ESC button during boot.

    • @SysGuides
      @SysGuides  Год назад

      I'm uploading an updated video for Fedora 37 Workstation. It will be available within an hour or so. You should watch this, too.

    • @ВладимирЭмирян-т3о
      @ВладимирЭмирян-т3о Год назад

      @@SysGuides That's great! Thank you! The only thing I see when booting is an error, and as I understand it, this is due to the fact that I did not create a boot partition during installation. I will reinstall, and share my experience

  • @heshamkhalil2215
    @heshamkhalil2215 2 года назад

    thanks your video is really good . your btrfs layout very similar to opensuse btrfs layout( and thats a good thing ). but what are the pros of mounting the main subvolume on / and not creating root subvolume mounted on / (why you made this decision ) and is there any consequences to consider on not creating root subvolume .

    • @SysGuides
      @SysGuides  2 года назад +2

      Hello, Hesham Kalil. If you look at all the ideas of adopting btrfs as the primary filesystem for the operating system, as well as developing snapper for snapshot creation and rollbacks, they are essential ideas of OpenSUSE Linux. OpenSUSE started using btrfs as their primary filesystem a long time ago when no other distribution were interested.
      Although Fedora has embraced btrfs as their primary filesystem, they are wary of making substantial changes to how Fedora operates. If you look at the previous versions of Fedora Linux, there was a root partition that was mounted on /, and there was another home partition that was mounted on /home. Fedora is just recreating that setup in btrfs also so that, I believe, they do not want disrupt the system for long-term users and scare them away. If you follow the Fedora mailing list, you will see that they are progressively heading toward a system similar to OpenSUSE Linux.
      So, if you want to fully adopt btrfs as your operating system's main filesystem and use snapshots and rollback features, why not set it up like OpenSUSE Linux instead of waiting for Fedora to make it all perfect for us?
      Regarding the 'root' subvolume, why make it a subvolume when you can mount it straight at / rather than making it a subvolume and then mounting it at /? The advantage of mounting it at '/' is that GRUB will always see it. When you make root a subvolume, the /.snapshots directory is often not visible to GRUB, causing the system to fail to boot.

    • @heshamkhalil2215
      @heshamkhalil2215 2 года назад

      @@SysGuides firstly i followed your guide and installed fedora with snapper and it was really less complicated then other toturials thanks man.
      you got me wrong abut opensuse layout argument ,i was saying it's good idea that it very similar to suse but i was cocerned about / on mainvolume (I'm not profissional in btrfs) because when i was using manjaro there was root subvolume and i searched in the internet about other distros btrfs layout. and found that there is always a root subvolume . so i was concerned that i need to reinstall fedora again with different btrfs layout or installing other distro .

    • @SysGuides
      @SysGuides  2 года назад +1

      @@heshamkhalil2215 I believe you can configure it in a variety of ways. If you've watched my prior video on installing Fedora 35 with Snapper, you'll see that I also used the similar configuration (root and home). That configuration works just fine if you don't use grub-btrfs. However, if you want to use grub-btrfs and boot snapshots from the GRUB menu, I often found that /.snapshots and /boot are not mounted or are just empty.

    • @jumeisa8423
      @jumeisa8423 2 года назад

      @@SysGuides Opensuse doesn't directly mount btrfs top level volume as /, it rather creates a subvol named @ as the /. Further, it automatically takes a snapshot of the initial installation and mount the snapshot (./snapshots/1/snapshot) as / instead.

    • @SysGuides
      @SysGuides  2 года назад

      @@jumeisa8423 Hello, Jumei Sa. OpenSuse's file tree starts with the @ subvolume, whereas mine starts with the main volume itself. In OpenSuse, the / filesystem is mounted (actually it is set as default) at '@/.snapshots/1/snapshot', whereas I have set it to open. You can compare the /etc/fstab files on both systems. If you want, you can do the same thing here as well. Simply create a 'single' snapshot, make it the default, and reboot.
      $ 𝚜𝚗𝚊𝚙𝚙𝚎𝚛 -𝚌 𝚛𝚘𝚘𝚝 𝚌𝚛𝚎𝚊𝚝𝚎 -𝚍 '𝚏𝚒𝚛𝚜𝚝 𝚛𝚘𝚘𝚝 𝚏𝚒𝚕𝚎𝚜𝚢𝚜𝚝𝚎𝚖'
      $ 𝚜𝚞𝚍𝚘 𝚋𝚝𝚛𝚏𝚜 𝚜𝚞𝚋𝚟𝚘𝚕𝚞𝚖𝚎 𝚕𝚒𝚜𝚝 -𝚜 /
      𝙸𝙳 𝟸𝟼𝟹 𝚐𝚎𝚗 𝟸𝟸𝟸 𝚌𝚐𝚎𝚗 𝟸𝟸𝟸 𝚝𝚘𝚙 𝚕𝚎𝚟𝚎𝚕 𝟸𝟼𝟷 𝚘𝚝𝚒𝚖𝚎 𝟸𝟶𝟸𝟸-𝟶𝟾-𝟸𝟹 𝟷𝟸:𝟷𝟾:𝟶𝟿 𝚙𝚊𝚝𝚑 𝚜𝚗𝚊𝚙𝚜𝚑𝚘𝚝𝚜/𝟷/𝚜𝚗𝚊𝚙𝚜𝚑𝚘𝚝
      $ 𝚜𝚞𝚍𝚘 𝚋𝚝𝚛𝚏𝚜 𝚙𝚛𝚘𝚙𝚎𝚛𝚝𝚢 𝚜𝚎𝚝 -𝚝𝚜 /𝚜𝚗𝚊𝚙𝚜𝚑𝚘𝚝𝚜/𝟷/𝚜𝚗𝚊𝚙𝚜𝚑𝚘𝚝 𝚛𝚘 𝚏𝚊𝚕𝚜𝚎
      $ 𝚜𝚞𝚍𝚘 𝚋𝚝𝚛𝚏𝚜 𝚜𝚞𝚋𝚟𝚘𝚕𝚞𝚖𝚎 𝚜𝚎𝚝-𝚍𝚎𝚏𝚊𝚞𝚕𝚝 𝟸𝟼𝟹 /
      $ 𝚜𝚞𝚍𝚘 𝚋𝚝𝚛𝚏𝚜 𝚜𝚞𝚋𝚟𝚘𝚕𝚞𝚖𝚎 𝚐𝚎𝚝-𝚍𝚎𝚏𝚊𝚞𝚕𝚝 /
      𝙸𝙳 𝟸𝟼𝟹 𝚐𝚎𝚗 𝟸𝟸𝟸 𝚝𝚘𝚙 𝚕𝚎𝚟𝚎𝚕 𝟸𝟼𝟷 𝚙𝚊𝚝𝚑 𝚜𝚗𝚊𝚙𝚜𝚑𝚘𝚝𝚜/𝟷/𝚜𝚗𝚊𝚙𝚜𝚑𝚘𝚝
      The only advantage I see is that when you rollback from a readonly snapshot, you only need to type '𝚜𝚗𝚊𝚙𝚙𝚎𝚛 𝚛𝚘𝚕𝚕𝚋𝚊𝚌𝚔' instead of '𝚜𝚗𝚊𝚙𝚙𝚎𝚛 --𝚊𝚖𝚋𝚒𝚝 𝚌𝚕𝚊𝚜𝚜𝚒𝚌 𝚛𝚘𝚕𝚕𝚋𝚊𝚌𝚔 '.

  • @Alucard-md
    @Alucard-md 2 года назад

    I have 2 separate partitions of root and home they have 2 subvolumes root and home but tune shift is not working any way to take back up

    • @SysGuides
      @SysGuides  2 года назад +1

      Why two separate partitions for root and home? Is there a particular reason you chose this layout? Subvolumes is one of Btrfs' unique features. Subvolumes are a good way to separate your data into logical sections. Each subvolume will have its own file tree, POSIX namespace, and pool of inodes, just like a file system.

  • @ajayjadhav8670
    @ajayjadhav8670 2 года назад

    Thanks for the tutorial. Need some guidance on an issue I am facing now.
    After setting this up and other software install, when I reboot - grub is throwing these errors "error:/../../grub-core.script/lexer.c:352:syntax error"
    And I tried your steps to rollback, but again the same. I am able to choose older snapshots and boot from there, but cannot update grub or get around this error. Shouldn't a rollback fix the grub issue as well? Pls. advise.

    • @SysGuides
      @SysGuides  2 года назад

      Hi Ajay. Run the command "grub2-mkconfig -o /boot/grub2/grub.cfg" and try rollback again.
      Although the package grub-btrfs updates the 'grub snapshots menu' every time you make a new snapshot, it does not however update the 'grub snapshots menu' when you rollback. So, after each rollback, make it a practice to update grub.cfg once so that the 'grub snapshots menu' is up to date.

    • @ajayjadhav8670
      @ajayjadhav8670 2 года назад

      @@SysGuides Thanks for the reply. The problem I ran into after the rollback is I am not able to boot into the new rolled back snapshot. Same error.
      And the older snapshot that I manage to boot into is always read only. Am I missing a step where I could run the "grub2-mkconfig" in a read write mode for the new snapshot?

    • @SysGuides
      @SysGuides  2 года назад +1

      @@ajayjadhav8670 Hi Ajay. When you boot from grub-btrfs menu, snapshots are always read-only. If you want to rollback to snapshot #2, for example, you first boot into snapshot #2 from the btrfs-grub menu in read-only mode, and then you rollback to the same snapshot #2 using the snapper --ambit rollback command. After successfully booting into the read-write mode of snapshot #2, execute the command "grub2-mkconfig -o /boot/grub2/grub.cfg".
      Anyways, what you can do now is boot into any snapshot (or rollback) in read-write mode. Run the command "snapper ls" to get a list of all snapshots. Then execute the grub2-mkconfg command. Whatever snapshots are shown in the "snapper ls" command should now be available in the grub-btrfs menu and working.

    • @SysGuides
      @SysGuides  2 года назад

      @@ajayjadhav8670 Forgot to mention, not sure whether you know it or not, if you want to rollback to a particular snapshot, you can do it directly from the command prompt. Only use grub-btrfs snapshots menu, when you cannot boot normally. And of course run grub2-mkconfig command after the rollback to keep the grub-btrfs menus in sync with the snapshots.

    • @ajayjadhav8670
      @ajayjadhav8670 2 года назад

      @@SysGuides Thank you very much. I will try that out.

  • @HomeschoolHousewife
    @HomeschoolHousewife 2 года назад

    Have you found a way to do this with full disk encryption yet, specifically for Fedora 36?

    • @SysGuides
      @SysGuides  2 года назад

      Yes. I published an article yesterday about how to install Fedora 36 with full disk encryption. I'm currently recording a video and will upload it within the next 24 hours. You can find the article here: sysguides.com/fedora-36-with-luks-full-disk-encryption/

  • @fortedexe8273
    @fortedexe8273 2 года назад

    Really detail, thank you

    • @SysGuides
      @SysGuides  2 года назад

      Glad it was helpful!

  • @Nyancat703
    @Nyancat703 2 года назад

    **edit** After the third try, it worked. I tried to reproduce the bug on a vm but I couldn't, I have no idea where the errors come from.
    Please note that there might be some grub-errors if you don't create a separate /boot/ partition. The error will go away when going trough with the tutorial !
    Thank you so much for this awesome guide !
    I followed your guide but after rebooting after having added the suse btrfs booting in /etc/default/grub system would boot in emergency mode, the journalctl hangup being "initrd switcheroot service result exit code".
    Do you know why this happened or how to fix it ?
    Also, in your guide you forgot to mention that you have to add the root subvolume, else the installer hangs.

    • @SysGuides
      @SysGuides  2 года назад +1

      Nyancat703, I'm sorry for what happened to you. There is no need to create a separate 'root' subvolume for the root (/) file system. In my case, the root (/) file system is mounted in the main BTRFS volume, no subvolume. And I've configured Snapper to take snapshots of the root (/) file system so that it is always visible to the GRUB when rolling back snapshots. The remaining folders, such as /home, /var, and so on, are created as subvolumes in order to be excluded from the root (/) file system snapshot.
      Regarding the suse btrfs booting, maybe there's a typo, I don't know. Please look at my article so that you can copy and paste commands without mistakes.
      You can read the article here: sysguides.com/install-fedora-36-with-snapper-and-grub-btrfs/

    • @Nyancat703
      @Nyancat703 2 года назад

      @@SysGuides Hello again, I got everything to work, I don't know where the error came from since I couldn't reproduce it.
      Thank you for the guide and your replies !

    • @Nyancat703
      @Nyancat703 2 года назад

      @@SysGuides Would you mind explaining further what this means
      "Then you must create a new snapper configuration for the Btrfs volume at ‘/‘. Because you previously created a snapshots subvolume with ID=5 in the /.snapshots directory during Fedora installation, attempting to create a new snapper configuration for ‘/‘ now will result in an error. To work around this issue, make the following adjustments before creating a new snapper configuration for the ‘/‘." ?

    • @SysGuides
      @SysGuides  2 года назад

      @@Nyancat703 I'm glad things worked out for you.

    • @SysGuides
      @SysGuides  2 года назад

      @@Nyancat703 Because I knew I'd be installing and configuring the snapper package, I created the 'snapshots' subvolume (with /.snapshots directory as its mount point) during the Fedora Linux installation, as it will be created with an ID=5 (top level). I can do the same thing after the installation, however it takes some needless extra steps.
      It gets trickier when it comes to the /.snapshots directory. I hope you'll not get confused. When you try to create a new snapper configuration for the / file system, the snapper will create a /.snapshots directory along with the "nested" .snapshots subvolume. As there is already a /.snaphots directory, the snapper will throw the error and will not configure. So you delete /.snapshots directory. Then you can configure snapper. But now you have an extra .snapshots subvolume. You don't want that nested .snapshots subvolume, because you already have a "snapshots" subvolume. So, You'll delete the .snapshots subvolume. Along with that goes the /.snapshots directory too. So you create again a /.snapshots directory. The 'root' snapper config file, however, will remain. Then you'll reload /etc/fstab, this will link /.snapshots directory to "snapshots" subvolume with the snapper 'root' configuration file.
      I hope you don't have a head ache now, 😀.

  • @Good_BorisAV
    @Good_BorisAV 2 года назад

    _Thanks! Useful. Interesting video clip._ 🤔 👍 🇷🇺

    • @SysGuides
      @SysGuides  2 года назад

      Glad you liked it! 😊

  • @fabriziot1467
    @fabriziot1467 2 года назад

    Top contents 👍

  • @konstantink07
    @konstantink07 2 года назад

    I installed fedora without creating the subvolumes... any way to create the btrfs subvolumes after installation? Or will I need to reinstall?

    • @SysGuides
      @SysGuides  2 года назад +1

      I guess you can create new subvolumes and move files from their respective directories to subvolumes. I haven't tried, but I'm sure it will be painful. Reinstalling is the better solution in my opinion.

    • @konstantink07
      @konstantink07 2 года назад

      @@SysGuides so, how should I take a backup? I want to save as much as possible

    • @SysGuides
      @SysGuides  2 года назад

      @@konstantink07 If you installed Fedora using the default settings, / will be created in the root subvolume. If that's the case, I'm afraid you're out of options. In my case, I installed / on the btrfs main volume rather than a subvolume.
      You should test this in a virtual machine before attempting it on your actual system. For example, if you want to create a new /var subvolume, rename the current /var as /var-old, then create a new var subvolume with ID=5 and mount point /var. Then, recursively copy all files from /var-old to /var. Restore SeLinux labels and update /etc/fstab. Again, I'm not sure whether this would work, but you may test it in a virtual machine first.

    • @CesarPeron
      @CesarPeron 2 года назад

      @@konstantink07 Timeshift is the answer

  • @CesarPeron
    @CesarPeron 2 года назад

    Splendid 🫂
    Could you make the same video but for Arch? 🙏🙏🙏

    • @SysGuides
      @SysGuides  2 года назад

      Thanks. Regarding installation on Arch, I will certainly give it a shot. I'll be out of town this weekend. I'll surely do a video about arch Linux next week when I do some thorough testing.

    • @CesarPeron
      @CesarPeron 2 года назад +1

      ​@@SysGuides It would be excellent, in my case I use Timeshift, but Snapper has its virtues with which it would not matter, I appreciate it