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

feat: Don't use auto device on UEFI #538

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ kubectl apply -f kubernetes.yml

* ### How do I boot without VirtIO drivers?

By default, the machine makes use of `virtio-scsi` drives for performance reasons, and even though most Linux kernels bundle the necessary driver for this device, that may not always be the case for some other operating systems.
By default, the machine makes use of `virtio-scsi` drives for performance reasons, and even though most Linux kernels bundle the necessary driver for this device, that may not always be the case for other operating systems.

If your machine fails to detect the hard drive, you can modify your compose file to use `virtio-blk` instead:

Expand Down
15 changes: 11 additions & 4 deletions src/disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,16 @@ addDevice () {
DISK_OPTS=""
html "Initializing disks..."

[ -z "$DISK_TYPE" ] && DISK_TYPE="scsi"

case "${DISK_TYPE,,}" in
"blk" ) MEDIA_TYPE="auto" ;;
"" ) DISK_TYPE="scsi" && MEDIA_TYPE="$DISK_TYPE" ;;
"auto" | "ide" | "usb" | "scsi" ) MEDIA_TYPE="$DISK_TYPE" ;;
"ide" | "usb" | "scsi" )
MEDIA_TYPE="$DISK_TYPE" ;;
"blk" | "auto" )
MEDIA_TYPE="auto"
if [ -n "${BOOT_MODE:-}" ] && [[ "${BOOT_MODE:-}" != *"legacy" ]]; then
[[ "${MACHINE,,}" != "virt" ]] && MEDIA_TYPE="ide"
fi ;;
* ) error "Invalid DISK_TYPE, value \"$DISK_TYPE\" is unrecognized!" && exit 80 ;;
esac

Expand All @@ -529,7 +535,8 @@ DRIVERS="/drivers.iso"
[ ! -f "$DRIVERS" ] || [ ! -s "$DRIVERS" ] && DRIVERS="$STORAGE/drivers.iso"

if [ -f "$DRIVERS" ] && [ -s "$DRIVERS" ]; then
DRIVER_OPTS=$(addMedia "$DRIVERS" "auto" "1" "" "0x6")
[[ "${MACHINE,,}" == "virt" ]] && DRIVER_TYPE="auto" || DRIVER_TYPE="ide"
DRIVER_OPTS=$(addMedia "$DRIVERS" "$DRIVER_TYPE" "1" "" "0x6")
DISK_OPTS="$DISK_OPTS $DRIVER_OPTS"
fi

Expand Down
Loading