Manjaro linux установка btrfs

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Script collection to set up Manjaro with btrfs, and easy rollback.

License

hrotkogabor/manjaro-btrfs

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Btrfs snapshots with snapper, with easy rollback

These scripts can be used to automate some tasks to setup a complete manjaro system. It may be compatible with manjaro32, but not fully tested.

With btrfs filesystem, we can set up a system with snapshots. With snapper and grub, we can rollback to a previous state, if anything goes wrong after a package install, or system update or anything else.

The main goal is to get a system up and running on btrfs and snapper to make the easy rollback possible. Additional benefit is to get my favorite default software installed 🙂

The main difference to timeshift, is that you can directly boot into an earlier state of the system in read-only mode, and restore that state.

You can find the video from Nick (unicks.eu) below which inspired me to write these scripts. https://www.youtube.com/watch?v=-fT92-jGniI

When and how to use these scripts?

The scripts designed to run (partially) as a part of the manjaro installation process. Once the installer finished you can execute the first script right from the point when the installer finished but before the system restarted. See more detailed info below.

Читайте также:  Shutdown process in linux

The basic precondition for the installation is to create a btrfs root, and a swap partition from the installer.

Please note: By default the installer will create only the /home subvolume. These scripts will do additional things to set up a complete btrfs system, prepared for an easy rollback.

Basic flow to run the scripts

  1. install/manjaro_setup_btrfs_01_after_install_before_restart.sh
  2. install/manjaro_setup_btrfs_02_after_install_after_restart.sh

You can find the list of scripts in the table below for completeness

Filename Description
install/manjaro_setup_btrfs_01_after_install_before_restart.sh Main script
install/manjaro_setup_btrfs_02_after_install_after_restart.sh Continuation script after restart
install/usr/btrfs_grub_install_chroot.sh This is a technical script called by another script, therefore you should not run it by hand. It will update and re-install grub. This script should be run in the chroot to the default subvolume.
install/usr/btrfs_ro_alert.sh Alert after boot if the btrfs filesystem is read only, and give the command to do the rollback. This script will be installed automatically.
install/usr/btrfs_snapper_do_rollback.sh This script will do a snapper rollback, and then update and re-install grub to use the proper snapshot at boot.
install/script/20-password-timeout-0-ppid-60min This is a setting file for sudo, and will be placed to /etc/sudoers.d/ to increase sudo timeout. If you uncomment the line #Defaults timestamp_type=»global», you will have to give your password for sudo only once in one terminal for one hour.
install/script/stage_2_setup.sh Basic system setup, typically executed after an install. Executed by install/manjaro_setup_btrfs_02_after_install_after_restart.sh
install/script/fix_catfish.sh This is the fix for catfish, to resolve the conflict with zeitgeist, see https://bugzilla.xfce.org/show_bug.cgi?id=16419, Executed by install/script/stage_2_setup.sh
manjaro_setup_custom.sh Some custom installations, settings
manjaro_setup_developer.sh Some development related installations, settings
manjaro_setup_encrypted_home.sh Encrypt the home directory for a selected user
manjaro_setup_keyfix.sh Refresh the package signing keys
manjaro_setup_kids.sh Install some games and educational package for the kids
manjaro_setup_lang_hu.sh Install hungarian language packages for some program
manjaro_setup_virtualbox.sh Install the necessary packages for a virtualbox client
xfce/manjaro_setup_xfce.sh Install some xfce related package like dockarx and panel, and some panel applets
xfce/manjaro_setup_xfce_desktop.sh This script will apply some modifications like add dockbarx dock, add some indicators to the panel, etc. It will use the file xfce/xfce_skeleton.tar.bz2
xfce/xfce_skeleton.tar.bz2 This file contains an xfce session with basic settings like dockarx, other than default theme set, additional panel applets, etc.

When the installer finished, do not restart the system yet! Run this script, right after the installer: install/manjaro_setup_btrfs_01_after_install_before_restart.sh.

  • if more than one partitions found with btrfs filesystem, prompt to choose the target
  • set the default subvolume
  • create subvolume /var to be able to boot into a read-only snapshot
  • create subvolume on /usr/local
  • move the pacman database to /usr/var/pacman to always reflect the state of the snapshot
  • install 20-password-timeout-0-ppid-60min

Creating the /var subvolume will greatly reduce the size of the snapshots, and give the ability to boot a read only snapshot, to do the rollback from there.

Читайте также:  Overwriting files in linux

After this script has finished, restart the system.

