Compare commits

..

4 Commits

Author SHA1 Message Date
Antynea
2054eb53d9 Correct typo 2021-11-26 17:22:27 +01:00
Antynea
7ba2c59030 Update Readme
* Update Description section:
Adds experimental method for booting to a snapshot in read-only mode with systemd.

* Update Installation section:
Adds : Run make help to check what options are available.
Adds new dependency: strings
2021-11-26 17:20:26 +01:00
Antynea
208c679ac5 Add "GRUB_BTRFS_SYSTEMD_VOLATILE" option 2021-11-26 16:55:53 +01:00
Antynea
b2a3a2343c Add systemd-volatile
Adds support for "systemd.volatile=state" only.
See: https://github.com/Antynea/grub-btrfs/issues/92#issuecomment-966869223

"GRUB_BTRFS_SYSTEMD_VOLATILE" must be true.
The default init on the snapshot should be "systemd".
The snapshot must have the tag "ro=true".
2021-11-26 16:47:04 +01:00
3 changed files with 22 additions and 3 deletions

View File

@@ -162,8 +162,16 @@ echo "$@" >> "$grub_directory/grub-btrfs.new"
}
## menu entries
old_kernel_parameters=${kernel_parameters}
make_menu_entries()
{
kernel_parameters="${old_kernel_parameters}"
if [[ "${GRUB_BTRFS_SYSTEMD_VOLATILE}" == true ]] ; then
if [[ $(strings -n7 "$grub_btrfs_mount_point/$snap_dir_name_trim/usr/bin/init" | grep -aEiom1 'upstart|systemd|sysvinit') == systemd ]] \
|| [[ $(strings -n7 "$grub_btrfs_mount_point/$snap_dir_name_trim/sbin/init" | grep -aEiom1 'upstart|systemd|sysvinit') == systemd ]]; then
[[ $(btrfs property get "$grub_btrfs_mount_point/$snap_dir_name_trim" ro) != "ro=false" ]] && kernel_parameters="${kernel_parameters} systemd.volatile=state";
fi
fi
## \" required for snap,kernels,init,microcode with space in their name
entry "submenu '${title_menu}' {
submenu '${title_submenu}' { echo }"

View File

@@ -19,8 +19,8 @@ Otherwise, make sure your snapshots are writeable.
See [this ticket](https://github.com/Antynea/grub-btrfs/issues/92) for more info.
This project includes its own solution.
Refer to the [documentation](https://github.com/Antynea/grub-btrfs/blob/master/initramfs/readme.md).
* Refer to the [documentation](https://github.com/Antynea/grub-btrfs/blob/master/initramfs/readme.md).
* Or used `GRUB_BTRFS_SYSTEMD_VOLATILE=true` in config file. (experimental, See [config file](https://github.com/Antynea/grub-btrfs/blob/master/config) for more information.)
- - -
### What does grub-btrfs v4.xx do :
* Automatically List snapshots existing on root partition (btrfs).
@@ -52,12 +52,13 @@ Now merge grub-btrfs via
#### Manual
* Run `make install` or look into Makefile for instructions on where to put each file.
* Run `make help` to check what options are available.
* Run `make help` to check what options are available.
* Dependencies:
* [btrfs-progs](https://archlinux.org/packages/core/x86_64/btrfs-progs/)
* [grub](https://archlinux.org/packages/core/x86_64/grub/)
* [bash >4](https://archlinux.org/packages/core/x86_64/bash/)
* [gawk ](https://archlinux.org/packages/core/x86_64/gawk/)
* [strings](https://archlinux.org/packages/core/x86_64/binutils/)
#### NOTE: All distros
Generate your Grub menu after installation for the changes to take effect.

10
config
View File

@@ -54,6 +54,16 @@
# Default: ""
#GRUB_BTRFS_ROOTFLAGS="space_cache,commit=10,norecovery"
# Booting on read-only snapshots can be tricky. (See https://github.com/Antynea/grub-btrfs#warning-booting-on-read-only-snapshots-can-be-tricky)
# Based on several reports, "/var" must be writable to start properly.
# Systemd can do this for you. (not compatible with OpenRC)
# The snapshot will boot in read-only mode but "/var" will be writable using a "tmpfs" mount point (which means, folder mounted in RAM)
# This should make it easier to rollback.
# Note to all: Detecting "systemd" as the default init on the snapshot is automatic, if don't, file a bug report at https://github.com/Antynea/grub-btrfs.
# Note to Arch Linux users: If you use the "grub-btrfs-overlayfs" option on Arch Linux, "GRUB_BTRFS_SYSTEMD_VOLATILE" will do nothing.
# Default: "false"
#GRUB_BTRFS_SYSTEMD_VOLATILE=true
# Ignore specific path during run "grub-mkconfig".
# Only exact paths are ignored.
# e.g : if `specific path` = @, only `@` snapshot will be ignored.