Skip to content

Conversation

@svlv
Copy link

@svlv svlv commented Jan 29, 2026

  • System-wide startup file /etc/profile or root initialization files
    (e.g. /root/.profile) may be broken or may block execution by spawning
    child processes. An additional check was added to ensure that running
    'chroot /bin/bash --login -c ' works correctly; if not, the
    --noprofile option is used.

Jira-Ref: BCF-6450: Rear Recover hung on last stage for hours

svlv added 4 commits January 29, 2026 10:39
- System-wide startup file /etc/profile or root initialization files
(e.g. /root/.profile) may be broken or may block execution by spawning
child processes. An additional check was added to ensure that running
'chroot /bin/bash --login -c <cmd>' works correctly; if not, the
--noprofile option is used.

Jira-Ref: BCF-6450: Rear Recover hung on last stage for hours
Jira-Ref: BCF-6450: Rear Recover hung on last stage for hours
Jira-Ref: BCF-6450: Rear Recover hung on last stage for hours
Jira-Ref: BCF-6450: Rear Recover hung on last stage for hours
Copilot AI review requested due to automatic review settings January 29, 2026 10:26
@svlv svlv requested a review from BarysBarysenka January 29, 2026 10:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a critical issue where ReaR (Relax-and-Recover) recovery could hang indefinitely when system-wide startup files (e.g., /etc/profile or /root/.profile) in the restored system are broken or spawn blocking child processes. The solution introduces a new run_in_chroot wrapper function that tests whether a login shell can execute properly and falls back to using the --noprofile option if issues are detected.

Changes:

  • Added run_in_chroot() function in lib/linux-functions.sh to wrap chroot calls with login shell detection and automatic fallback to --noprofile
  • Replaced 12 instances of direct chroot $TARGET_FS_ROOT /bin/bash --login -c calls with run_in_chroot across restore and finalize scripts
  • Added USE_NOPROFILE_FOR_LOGIN_SHELL configuration variable to allow manual override of auto-detection behavior

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
usr/share/rear/lib/linux-functions.sh Implements the new run_in_chroot() function with login shell detection, timeout mechanism, and automatic fallback to --noprofile option
usr/share/rear/conf/default.conf Documents the new USE_NOPROFILE_FOR_LOGIN_SHELL configuration variable
usr/share/rear/restore/default/900_create_missing_directories.sh Replaces direct chroot call with run_in_chroot for chown operations
usr/share/rear/restore/ZYPPER/default/950_grub2_mkconfig.sh Replaces direct chroot call with run_in_chroot for grub2-mkconfig; contains typo "insinde"
usr/share/rear/restore/ZYPPER/default/970_set_root_password.sh Replaces direct chroot call with run_in_chroot for password setting
usr/share/rear/restore/ZYPPER/default/980_initial_network_setup.sh Replaces three direct chroot calls with run_in_chroot for network setup commands
usr/share/rear/restore/YUM/default/950_grub2_mkconfig.sh Replaces direct chroot call with run_in_chroot for grub2-mkconfig; contains typo "insinde"
usr/share/rear/restore/YUM/default/970_set_root_password.sh Replaces direct chroot call with run_in_chroot for password setting
usr/share/rear/restore/YUM/default/980_initial_network_setup.sh Replaces three direct chroot calls with run_in_chroot for network setup commands
usr/share/rear/finalize/SUSE_LINUX/s390/660_install_grub2_and_zipl.sh Replaces direct chroot call with run_in_chroot for bootloader installation
usr/share/rear/finalize/Linux-ppc64le/660_install_grub2.sh Replaces three direct chroot calls with run_in_chroot for GRUB2 configuration and installation
usr/share/rear/finalize/Linux-i386/660_install_grub2.sh Replaces three direct chroot calls with run_in_chroot for GRUB2 operations
usr/share/rear/finalize/Debian/i386/550_rebuild_initramfs.sh Replaces direct chroot call with run_in_chroot for mdadm configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Jira-Ref: BCF-6450: Rear Recover hung on last stage for hours
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants