The very weird Hewlett Packard FreeDOS option

The very weird Hewlett Packard FreeDOS option

In this installment: some strange things I discovered when purchasing a FreeDOS laptop from Hewlett Packard. I suspect that the audience for this will be somewhat limited but I had fun exploring this. Perhaps you, dear reader, will find a chuckle in here too.

Some background: I recently purchased a HP ZBook 17.8 G8 as I run Fedora Linux I decided to have a little fun with the OS selection and picked the FreeDOS option (Other options include Ubuntu, and various flavors of Windows 11).

And! Sure enough: After unpacking and plugging in the laptop I was greeted by the following.

The out of the box FreeDOS experience of the HP Zbook Fury 17.8 G8

Apart from this appearing to be a very old version of FreeDOS the primary thing I noticed was how long it took to get to this point. I was also fairly sure that I saw something flash during boot which looked suspiciously like some Linux kernel boot messages. I saved whatever was on the hard drive from the factory to some image files before installing Fedora Workstation.

From the factory HP included three partitions:

None of this appears terribly DOS-sy. It appears that HP is actually shipping a Linux and then running DOS in a VM. Let’s try to boot this whole thing in a VM and see what we get.

Booting the image in a VM
Screenshot_HPDOS_2022-05-15_170432
Screenshot_HPDOS_2022-05-15_170816
Screenshot_HPDOS_2022-05-15_17:12:12
Screenshot_HPDOS_2022-05-15_17:12:21
Booting the image in a VM Screenshot_HPDOS_2022-05-15_170432 Screenshot_HPDOS_2022-05-15_170816 Screenshot_HPDOS_2022-05-15_17:12:12 Screenshot_HPDOS_2022-05-15_17:12:21

As the eagle eyes of you might have noticed the “HP Documentation” link appears to start some kind of PDF reader. The document at the end starts with the following:

Very limited indeed

It seems that although this computer did indeed not ship with a Windows ® operating system it shipped with at a minimum two others. I say at a minimum because there’s actually THREE operating systems shipped on this machine!

What was in the factory image

Now that we’ve seen what the factory image does let’s have a look at how it does it. First of all: What are we booting?

# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

So it appears we got a Debian GNU/Linux 9 installation on the hard drive. After some poking around I have found the following:

  • The laptops is set to UEFI boot, which boots a pretty standard GRUB
  • Debian gets booted with KMS disabled, as well as all DRM drivers.
  • Once the system is booted Gnome Display Manager starts
  • GDM will automatically login the root user and start the /root/.xsession
  • The XSession will start an XFCE terminal and executes Qemu on an image file in /home/aos/qemu

The actual /root/.xsession is copied below:

#!/bin/bash

xfce4-terminal --zoom=-7 --geometry=1x1 --fullscreen --hide-toolbar --hide-menubar --hide-scrollbar --hide-borders -e "bash -c 'sleep 2 && xdotool search --name QEMU windowsize 100% 100% && xdotool search --name QEMU windowsize 100% 100%  && xdotool search --name QEMU windowsize 100% 100%  && xdotool search --name QEMU windowsize 100% 100% &  qemu-system-x86_64 -smp cores=8 --enable-kvm -m 2048 -vga cirrus -hda /home/aos/qemu/freedos.img -usbdevice tablet -usb -device usb-host,hostbus=2,hostaddr=1 -monitor telnet:127.0.0.1:9378,server,nowait && poweroff -f  ; exec bash'" >/dev/null 2>&1
poweroff -f
#xfce4-terminal --fullscreen --hide-toolbar --hide-menubar --hide-scrollbar --hide-borders

This is an… interesting approach, probably necessary because no window manager is started in the X session. Xdotool is used in this case to repeatedly try to resize the Qemu window until it covers the entire X session. Apparently after testing just doing it three times was “good enough”

What this basically does is the following:

  • Start an XFCE terminal hiding all of its UI
  • Start a 2 second timer and wait
  • At the same time start a Qemu virtual machine
  • Once the 2 second time is up search for the Qemu window and try to resize it to fill the screen. Do this three times in case one of them fails?
  • Once Qemu exits shutdown the computer

More questions than answers

At this point it is worth mentioning that the FreeDOS/HP Documentation menu is running inside the Qemu VM. The “real” bootloader (grub) does not have its menus enabled and just always boots straight into the Debian 9 installation on the hard drives.

What is this “HP Documentation” thing then. Did they package a DOS PDF reader? Well, only one way to find out. We have to go ONE LEVEL DEEPER (into /home/aos/qemu/freedos.img)

