[Linux] Running muse hub with reduced privileges
I'm writing this post as a community service. As many here, I'm both dumbfounded and annoyed with MuseHub, which seems to want root access to my system a little too much. So I did some shenanigans, and now I can run it as a (mostly) unprivileged user. And you can too!
So unpack the deb file and plop the ./opt
dir somewhere. I've just put it into /opt
, but you can actually put it wherever AFAICT. Don't bother with stuff in ./usr
, it's mostly useless, and arguably harmful (like the always-enabled systemd service)
So there are two executables you want:
- /opt/muse-hub/Muse.Service
- /opt/muse-hub/Muse.Client.Linux
chmod +x
both of those if they aren't (they might not be depending on how you unpacked the deb).
The service executable seemingly runs a raw kernel syscall getuid (probably a quirk of .NET), and exits if it's anything but 0. So unfortunately, things like fakeroot
won't work. Thankfully, we have namespaces on Linux, so that's easy to fix. Here is a bash script: https://gist.github.com/lierdakil/08d9171abf6133db0411e6f464fc0484 (if you didn't put the files into /opt
, adjust the path to the executable)
Basically, this script starts a shell in a new user namespace (using unshare
), then maps uid 0 to the current user, then starts the service.
Note that the service thing wants to write to /srv/muse-hub/
so you'll have to do something about that. I would suggest symlinking a new directory from your home directory to /srv/muse-hub
.
Run the script from a terminal, which should start the service, then run /opt/muse-hub/Muse.Client.Linux
.
Download whatever you want to download. The thing will also try to silently download and shove the "musesampler" lib into your /usr/lib
, but since it doesn't have write permissions, it'll show an error mesage. Sound libraries download fine regardless, so ignore that for now.
After you've downloaded everything you wanted, you'll have to come back to "musesampler".
Suppose that you've linked ~/muse-hub
to /srv/muse-hub
. Now you have ~/muse-hub/downloads/Installers/8c14fcf0-f06a-40a7-a530-227eb382c84a/musesampler-linux-0.3.2.18.tar.zip
. (the guid or version may differ). It's actually a gzipped tar, despite the extension, and should contain libMuseSamplerCoreLib.so
. So tar ztf
it to make sure it doesn't contain anything extra and extract it wherever you prefer.
Since libMuseSamplerCoreLib.so
isn't plopped into your /usr/lib
(and even if it is, it might not be loaded -- no idea why), MuseScore itself won't be able to find it. But you can just preload it with LD_PRELOAD
: env LD_PRELOAD=path/to/libMuseSamplerCoreLib.so path/to/MuseScore.AppImage
. You can also try setting MUSESAMPLER_PATH
instead of preloading -- in my experience preloading works better, but YMMV.
Finally, MuseSampler wants to know where the downloaded sound assets are located, that is, muse-hub/downloads/Instruments
. MuseHub would've written the path into /var/lib/MuseSampler/.config
, but you can just set MUSESAMPLER_INSTRUMENT_FOLDER
environment variable to point there instead (so e.g. if the main MuseHub directory is in ~/muse-hub
, set MUSESAMPLER_INSTRUMENT_FOLDER=$HOME/muse-hub/downloads/Instruments
)
And there you have it, Muse Sounds work, and you didn't have to run anything particularly suspicious as root, let alone install a closed-source system-wide service with torrent-like functions and gods know what security vulnerabilities.
Hopefully this is useful to someone.
Comments
That's a nice display of hacking and digging skills!
You can also set the
MUSESAMPLER_PATH
environment variable to set the path to thelibMuseSamplerCoreLib.so
. The service also wants access to the/var/lib/MuseSampler/
directory, so you’ll have to make a symlink for that, too.In reply to You can also set the… by bb94
Right, forgot about that, thanks. You don't actually have to symlink, the only requirement is that
/var/lib/MuseSampler/.config
exists and contains the path to theInstruments
directory in muse-hub downloads. You could also setMUSESAMPLER_INSTRUMENT_FOLDER
environment variable.Thanks!
This looks useful and I may come back here to try it out later. For now, I have stopped and disabled MuseHub.service.