-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix snapper /home config creation on chroot installations #5419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||||||
| #!/bin/bash | ||||||||||
|
|
||||||||||
| # Fix /boot permissions security issue | ||||||||||
| # The random seed file and /boot mount should not be world accessible | ||||||||||
| # See: https://github.com/basecamp/omarchy/issues/5377 | ||||||||||
|
|
||||||||||
| echo "Fixing /boot permissions for better security..." | ||||||||||
|
|
||||||||||
| # Fix /boot directory permissions (should be 700) | ||||||||||
| sudo chmod 700 /boot 2>/dev/null || echo "Could not change /boot permissions" | ||||||||||
|
|
||||||||||
| # Fix random-seed file permissions if it exists | ||||||||||
| if [[ -f /boot/loader/random-seed ]]; then | ||||||||||
| sudo chmod 600 /boot/loader/random-seed 2>/dev/null || echo "Could not change random-seed permissions" | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| # Ensure /boot is mounted with proper permissions | ||||||||||
| # Add to fstab if not already present with correct options | ||||||||||
| if ! grep -q "^/boot" /etc/fstab 2>/dev/null; then | ||||||||||
|
Comment on lines
+18
to
+19
|
||||||||||
| # Add to fstab if not already present with correct options | |
| if ! grep -q "^/boot" /etc/fstab 2>/dev/null; then | |
| # Warn if /boot is not present in /etc/fstab; this script does not modify fstab | |
| if ! awk '!/^[[:space:]]*#/ && NF >= 2 && $2 == "/boot" { found=1; exit } END { exit !found }' /etc/fstab 2>/dev/null; then |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,32 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Fix snapper /home config creation for chroot installations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # See: https://github.com/basecamp/omarchy/issues/5344 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Ensuring snapper /home config is created..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+6
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check if /home is on a separate subvolume or btrfs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if mountpoint -q /home 2>/dev/null; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # /home is a separate mount point | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ! sudo snapper list-configs 2>/dev/null | grep -q "home"; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Creating snapper config for /home..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sudo snapper -c home create-config /home 2>/dev/null || echo "Warning: Could not create /home snapper config" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| elif [[ -d /home/.snapshots ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # /home has .snapshots subdirectory, ensure config exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ! sudo snapper list-configs 2>/dev/null | grep -q "home"; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Creating snapper config for /home subvolume..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sudo snapper -c home create-config /home 2>/dev/null || echo "Warning: Could not create /home snapper config" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "/home is not on a separate subvolume, skipping /home snapper config" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+22
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check if /home is on a separate subvolume or btrfs | |
| if mountpoint -q /home 2>/dev/null; then | |
| # /home is a separate mount point | |
| if ! sudo snapper list-configs 2>/dev/null | grep -q "home"; then | |
| echo "Creating snapper config for /home..." | |
| sudo snapper -c home create-config /home 2>/dev/null || echo "Warning: Could not create /home snapper config" | |
| fi | |
| elif [[ -d /home/.snapshots ]]; then | |
| # /home has .snapshots subdirectory, ensure config exists | |
| if ! sudo snapper list-configs 2>/dev/null | grep -q "home"; then | |
| echo "Creating snapper config for /home subvolume..." | |
| sudo snapper -c home create-config /home 2>/dev/null || echo "Warning: Could not create /home snapper config" | |
| fi | |
| else | |
| echo "/home is not on a separate subvolume, skipping /home snapper config" | |
| home_uses_btrfs_subvolume() { | |
| local home_fstype | |
| local home_mount_root | |
| home_fstype="$(findmnt -n -o FSTYPE --target /home 2>/dev/null || true)" | |
| [[ "$home_fstype" == "btrfs" ]] || return 1 | |
| # Prefer detecting an actual btrfs subvolume so chroot installs work | |
| # even when /home is not mounted separately yet. | |
| if btrfs subvolume show /home >/dev/null 2>&1; then | |
| return 0 | |
| fi | |
| # Fall back to checking whether /home is the root of its own mount. | |
| home_mount_root="$(stat -c %m /home 2>/dev/null || true)" | |
| [[ "$home_mount_root" == "/home" ]] | |
| } | |
| # Check if /home is backed by btrfs and is either a subvolume or a separate mount. | |
| if home_uses_btrfs_subvolume; then | |
| if ! sudo snapper list-configs 2>/dev/null | grep -q "home"; then | |
| echo "Creating snapper config for /home..." | |
| sudo snapper -c home create-config /home 2>/dev/null || echo "Warning: Could not create /home snapper config" | |
| fi | |
| else | |
| echo "/home is not on a separate btrfs subvolume, skipping /home snapper config" |
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script calls snapper unconditionally. Other parts of the repo guard snapper usage with a command presence check; without that, a missing snapper binary will cause this to silently do nothing (stderr is redirected) and still print a successful completion message.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,25 @@ | ||||||||||
| #!/bin/bash | ||||||||||
|
|
||||||||||
| # Fix /boot permissions security issue | ||||||||||
| # See: https://github.com/basecamp/omarchy/issues/5377 | ||||||||||
|
|
||||||||||
| echo "Fixing /boot permissions for better security..." | ||||||||||
|
Comment on lines
+1
to
+6
|
||||||||||
|
|
||||||||||
| # Fix /boot directory permissions (should be 700 for security) | ||||||||||
| sudo chmod 700 /boot 2>/dev/null || echo "Could not change /boot permissions" | ||||||||||
|
|
||||||||||
| # Fix random-seed file permissions if it exists | ||||||||||
| if [[ -f /boot/loader/random-seed ]]; then | ||||||||||
| sudo chmod 600 /boot/loader/random-seed 2>/dev/null || echo "Could not change random-seed permissions" | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| # Verify the fix | ||||||||||
| if [[ $(stat -c %a /boot 2>/dev/null) == "700" ]]; then | ||||||||||
| echo "✓ /boot permissions fixed to 700" | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| if [[ -f /boot/loader/random-seed ]] && [[ $(stat -c %a /boot/loader/random-seed 2>/dev/null) == "600" ]]; then | ||||||||||
| echo "✓ random-seed permissions fixed to 600" | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| notify-send "Boot permissions fixed" "Security improvement applied to /boot" | ||||||||||
|
||||||||||
| notify-send "Boot permissions fixed" "Security improvement applied to /boot" | |
| if command -v notify-send >/dev/null 2>&1 && [[ -n "${DISPLAY:-}" || -n "${DBUS_SESSION_BUS_ADDRESS:-}" ]]; then | |
| notify-send "Boot permissions fixed" "Security improvement applied to /boot" >/dev/null 2>&1 || true | |
| fi |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Fix snapper /home config for chroot installations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # See: https://github.com/basecamp/omarchy/issues/5344 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Fixing snapper /home config..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Get absolute path for omarchy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OMARCHY_PATH="${OMARCHY_PATH:-$HOME/.local/share/omarchy}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check if /home is on btrfs and has .snapshots | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ -d /home/.snapshots ]] || mountpoint -q /home 2>/dev/null; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+11
to
+12
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check if /home is on btrfs and has .snapshots | |
| if [[ -d /home/.snapshots ]] || mountpoint -q /home 2>/dev/null; then | |
| home_has_snapper_target() { | |
| [[ -d /home/.snapshots ]] && return 0 | |
| mountpoint -q /home 2>/dev/null && return 0 | |
| if command -v btrfs >/dev/null 2>&1; then | |
| btrfs subvolume show /home >/dev/null 2>&1 && return 0 | |
| fi | |
| return 1 | |
| } | |
| # Check if /home is already initialized for snapper or is a btrfs subvolume | |
| if home_has_snapper_target; then |
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script prints "✓ Created snapper /home config" unconditionally, even if snapper -c home create-config fails (it only echoes a warning but doesn’t change control flow). This can mislead users and hides the fact that the fix didn’t apply.
| sudo snapper -c home create-config /home 2>/dev/null || echo "Warning: Could not create /home snapper config" | |
| # Copy default config | |
| if [[ -f /etc/snapper/configs/root ]]; then | |
| sudo cp /etc/snapper/configs/root /etc/snapper/configs/home 2>/dev/null || true | |
| # Modify for /home - don't create timeline snapshots | |
| sudo sed -i 's|SUBVOLUME="/"|SUBVOLUME="/home"|' /etc/snapper/configs/home 2>/dev/null || true | |
| sudo sed -i 's|TIMELINE_CREATE="yes"|TIMELINE_CREATE="no"|' /etc/snapper/configs/home 2>/dev/null || true | |
| fi | |
| echo "✓ Created snapper /home config" | |
| if sudo snapper -c home create-config /home 2>/dev/null; then | |
| # Copy default config | |
| if [[ -f /etc/snapper/configs/root ]]; then | |
| sudo cp /etc/snapper/configs/root /etc/snapper/configs/home 2>/dev/null || true | |
| # Modify for /home - don't create timeline snapshots | |
| sudo sed -i 's|SUBVOLUME="/"|SUBVOLUME="/home"|' /etc/snapper/configs/home 2>/dev/null || true | |
| sudo sed -i 's|TIMELINE_CREATE="yes"|TIMELINE_CREATE="no"|' /etc/snapper/configs/home 2>/dev/null || true | |
| fi | |
| echo "✓ Created snapper /home config" | |
| else | |
| echo "Warning: Could not create /home snapper config" | |
| fi |
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces (or re-introduces) a /home snapper config, but the current codebase explicitly avoids /home snapshots (install/login/limine-snapper.sh comment) and migration 1776927490 removes the home config and .snapshots subvolume. Because migrations run in filename order, this new migration would effectively undo 1776927490 on the next update.
| # Fix snapper /home config for chroot installations | |
| # See: https://github.com/basecamp/omarchy/issues/5344 | |
| echo "Fixing snapper /home config..." | |
| # Check if /home is on btrfs and has .snapshots | |
| if [[ -d /home/.snapshots ]] || mountpoint -q /home 2>/dev/null; then | |
| # Check if /home snapper config exists | |
| if ! sudo snapper list-configs 2>/dev/null | grep -q "^home"; then | |
| echo "Creating snapper config for /home..." | |
| sudo snapper -c home create-config /home 2>/dev/null || echo "Warning: Could not create /home snapper config" | |
| # Copy default config | |
| if [[ -f /etc/snapper/configs/root ]]; then | |
| sudo cp /etc/snapper/configs/root /etc/snapper/configs/home 2>/dev/null || true | |
| # Modify for /home - don't create timeline snapshots | |
| sudo sed -i 's|SUBVOLUME="/"|SUBVOLUME="/home"|' /etc/snapper/configs/home 2>/dev/null || true | |
| sudo sed -i 's|TIMELINE_CREATE="yes"|TIMELINE_CREATE="no"|' /etc/snapper/configs/home 2>/dev/null || true | |
| fi | |
| echo "✓ Created snapper /home config" | |
| else | |
| echo "Snapper /home config already exists" | |
| fi | |
| else | |
| echo "/home is not on btrfs or separate subvolume, skipping" | |
| fi | |
| # Ensure snapper root config exists for chroot installations | |
| # See: https://github.com/basecamp/omarchy/issues/5344 | |
| echo "Fixing snapper root config..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This installer script is not referenced by the install pipeline (it is not called from install/config/all.sh, and no other scripts source/execute it), so it won’t actually run during installation.