使用 chroot 对 bash 脚本进行故障排除。20.04 和 22.04 之间有什么区别?

使用 chroot 对 bash 脚本进行故障排除。20.04 和 22.04 之间有什么区别?

我正在使用一个在 chroot 下执行操作的 bash 脚本。它很久以前就运行良好,如下所示:

copy stuff here and there then

  sudo chroot . su - root -c "\
set -o xtrace ; \
cd /tmp/wheresthestuff ; \
. $ScriptName ; \
ModifyThisCHROOT ; \
exit 0 ; \
"

直到 22.04 版本,它似乎都能正确完成工作。
但是从 Ubuntu 22.04 开始,apt-get install 似乎会拖延一切。
来自此特定阻止命令的 strace 显示以下内容:

sudo DEBIAN_FRONTEND=noninteractive strace apt-get \
        --assume-yes \
        --reinstall \
        --force-yes \
        --fix-broken \
        --option Dpkg::Options::=--force-confnew \
        install \
        --no-install-recommends \
        $package 
...
pselect6(34, [0 31 33], NULL, NULL, {tv_sec=0, tv_nsec=50000000}, {sigmask=[], sigsetsize=8}) = 1 (in [33], left {tv_sec=0, tv_nsec=49998940})
wait4(199664, 0x7ffe6b270bd0, WNOHANG, NULL) = 0
pselect6(34, [0 31 33], NULL, NULL, {tv_sec=0, tv_nsec=50000000}, {sigmask=[], sigsetsize=8}) = 1 (in [33], left {tv_sec=0, tv_nsec=49998520})
wait4(199664, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG, NULL) = 199664
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=199664, si_uid=0, si_status=0, si_utime=1, si_stime=0} ---
close(33)                               = 0
rt_sigaction(SIGQUIT, {sa_handler=SIG_DFL, sa_mask=[QUIT], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f074fe78520}, {sa_handler=SIG_IGN, sa_mask=[QUIT], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f074fe78520}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[INT], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f074fe78520}, {sa_handler=0x7f07503ab4d0, sa_mask=[INT], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f074fe78520}, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=SIG_DFL, sa_mask=[HUP], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f074fe78520}, {sa_handler=SIG_IGN, sa_mask=[HUP], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f074fe78520}, 8) = 0
close(32)                               = 0
ioctl(0, TCGETS, {B38400 -opost isig -icanon -echo ...}) = 0
ioctl(0, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost isig icanon echo ...}) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGTTOU {si_signo=SIGTTOU, si_code=SI_KERNEL} ---
--- stopped by SIGTTOU ---

我无法解决。有什么建议吗?

相关内容