Extracting msi files using Linux

23

2

Related: How to extract files from MSI package?

To extract the contents of a MSI installer using Linux, I can either use msiexec with wine or use 7zip.

However, the latter does not preserve directories and file names only in part. Is there any way to properly extract MSI files without having to use wine?


edit: to illustrate the issue with Microsoft's Infer.NET, here is a list of files that 7zip produces and here one that msiexec produces (where the latter is what I want)

Michael Schubert

Posted 2012-05-23T16:00:01.767

Reputation: 540

You can use this article for Ubuntu hope it will help you. And also try Jsmsix.exe.

– avirk – 2012-05-27T02:55:20.883

Thanks, I already read the article and it does not resolve the 7zip issues (neither in combination with e.g. cabextract). Jsmsix would still require wine because you can't run Windows executables natively. – Michael Schubert – 2012-05-28T12:33:52.417

What issue you are facing with 7zip can you explain? – avirk – 2012-05-29T01:30:16.220

added an example – Michael Schubert – 2012-05-29T12:13:14.647

Dumb question but: What's wrong in using wine? – Pitto – 2012-05-30T16:25:58.483

2What I'd like to do is create a buildscript for Archlinux, for which a set up wine is quite a bulky dependency just to be able to install something that should depend solely on mono. – Michael Schubert – 2012-05-30T19:12:50.067

Did you try and use msiexec with wine? – happenpappen – 2012-05-31T18:33:38.850

Answers

9

While it won't help you immediately, lessmsi is working on a native Linux version. It preserves directory structure like you want, so it's worth checking up on if this is going to be a long-term issue for you. Unfortunately, .msi support on Linux seems pretty sparse, so lessmsi or msiexec through wine might be your only immediate option, even if (as you said) wine is a pretty heavy dependency for extracting archives.

ChimneyImp

Posted 2012-05-23T16:00:01.767

Reputation: 1 149

-1. Linux version still does not exist after many years, and since question was is there any way to properly extract MSI files without having to use wine, this is not the answer. I have used instead msiextract from msitools package (sudo apt install msitools in Ubuntu) as recommended in the answer by user2834. – Lissanro Rayen – 2019-05-14T00:02:01.590

That indeed seems to be the best solution, using wine and waiting for lessmsi for Linux. – Michael Schubert – 2012-06-03T17:27:08.573

4FYI: In the latest release of lessmsi I managed to move the cab extraction code over to libmspack which is a portable library that should run on linux too. So we did take a concrete step towards linux support recently. Soon I hope to use a portable msi lib, which will make everything portable. – Scott Willeke – 2013-02-05T18:40:24.333

19

Give msiextract a try, https://live.gnome.org/msitools

And open bugs!

user2834

Posted 2012-05-23T16:00:01.767

Reputation: 299

There is no package found for 14.04 and building it also need lot of tools / libs and skills. Giving up – harry – 2015-08-21T04:48:42.653

1

it's in debian, and ubuntu willy: https://launchpad.net/ubuntu/+source/msitools. You can then simply call "msiextract file.msi" and that's it, no more skills needed.

– user2834 – 2015-08-21T15:32:39.637

Works here, and preserves file names and paths. Thanks. – Simon A. Eugster – 2017-09-04T14:04:38.827

1

You can try software called cabextract - atleast Ubuntu has packages for it, I would expect it to be found from other popular distros as well.

Unksi

Posted 2012-05-23T16:00:01.767

Reputation: 92

The MSI format is multiple layers: at the top level it's a disk image, with data blocks scattered all around inside the .msi file. If you decode the disk image, it contains several files, including a .cab file, and database files. cabextract finds CAB file headers inside the .msi image, but as the full .cab file is not contiguous, it can't extract it. 7zip can extract the disk image and then the CAB file, but it doesn't know how to read the database files, which map the CAB file entries to their true installation paths, like lessmsi does. – Stuart Caie – 2015-03-23T09:59:03.487

4Thanks for the hint, but cabextract does not even partially conserve filenames and directories (so it performs worse than 7zip). – Michael Schubert – 2012-05-28T12:30:43.760