Skip to content

Commit

Permalink
fix(dracut-init.sh): correct check in is_qemu_virtualized function
Browse files Browse the repository at this point in the history
Do not redirect `systemd-detect-virt` to /dev/null, otherwise, the `vm` variable
is always empty. This function was working only thanks to the following /sys
check.

Reported-by: Raymund Will <[email protected]>
  • Loading branch information
aafeijoo-suse committed Jun 22, 2023
1 parent 7ed765d commit 3e2f685
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dracut-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ is_qemu_virtualized() {
# 1 if a virt environment could not be detected
# 255 if any error was encountered
if type -P systemd-detect-virt > /dev/null 2>&1; then
if ! vm=$(systemd-detect-virt --vm > /dev/null 2>&1); then
if ! vm=$(systemd-detect-virt --vm 2> /dev/null); then
return 255
fi
[[ $vm == "qemu" ]] && return 0
Expand Down

0 comments on commit 3e2f685

Please sign in to comment.