When you boot into the newly installed system: Before doing anything else, run the script install/manjaro_setup_btrfs_02_after_install_after_restart.sh.

  • call script/stage_2_setup.sh
    • sync system time
    • try to set up the fastest mirror
    • do a full update, and install some necessary tools, like rsync, lsof .
    • change login greeter to slick-greeter
    • on 64bit systems, install the kernel bootsplash
    • set up multi thread compression
    • disable speaker
    • enable AUR
    • fix the «sparse file not allowed» error message on startup
    • create snapper config
    • move snapshots to a separate subvolume
    • skip snapshots from updatedb
    • install some btrfs related package to be able to create snapshots on package install, and to list snapshots in grub menu
    • copy some scripts to /usr/local/bin. One of them will alert after boot if the btrfs filesystem is a read only snapshot, and give the command to do the rollback

    rollback to a previous state

    If you want to go back to a previous state of the system, you must reboot, and select the snapshot from the grub menu (under ‘Select snapshot’) to boot into. After you login, a window will warn you, that this is a read only snapshot. It also give you the command to do the rollback. After you are sure that you want to rollback to that state, you should run: sudo btrfs_snapper_do_rollback.sh from the terminal, as this script is installed on the system already.

    read only check, rollback command help

    After the reboot, you will get back the selected state of your system, like a time travel.

    Note: The user’s /home partition is not contained in the snapshot.

    Because you can only create encrypted home for another not logged in user, you must create a separate user to set up the encrypted home for.

    The manjaro_setup_encrypted_home.sh script will set the ecryptfs pam moduls, and encrypt the home dir if the user has no running processes (not logged in).

    Follow the original instructions from the encryption output at the end of the process: the target user should test if he/she can log in before the restart.

    After setting encrypted home(s), a restart is advised.

    xfce desktop modifications

    You should run this script for a user, that is not logged in currently.

    First run the script xfce/manjaro_setup_xfce.sh to install some xfce related package.

    The script xfce/manjaro_setup_xfce_desktop.sh will appy some modifications like add dockbarx dock, add some indicators to the panel, etc, for the selected user.

    • set theme to wallis
    • add dockbarx and set its theme to colors/dmd glass
    • add places and screenshot plugin to the panel
    • set default filemanager to caja
    • pin caja, firefox, catfish to dockbarx
    • set panel size to 42
    • modify energy management
    • set clock format to %a %d %b, %R:%S
    • set gimp theme
    • add synapse to autostart

    These are the exact steps:

    • create new user
    • log in with the new user
    • restart
    • run xfce/manjaro_setup_xfce_desktop.sh choosing the new user

    fix key problem during package update

    Rarely required, but if there are package key problems at update time, the script manjaro_setup_keyfix.sh will refresh the package signing keys.

    If we get a key error during an update, we can try to fix it, with this script.

    The rest of the scripts are self-explanatory, and commented. Feel free to explore, or tailor them to your needs.

    For example, if you want to test these scripts in virtualbox, use can use the manjaro_setup_virtualbox.sh script to install the necessary packages for a virtualbox client.

    executing the scripts from gui

    The scripts can be executed also from gui: set the script as executable exetute with terminal execute

    You should test the scripts before creating a new live system with them. You can also modify them freely to your needs.

    About

    Script collection to set up Manjaro with btrfs, and easy rollback.

    Источник

    0. Intro

    Hi all, in this video i show how to install Manjaro with btrfs, snapshots and Grub-Btrfs.

    1. The boot mode will be efi;
    2. I’m assuming you already have the usb stick with the Manjaro Linux ISO.
    3. Buggie will be Desktop Environment in this case.

    1. Install

    [Subtitle 01] Any moment you can access the site in description and see every command i gave here.

    [Subtitle 02] I will create 3 partitions. [Show partition scheme image]

    [Subtitle 03] I’m assuming you upgraded your system in order to continue. I

    2. Enable AUR

    3. Install and Config Snapper

    $ sudo pamac install snapper vim $ sudo snapper -c root create-config / 

    [subtitle 04] We will create snapper config for root snapshots.

    $ vim /etc/snapper/configs/root 

    Change the folowing lines to:

    TIMELINE_LIMIT_HOURLY="5" TIMELINE_LIMIT_DAYLY="7" TIMELINE_LIMIT_WEEKLY="0" TIMELINE_LIMIT_MONTHLY="0" TIMELINE_LIMIT-YEARLY="0" 

    [subtitle 05] If you want know about this parameters, you can visit the site in description.

     $ sudo btrfs subvolume delete /.snapshots $ sudo btrfs subvolume create /@snapshots $ sudo mkdir /.snapshots $ sudo chmod 750 /.snapshots $ sudo chown :duckchannel /.snapshots 

    #mount -o subvol=@/@snapshots /dev/sda3 /.snapshots

    4. Fstab

    Edit /etc/fstab and add the line for mount /.snapshots:

    5. Reinstall Grub

    Edit /etc/default/grub and comment out the line 3

    #GRUB_DEFAULT_TIMEOUT_STYLE=hidden 
    $ sudo pamac install grub-btrfs efibootmgr dosfstools \ mtools os-prober $ sudo grub-install --target=x86_64-efi \ --efi_directory=/boot/efi \ --bootloader-id=GRUB $ sudo grub-mkconfig -o /boot/grub/grub.cfg 

    6. Install snapper-gui

    $ sudo pamac install snapper-gui 

    7. Start the Services

    $ sudo systemctl enable --now snapper-timeline.timer $ sudo systemctl enable --now snapper-cleanup.timer $ sudo systemctl enable --now grub-btrfs.path $ 

    8. Create your First Snapshot

    Источник

Оцените статью
Adblock
detector