Tip: Ways to extract an ISO without needing root

Many different ways to do this in Linux as it turns out …

Of course I’d prefer you to use guestfish (based on this recipe):

$ guestfish --ro -a cd.iso -m /dev/sda tgz-out / cd.tar.gz

But it’s a bit slow perhaps (40 seconds to extract a 240 MB ISO on my machine). We don’t optimize libguestfs for file copying speed, more for awesome capabilities.

GNOME’s archive tool (file roller) can also open ISO files as non-root, but in fact it doesn’t do it directly, but uses an external program called isoinfo, part of cdrkit. isoinfo can only list files and extract a single file at a time:

$ isoinfo -i cd.iso -l
Directory listing of /
d---------   0    0    0            2048      0 1900 [     26 02]  . 
d---------   0    0    0            2048      0 1900 [     26 02]  .. 
d---------   0    0    0            2048 Feb  6 2010 [     27 02]  AMD64 
----------   0    0    0           61012 Feb  6 2010 [ 121118 00]  BOOT.;1 
----------   0    0    0             624 Feb  6 2010 [ 121148 00]  BOOT.CFG;1 
----------   0    0    0         5622126 Feb  6 2010 [ 121149 00]  NETBSD.;1 
$ isoinfo -i cd.iso -x /BOOT.CFG\;1
banner=Welcome to the NetBSD 5.0.2 installation CD

Amongst the libraries that can read ISO files it’s worth mentioning libarchive and libMirage. libarchive is used by BSD’s tar program, so on BSD tar can directly extract ISO files (and many other formats), which is a neat feature.

If you prefer to mount ISOs using FUSE (and thus still not requiring root), then there are two FUSE modules that can do this. Archivemount is the simplest, merely a small program that connects libarchive and FUSE. However archivemount isn’t packaged for Fedora and I wasn’t able to make it compile. FuseISO is an older package which does complete ISO decoding itself and seems to work as advertised:

$ fuseiso /tmp/cd.iso /tmp/cd
$ cd /tmp/cd
$ ls
amd64  boot  boot.cfg  netbsd


Filed under Uncategorized

4 responses to “Tip: Ways to extract an ISO without needing root

  1. Alexander Larsson

    Another way is to use gvfs: Just right click on the iso in nautilus and select “Open with Archive Mounter”, this will create a gvfs mount that should be availible on the desktop, the places menu, the nautilus sidebar, the gtk+ file selector, etc. You can also access it via fuse as “~/.gvfs/”. (ensure gvfs-archive is installed, but should be by default)

    The gvfs backend is based on libarchive too.

    • rich

      Is there a non-gooey way of doing this? We’re mainly interested in scripting things.

      • Alexander Larsson

        yes, “Archive mounter” is just a desktop file with:

        Exec=/usr/libexec/gvfsd-archive file=%u

        Where %u expands to the uri of the file

  2. Since this article was written, “fuseiso” has apparently been dropped from Fedora and “archivemount” is now an installable package.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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