3

When one tries to dual-boot a Linux distro (say Ubuntu) with a pre-existing install of Windows or other OSs, the installer detects the presence of the other OS.

I want to know how an installer does it.

I did my research and found packages like os-prober and debian-installer which can be used to do this.

I would like to know how they work without getting into too many details.

John
  • 219
gokul_uf
  • 141

3 Answers3

3

On this page about os-prober I could find the following sentence: The program Josh Kwan and I developed for d-i to do this is quite flexible, new OSes and linux distros can be added by just dropping in a test file to check for them. It's fairly good at probing all the info needed to boot some installation of linux (the root, and /boot partitions, a kernel, an initrd, and kernel parameters). Since every version of linux does things slightly differently, this is no mean feat, techniques used include parsing /etc/fstab, rummaging around in /boot, parsing grub menu.lst files, etc.

I think that these applications first check information that is connected with the disk layout (for example entries from a MBR or EFI system partition or another example: it might recognise a NTFS-formatted partition as part of Windows) and then they mount relevant partitions and try to check for some other characteristics (for example CentOS includes a file called /etc/centos-release).

Jannis
  • 136
  • 4
1

e.g. os-prober on linux does access a wide variety of information about the

  • available storage controllers
  • bootable disks
  • partitions/volumes on them
  • layers of abstraction used to access them

And finally, the partition and file-system labels, types and IDs.

Some are well know to be able to contain "foreign" operating systems, and are then further checked for well-known boot-loader or operating system specific startup files. Names can then usually also be extracted from known places, or inferred.

0

This is not a kind of 'automatic' detection - it is configured in the configuration of boot loader.

A Bootloader is for example GRUB https://en.wikipedia.org/wiki/GNU_GRUB