You are not logged in.
I'm trying to change my boot process from grub to directly uefi boot, after create the boot entry basing wiki https://wiki.archlinux.org/index.php/EFISTUB, it can start to boot, but failed to switch root.
The emergency shell also can't login: can't open access to console, the root account is locked. makes me don't know how to see the log, I can only chroot now.
I have checked the /etc/shadow, it seems my root account is fine? I tried reset my root password, it still can't login.
So... I don't know what to do now, I tried re-creat initramfs, same issue still there.
Sorry for my poor english, any suggest is welcome :-)
Offline
Since switch root failed, the emergency shell you get dumped to is from initramfs, so it uses /etc/shadow that's inside the initramfs image, but the root account in initramfs is locked ( https://github.com/archlinux/svntogit-p … d9db127101 , https://github.com/archlinux/svntogit-p … a0ab7c8d0a ). The root account on your system has no relation to it.
Offline
Thanks, nl6720. So I need to decompress the initramfs and unlock the root by changing /etc/shadow in it?
I wonder what's difference here between with grub fallback shell. Is grub use the initramfs-fallback.img which already patched to login with root?
Offline
When I extracted the initramfs.img, I found there is no shadow in /etc/,only /etc/passwd. So what can I do for unlock the root account?
Offline
diff --git a/trunk/initcpio-install-systemd b/trunk/initcpio-install-systemd
index 9e23070..fcf1b5c 100644
--- a/trunk/initcpio-install-systemd
+++ b/trunk/initcpio-install-systemd
@@ -173,7 +173,8 @@ build() {
'shadow: files'
echo "root:x:0:0:root:/root:/bin/sh" >"$BUILDROOT/etc/passwd"
- echo 'root:*:::::::' >"$BUILDROOT/etc/shadow"
+ echo "root:x:0:root" >"$BUILDROOT/etc/group"
+ echo "root::::::::" >"$BUILDROOT/etc/shadow"
getent group root audio disk input kmem kvm lp optical render storage tty uucp video | awk -F: ' { print $1 ":x:" $3 ":" }' >"$BUILDROOT/etc/group"
add_dir "/etc/modules-load.d"
Or create /etc/initcpio/install/systemd with the following content
#!/bin/bash
strip_quotes() {
local len=${#1} quotes=$'[\'"]' str=${!1}
if [[ ${str:0:1} = ${str: -1} && ${str:0:1} = $quotes ]]; then
printf -v "$1" %s "${str:1:-1}"
fi
}
add_udev_rule() {
# Add an udev rules file to the initcpio image. Dependencies on binaries
# will be discovered and added.
# $1: path to rules file (or name of rules file)
local rules= rule= key= value= binary=
rules=$(PATH=/usr/lib/udev/rules.d:/lib/udev/rules.d type -P "$1")
if [[ -z $rules ]]; then
# complain about not found rules
return 1
fi
add_file "$rules"
while IFS=, read -ra rule; do
# skip empty lines, comments
[[ -z $rule || $rule = @(+([[:space:]])|#*) ]] && continue
for pair in "${rule[@]}"; do
IFS=' =' read -r key value <<< "$pair"
case $key in
RUN@({program}|+)|IMPORT{program}|ENV{REMOVE_CMD})
strip_quotes 'value'
# just take the first word as the binary name
binary=${value%% *}
[[ ${binary:0:1} == '$' ]] && continue
if [[ ${binary:0:1} != '/' ]]; then
binary=$(PATH=/usr/lib/udev:/lib/udev type -P "$binary")
fi
add_binary "$binary"
;;
esac
done
done <"$rules"
}
add_systemd_unit() {
# Add a systemd unit file to the initcpio image. Hard dependencies on binaries
# and other unit files will be discovered and added.
# $1: path to rules file (or name of rules file)
local unit= rule= entry= key= value= binary= dep=
unit=$(PATH=/usr/lib/systemd/system:/lib/systemd/system type -P "$1")
if [[ -z $unit ]]; then
# complain about not found unit file
return 1
fi
add_file "$unit"
while IFS='=' read -r key values; do
read -ra values <<< "$values"
case $key in
Requires|OnFailure)
# only add hard dependencies (not Wants)
map add_systemd_unit "${values[@]}"
;;
Exec*)
# do not add binaries unless they are required,
# strip special executable prefixes
case ${values[0]} in
-*) ;;
!!*) add_binary "${values[0]#!!}" ;;
*) add_binary "${values[0]#[@!:+]}" ;;
esac
;;
esac
done <"$unit"
# preserve reverse soft dependency
for dep in {/usr,}/lib/systemd/system/*.wants/${unit##*/}; do
if [[ -L $dep ]]; then
add_symlink "$dep"
fi
done
# add hard dependencies
if [[ -d $unit.requires ]]; then
for dep in "$unit".requires/*; do
add_systemd_unit ${dep##*/}
done
fi
}
add_systemd_drop_in() {
local unit=$1 dropin_name=$2
mkdir -p "$BUILDROOT/etc/systemd/system/$unit.d"
cat >"$BUILDROOT/etc/systemd/system/$unit.d/$2.conf"
}
build() {
local rules unit
# from base
add_binary /bin/mount
add_binary /usr/bin/kmod /usr/bin/modprobe
add_binary /usr/lib/systemd/systemd /init
add_binary /usr/bin/sulogin
map add_binary \
/usr/bin/journalctl \
/usr/bin/systemd-tmpfiles \
/usr/lib/systemd/systemd-hibernate-resume \
/usr/lib/systemd/systemd-shutdown \
/usr/lib/systemd/systemd-sulogin-shell \
/usr/lib/systemd/system-generators/systemd-fstab-generator \
/usr/lib/systemd/system-generators/systemd-gpt-auto-generator \
/usr/lib/systemd/system-generators/systemd-hibernate-resume-generator
# udev rules and systemd units
map add_udev_rule "$rules" \
50-udev-default.rules \
60-persistent-storage.rules \
64-btrfs.rules \
80-drivers.rules \
99-systemd.rules
map add_systemd_unit \
initrd-cleanup.service \
initrd-fs.target \
initrd-parse-etc.service \
initrd-root-fs.target \
initrd-root-device.target \
initrd-switch-root.service \
initrd-switch-root.target \
initrd-udevadm-cleanup-db.service \
initrd.target \
kmod-static-nodes.service \
local-fs.target \
local-fs-pre.target \
paths.target \
reboot.target \
slices.target \
sockets.target \
swap.target \
systemd-fsck@.service \
systemd-hibernate-resume@.service \
systemd-journald.service \
systemd-journald-audit.socket \
systemd-journald-dev-log.socket \
systemd-modules-load.service \
systemd-tmpfiles-setup-dev.service \
systemd-udev-trigger.service \
systemd-udevd-control.socket \
systemd-udevd-kernel.socket \
systemd-udevd.service \
timers.target \
rescue.target \
emergency.target
add_symlink "/usr/lib/systemd/system/default.target" "initrd.target"
add_symlink "/usr/lib/systemd/system/ctrl-alt-del.target" "reboot.target"
add_binary "$(readlink -f /usr/lib/libnss_files.so)"
printf '%s\n' >"$BUILDROOT/etc/nsswitch.conf" \
'passwd: files' \
'group: files' \
'shadow: files'
echo "root:x:0:0:root:/root:/bin/sh" >"$BUILDROOT/etc/passwd"
echo "root:x:0:root" >"$BUILDROOT/etc/group"
echo "root::::::::" >"$BUILDROOT/etc/shadow"
getent group root audio disk input kmem kvm lp optical render storage tty uucp video | awk -F: ' { print $1 ":x:" $3 ":" }' >"$BUILDROOT/etc/group"
add_dir "/etc/modules-load.d"
(
. "$_f_config"
set -f
printf '%s\n' ${MODULES[@]} >"$BUILDROOT/etc/modules-load.d/MODULES.conf"
)
}
help() {
cat <<HELPEOF
This will install a basic systemd setup in your initramfs, and is meant to
replace the 'base', 'usr', 'udev' and 'resume' hooks. Other hooks with runtime
components will need to be ported, and will not work as intended. You also may
wish to still include the 'base' hook (before this hook) to ensure that a
rescue shell exists on your initramfs.
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:
Offline
currently my /etc/initcpio/install/systemd is empty, so I need to create a new one?
I also confused the file initcpio-install-systemd location?
Offline
currently my /etc/initcpio/install/systemd is empty, so I need to create a new one?
Yes
I also confused the file initcpio-install-systemd location?
The diff is for patch in a git clone of mkinitcpio and then makepkg...since it's a git diff...maybe.
Offline
Ok, so I think it should be in part of mkinitcpio, this sound reasonable.
I finally solved it by https://github.com/xdever/arch-efiboot, seems xps can't directly pass the kernel cmd, it need to pack kernel and other things together as a bootloader.
The emergency shell can't login issue seems also related to keyboard not working, it may enter the shell but I can't press enter actually, the entire keyboard not work.
Is this related to above root account locked problem? I mean will the systemd start to load some driver for keyboard and other things AFTER root has successfully login?
Offline
I finally solved it by https://github.com/xdever/arch-efiboot, seems xps can't directly pass the kernel cmd, it need to pack kernel and other things together as a bootloader.
No need for external elements, Wiki page for unified kernel image: https://wiki.archlinux.org/index.php/Sy … rnel_image
Make it, a nice pacman hook for building it again on updates, and load it from UEFI as a boot entry.
The emergency shell can't login issue seems also related to keyboard not working, it may enter the shell but I can't press enter actually, the entire keyboard not work.
Is this related to above root account locked problem? I mean will the systemd start to load some driver for keyboard and other things AFTER root has successfully login?
No. That can happen for other reasons...but unrelated to the current thread.
Last edited by GaKu999 (2020-09-24 01:47:51)
Offline
Yes, the github package is arch-efiboot AUR, it's simply porting the wiki page you pasted as a shell script :-)
And thanks for explain the keyboard issue, I will leave it as a unimportant stone to make my today happier.
Offline
The patch was intended to be used by something like the following:
git clone git://git.archlinux.org/svntogit/packages.git --single-branch --branch "packages/systemd"
cd packages/trunk/
git apply -v PKGBUILD.diff
makepkg -rsi
Offline
Sorry, I think I jumped to conclusions and steered you the wrong way. What I wrote only applies if you use systemd based initramfs not the default busybox based one.
My intention, which I should have said, was to tell you to not waste your time wondering why you cannot login in the emergency shell. But, if you use busybox based initramfs then this does not apply here and not being able to login is indeed an issue.
Offline