0

How can I find out if system is booted from PXE or from Local HDD or from any removable media ?

I want to write initramfs for a system which will function differently according to its boot method.

  • Examine where the root partition is mounted, I suppose. – muru Nov 9 '15 at 9:49
0

I would use the kernel command line (available at /proc/cmdline).

If the PXE vs local HDD (grub, lilo, extlinux) are not already different, then the PXE server could add an extra parameter that is never present in the local HDD boot. Also, the HDD boot-loader could introduce a parameter which would not be present on a removable media bootstrap.

Of course, this would not work if you are trying to detect an intentional unauthorized boot method, because the attacker would simply add the matching boot parameters, or just modify the initrd.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.