Inspect Mono RPM Dependencies with mono-find-provides
mono-find-provides is a packaging helper: it reads file paths from standard input and prints RPM Provides entries, not a general inspection tool.
The route
Jump straight to the step you need, or tick off Done means at the end.
Allow about ten minutes for a local check. You do not need root for the examples below.
1. Confirm the installed helper
On this machine the command comes from mono-utils, version 6.8.0.105+dfsg-3.6ubuntu2. It is a Bash script whose input is the file list normally supplied by the RPM dependency generator.
$ command -v mono-find-provides
/usr/bin/mono-find-provides
$ dpkg-query -W -f='${Package} ${Version}\n' mono-utils
mono-utils 6.8.0.105+dfsg-3.6ubuntu2
$ file /usr/bin/mono-find-provides
/usr/bin/mono-find-provides: Bourne-Again shell script, ASCII text executable
The installed manual page is deliberately sparse and says to use the help switch, but the program accepts no documented command-line options. Do not spend time looking for a normal --help interface: --help, -h, help and --version are all treated as ordinary positional arguments and produce no output when standard input is empty.
Checkpoint
You have confirmed the executable and package version. If command -v finds a different copy, stop and inspect that copy before trusting the output below.
2. Supply a file list on standard input
The helper reads one path per input line and filters hard:
- Drops anything under
/usr/doc/or/usr/share/doc/. - Keeps only names ending in
.exeor.dll. - Then keeps only paths containing
/gac/,/Facades/or/4.5/.
That last filter is why a perfectly good DLL sitting somewhere else on disk produces no line at all. Test with a small, known list first:
$ printf '%s\n' \
/usr/lib/mono/4.5/mscorlib.dll \
/usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll \
/usr/lib/mono/4.5/Facades/System.Runtime.dll \
/usr/share/doc/mono-utils/README \
| mono-find-provides
mono(mscorlib) = 4.0.0.0
mono(System) = 4.0.0.0
mono(System.Runtime) = 4.1.0.0
The documentation path is ignored, and each remaining assembly is inspected with monodis --assembly. The output is shaped for an RPM dependency generator: the assembly name becomes the capability, its reported version becomes the value.
Checkpoint
Compare the number of output lines with the number of eligible, readable assemblies you supplied. A missing line means a path was filtered, the file is not an assembly, or the inspection command failed.
3. Use the helper in a packaging pipeline
An RPM build system normally pipes its package file list through standard input. You can reproduce that shape with a text file, but keep the list under review because every path triggers an assembly inspection:
$ find /path/to/staged-root -type f -print > /tmp/mono-file-list
$ mono-find-provides < /tmp/mono-file-list
mono(My.Library) = 1.2.3.0
The exact output depends on the staged tree and the installed assemblies, so treat that line as illustrative, not guaranteed. The helper does not write files or change the input list. Clean up when you are done:
$ rm /tmp/mono-file-list
Safety warning
Do not redirect output over a package manifest or generated build file unless you have deliberately chosen that replacement. Write to a temporary destination first when another tool will consume the result.
4. Inspect a staged root with prefix
The script defaults to prefix=/usr, and builds libdir, bindir, LD_LIBRARY_PATH and MONO_PATH from that prefix. Point it at a staged installation for a packaging build:
$ printf '%s\n' /tmp/package-root/usr/lib/mono/4.5/My.Library.dll \
| prefix=/tmp/package-root/usr mono-find-provides
mono(My.Library) = 1.2.3.0
That only works when the staged prefix has a usable bin/monodis and lib/libmono-2.0.so.1. On this host, prefix=/tmp/fake produces monodis missing or unusable, exiting... on standard error and status 1: the helper does not silently fabricate a Provides line when its runtime tools are missing.
Keep the prefix assignment attached to this one invocation. An exported prefix in a wider shell session can affect unrelated packaging commands.
5. Disable automatic Mono Provides when required
Set DISABLE_MONO_RPM_AUTO_DEPS to any non-empty value and the helper exits immediately with status 0 and no output:
$ printf '%s\n' /usr/lib/mono/4.5/mscorlib.dll \
| DISABLE_MONO_RPM_AUTO_DEPS=1 mono-find-provides
$ printf 'status: %s\n' "$?"
status: 0
This is a packaging policy switch, not a diagnostic mode: it suppresses the generated capabilities, so only use it when the surrounding RPM configuration is meant to replace or disable Mono's automatic dependencies. Unset it to get normal behaviour back:
$ unset DISABLE_MONO_RPM_AUTO_DEPS
6. Diagnose empty or failed output
Start with the input stream, not with sudo. Empty output is expected for documentation paths, names without the recognised suffix, and assemblies outside the three accepted directory patterns. Check the paths without touching them:
$ printf '%s\n' /path/to/file.dll | grep -Ev '/usr/doc/|/usr/share/doc/'
$ test -r /path/to/file.dll && echo readable
$ test -x /usr/bin/monodis && echo monodis-ready
$ test -f /usr/lib/libmono-2.0.so.1 && echo libmono-ready
If the final two checks fail, install or repair the package that supplies the Mono utilities through your normal administration process. Elevated privileges only matter for that package repair, never for running a readable file list through the helper.
Checkpoint
A successful status 0 means the script completed its loop, not that every input path was eligible or that every assembly produced a capability. Check the actual lines before they reach the next RPM stage.
Done means
- Confirmed the installed package and version.
- Supplied one file path per line on standard input.
- Accounted for the suffix, directory and documentation filters.
- Checked
monodisandlibmono-2.0.so.1before diagnosing a staged-prefix failure. - Treated
DISABLE_MONO_RPM_AUTO_DEPSas a deliberate packaging policy change. - Verified the generated
mono(name) = versionlines before another tool consumed them.