[Libguestfs] [PATCH] inspect: use /etc/hosts for detecting Linux root (RHBZ#1203898)

Pino Toscano ptoscano at redhat.com
Wed Feb 24 17:09:56 UTC 2016


On Wednesday 24 February 2016 20:05:35 Roman Kagan wrote:
> On Wed, Feb 24, 2016 at 03:43:40PM +0100, Pino Toscano wrote:
> > Use /etc/hosts instead of /etc/fstab to detect whether a partition
> > represents the root of a Linux installation; the latter might not exist
> > in smaller/special installations like Docker images.
> 
> IMHO /etc/hosts is just as unreliable as /etc/fstab.
> 
> I'd rather test for /bin/sh being present and being an ELF executable or
> shared object.

That won't work with recent Fedora/RHEL/CentOS systems due to the
UsrMerge: if /usr is in a separate partition, /bin/sh "exists" there
too, and thus that partition would be detected as root.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160224/d6e31ca3/attachment.sig>


More information about the Libguestfs mailing list