Skip to content
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

Improve logging for debugging startup issues #26

Open
wants to merge 1 commit into
base: halium
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions scripts/halium
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ identify_boot_mode() {
esac
fi

tell_kmsg "boot mode: $BOOT_MODE"
tell_kmsg "Boot mode: $BOOT_MODE"
}

identify_android_image() {
Expand All @@ -74,6 +74,11 @@ identify_android_image() {
[ -f /halium-system/var/lib/lxc/android/system.img ] && ANDROID_IMAGE_MODE="system"
[ -f /halium-system/var/lib/lxc/android/android-rootfs.img ] && ANDROID_IMAGE_MODE="rootfs"
[ -z $ANDROID_IMAGE_MODE ] && ANDROID_IMAGE_MODE="unknown"

if [ "$ANDROID_IMAGE_MODE" = "unknown" ]; then
halium_panic "Could not identify Android system image!"
fi
Copy link
Member

Choose a reason for hiding this comment

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

While you wouldn't guess it from the name, initramfs-tools-halium may be used in cases where no Android image is present. It's not appropriate to panic in these cases.

I think there is a warning for the Android image not being found, though?

Copy link
Author

Choose a reason for hiding this comment

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

Ok I´ll remove it. The problem remains, why continue trying to boot if something essential is missing? If the system.img is missing then a bunch of errors is written out, and still the thing tries to start LXC it seems. I wanted to have a clear stop condition somewhere so that people can see, okay at the very end of the log: This is the problem.

tell_kmsg "Android image mode: $ANDROID_IMAGE_MODE"
}

set_halium_version_properties() {
Expand Down Expand Up @@ -262,13 +267,16 @@ identify_file_layout() {

# $file_layout = "halium" means there is a separate rootfs.img and system.img on userdata
#
# = "legacy" means there is a separate ubuntu.img on userdata
# and will contain /var/lib/lxc/android/system.img
#
# = "partition" means the rootfs is located on the device's system partition
# and will contain /var/lib/lxc/android/system.img
#
# = "subdir" means the rootfs is located in a folder on the device's userdata partition
# and will contain /var/lib/lxc/android/system.img

if [ -e /tmpmnt/rootfs.img ]; then
if [ -e /tmpmnt/rootfs.img ] && [ -e /tmpmnt/system.img ]; then
imagefile=/tmpmnt/rootfs.img
file_layout="halium"
elif [ -e /tmpmnt/ubuntu.img ]; then
Expand All @@ -281,6 +289,8 @@ identify_file_layout() {
file_layout="partition"
fi

tell_kmsg "File layout: $file_layout"

}

process_bind_mounts() {
Expand Down