# fdisk -l freedos.img 
Disk freedos.img: 2 GiB, 2150400000 bytes, 4200000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device       Boot   Start     End Sectors  Size Id Type
freedos.img1         2048 2007039 2004992  979M  b W95 FAT32
freedos.img2 *    2007040 4192255 2185216    1G  b W95 FAT32

So it seems we have two partitions… Wait is there a C: and a D: drive in here?

Remember how I said there’s three operating systems on this machine? I lied: There’s four. The freedos.img file actually contains TWO separate FreeDOS installations however both are the exact same version.

Imageception: What is in freedos.img

After extracting the contents of the two FAT32 partitions I found the following:

  • The image contains an installation of syslinux
  • Boot option one is a chain boot into FreeDOS on the first partition
  • Boot option two boots another Linux from the second partition
label dos
        menu label ^FreeDOS
        menu default
        com32 chain.c32
        append hd0 1

label live
        menu label ^HP Documents
        kernel /live/vmlinuz
        append initrd=/live/initrd.img boot=live config homepage=file:///hpdocs/platform_guides/languages/index.html nonetworking nopersistent quickreboot nomodeset radeon.modeset=0 nouveau.modeset=0 i915.modeset=0 username=webc video=vesa apm=off novtswitch pnpbios=off acpi=off nomce loglevel=3 libata.force=noncq quiet splash noroot novtswitch

This Linux appears to live in /live and it has a squashfs root filesystem. So… let’s have a poke at that too. This file is located on partition two in /live/filesystem.squashfs no points for originality there.

Most of the files in this filesystem seem to date back several decades so no convenient /etc/os-release file for us there. But we DO get an /etc/debian_version, there is no ubuntu_version so it appears that this is in fact Debian based.

# cat debian_version 
6.0.3

It appears we have a 32bit Debian 6.0.3 installation. Judging by the release notes this release is from October 8th, 2011.

Down, down, down we go

It appears we have another image to dissect. This time the Debian 6.0.3 installation which shows us that helpful PDF telling us the PC is useless in its factory configuration. After looking through the various startup options the image appears to be doing the following:

  • We boot Debian more-or-less like normal, disabling all hardware accelerated video outputs and switching to the VESA driver.
  • There’s an /etc/rc.local file which attempts to locate a partition labeled HPDOCS and mounts it on /hpdocs. If it can’t locate this it mounts whatever happens to be /dev/sda1 on /hpdocs
  • Start a service called “Webconverger”, this is apparently an old style “turn Debian into a web kiosk” project. (Archive.org link)

Webconverger does a couple more things

  • Configures an X server
  • Sets iceweasel‘s homepage to the value from the pxelinux configuration above
  • Set audio volume control to 100% (auch)
  • Sleep 10 seconds, then switch between virtual terminal 1 and 2

Summary

When ordering a HP machine with FreeDOS what you are getting is the following:

  • A Linux installation on the “bare metal” which boots a VM
  • This VM boots either an old version of FreeDOS or
  • An old version of Linux in a kiosk mode

Conclusions, such as they are

It doesn’t seem likely that the FreeDOS image as provided is actually good for anything. I didn’t really expect it to be but I was kind of hoping to install Duke Nukem 3D on “bare hardware” on a factory OS.

Based on the dates and how this is put together I assume that the contents of freedos.img are what used to be shipped on the real hardware. When NVME drives and other modern hardware features became the norm I suspect that this just didn’t work any longer. Instead of updating the image a VM layer was put in and the old factory image simply got included in the new one. It’s not a terrible solution really.

Someone at HP really needs to learn about what Window managers are for on X11, however, they could have saved themselves a lot of headaches. If anyone wants to build a system like this send me an email, I’m sure we can work something out 🙂

To round out this review below you will find some videos of the various boot options that shipped with the PC.

Booting the original image into DOS
Booting the original image into the Documentation page

2 comments on “The very weird Hewlett Packard FreeDOS option

  1. Hi

    I guess that some of the problems HP has is that he ships a nice, full, working Linux with their cheap “OSless” machine they will have to support them. Include full graphics OSes like Linux, ReactOS, ArcaOS, Windows, and even including a full working FreeDOS for free will guarantee you phone support calls from customers. Since they ship it with a very basic FreeDOS image I guess the strategy is that 99% of the customers just wipe them out to install the OS, but thanks for being the 1% and creating this great article !!!

    Long live FreeDOS – https://www.freedos.org/
    Long Live OS/2 – https://www.arcanoae.com/arcaos/

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.