sync filesystem before switch-root

This commit is contained in:
Tobias Powalowski 2023-06-18 15:21:51 +02:00
parent 24dadefb11
commit d10dad76e9
7 changed files with 8 additions and 5 deletions

View file

@ -57,6 +57,7 @@ if [[ "${TTY}" = "tty1" ]]; then
rm -f /sysroot/{VERSION,config,buildconfig,init} &>/dev/null
# systemd needs this for root_switch
touch /etc/initrd-release
sync
echo -e "\e[1;96mArchboot\e[m \e[1m- Arch Linux Environment finished.\e[m"
echo -e "\e[1mSystemd initrd-switch-root will be launched in a second...\e[m"
read -r -t 3

View file

@ -383,11 +383,13 @@ _new_environment() {
if [[ -e /var/cache/pacman/pkg/archboot.db ]]; then
echo -e "\e[1mStep ${_STEPS}/${_STEPS}:\e[m Switch root to ${_RAM}..."
mv ${_W_DIR}/tmp/* /${_RAM}/
rm -r /${_RAM}/mkinitcpio.*
# cleanup mkinitcpio directories and files
rm -rf /sysroot/{hooks,install,kernel,new_root,sysroot} &>/dev/null
rm -f /sysroot/{VERSION,config,buildconfig,init} &>/dev/null
# systemd needs this for root_switch
touch /etc/initrd-release
sync
systemctl start initrd-switch-root
fi
echo -e "\e[1mStep ${_S_APPEND}7/${_STEPS}:\e[m Creating initramfs ${_RAM}/${_INITRD}..."

View file

@ -6,7 +6,7 @@ build ()
{
map add_binary head id cksum tail test uptime w who whoami xargs \
swapon uniq seq fdisk sfdisk cfdisk parted free less \
chgrp chown dialog dmesg egrep fgrep stty sync hdparm \
chgrp chown dialog dmesg egrep fgrep stty hdparm \
dirname chroot expr bzip2 su sdparm tput bsdcpio \
losetup mkfifo mknod readlink lzmadec lzop xz last wall mesg utmpdump \
xzdec switch_root pivot_root chcpu ctrlaltdel gdisk sgdisk cgdisk fixparts findmnt \

View file

@ -6,7 +6,7 @@ build ()
{
apps="head id cksum tail test uptime w who whoami xargs \
swapon uniq seq fdisk sfdisk cfdisk parted free less \
chgrp dialog dmesg egrep fgrep stty sync hdparm bsdcpio\
chgrp dialog dmesg egrep fgrep stty hdparm bsdcpio\
dirname chroot expr bunzip2 bzcat bzip2 su sdparm tput \
losetup mkfifo mknod lzmadec lzop lzma lzcat unlzma unxz xzcat \
lastb last wall mesg utmpdump xzdec switch_root pivot_root chcpu ctrlaltdel \

View file

@ -16,7 +16,7 @@ build ()
mkdir echo false sleep kmod pidof touch chmod find wc uname yes awk halt \
shutdown reboot poweroff insmod modprobe sh dd sort zstd date tee mktemp \
install pgrep mkfs.btrfs rmmod mountpoint gzip ldconfig nscd ln top df cut \
stat tr passwd od tar bsdtar
stat tr passwd od tar bsdtar sync
### add nano
add_binary nano

View file

@ -35,7 +35,7 @@ ConditionPathExists=/dev/tty0
# The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then
# the entered username.
ExecStart=-/sbin/agetty --skip-login --login-options "-f root -p -- \\u" - $TERM
ExecStart=-/sbin/agetty --skip-login -o "-f root -p -- \\u" - $TERM
Type=idle
Restart=always
RestartSec=0

View file

@ -30,7 +30,7 @@ Before=rescue.service
# The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then
# the entered username.
ExecStart=-/sbin/agetty --skip-login --login-options "-f root -p -- \\u" --keep-baud 115200,57600,38400,9600 - $TERM
ExecStart=-/sbin/agetty --skip-login -o "-f root -p -- \\u" --keep-baud 115200,57600,38400,9600 - $TERM
Type=idle
Restart=always
UtmpIdentifier=%I