Installing as non-root user

The place to discuss linux version of MakeMKV
Post Reply
camjac251
Posts: 4
Joined: Sun Jan 31, 2016 8:17 pm

Installing as non-root user

Post by camjac251 » Sun Jan 31, 2016 8:27 pm

I am on a shared Debian 8 system with a Chrooted user. I wanted to be able to install makemkvcon so I can use the command line from my jailed user but have been getting some errors.

I configured makemkv-oss with "./configure --prefix=$HOME --disable-gui" and then ran make && make install. Afterward I'd open the makemkv-bin folder and change the prefix in Makefile to my full $HOME path, then run make && make install. When I tried to use makemkvcon though I got this error "./makemkvcon: error while loading shared libraries: libmakemkv.so.1: cannot open shared object file: No such file or directory"

libmakemkv.so.1 did exist in my user's home folder under ~/lib but it wasn't detected. Also I must add that ldconfig didn't work when compiling makemkv-oss, so I removed the line and ran make && make install again without issue.

I'm guessing makemkvcon has it's shared libraries hardcoded in, so it'll always look in /usr/lib instead of ~/lib or ~/usr/lib?

Could this be changed? I'd very much like to use it in this environment.

sebekk23
Posts: 4
Joined: Fri Jan 30, 2015 5:29 pm

Re: Installing as non-root user

Post by sebekk23 » Tue Feb 02, 2016 5:02 pm

Bump - it will be great option.

Woodstock
Posts: 5621
Joined: Sun Jul 24, 2011 11:21 pm

Re: Installing as non-root user

Post by Woodstock » Tue Feb 02, 2016 10:54 pm

I would think the biggest obstacle to installing as a non-root user would be the same as non-admin users on Windows and OS X.... permissions when talking to the hardware. MakeMKV needs to talk directly to the drive for some operations, and that is normally prohibited to non-root users, for obvious security reasons.
How to aid in finding the answer to your problem: https://www.makemkv.com/faq/item/8

camjac251
Posts: 4
Joined: Sun Jan 31, 2016 8:17 pm

Re: Installing as non-root user

Post by camjac251 » Thu Feb 04, 2016 3:32 am

Woodstock wrote:I would think the biggest obstacle to installing as a non-root user would be the same as non-admin users on Windows and OS X.... permissions when talking to the hardware. MakeMKV needs to talk directly to the drive for some operations, and that is normally prohibited to non-root users, for obvious security reasons.
You can also have it use a directory instead or an iso, which makes it easier for me since I could run a command like this

Code: Select all

makemkvcon mkv --progress=-same file:"/folder/name/something" all "/folder/name/something"

camjac251
Posts: 4
Joined: Sun Jan 31, 2016 8:17 pm

Re: Installing as non-root user

Post by camjac251 » Fri Feb 12, 2016 6:35 am

Will it become possible one day?

fallenguru
Posts: 3
Joined: Thu Mar 31, 2016 11:57 am

Re: Installing as non-root user

Post by fallenguru » Thu Mar 31, 2016 12:25 pm

It's possible now, from memory:

1) oss part
Call configure with --prefix=$HOME.
Comment out the call to ldconfig in the Makefile (it would require root).
$ make
$ make install
$ export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH"

2) closed part
Edit the Makefile to say PREFIX=$HOME instead of PREFIX=/usr (it's close to the top).
$ make
$ make install

3) misc stuff
You probably want $HOME/bin in your PATH, the right place to do that is distro-dependent.
Since you can't install the libraries to a system location nor tell ld about it, LD_LIBRARY_PATH must contain $HOME/lib for the binaries to work. In theory, it's an environment variable like PATH, in practice setting it permanently can be a challenge, as it's sometimes *unset* for security reasons, e.g. for X sessions of Debian based distros. You can always run ' export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH" ' again, if it isn't there (check using env).

camjac251
Posts: 4
Joined: Sun Jan 31, 2016 8:17 pm

Re: Installing as non-root user

Post by camjac251 » Wed Apr 25, 2018 3:53 pm

I have a working script now for installing makemkvcon on linux through a user (requiring no sudo access)

It is based on the script by mdPlusPlus who based their script on thisisaname
Credited you two in the script itself as well. Also credited you fallenguru. Without your help this wouldn't have been possible.

If anyone would like to use this, it's very useful as it can be used to automatically install (or reinstall if updating) makemkvcon on linux with a regular user.

install_makemkv.sh

Code: Select all

#!/bin/bash
# set -x #Uncomment to see the commands being executed
##Based on https://gist.github.com/mdPlusPlus/b110cad4cdd920950c10dc6b5bce4dc6
##Original from here: https://www.makemkv.com/forum2/viewtopic.php?f=3&t=5266&start=30#p56468
##Credit to mdPlusPlus and thisisaname for scripts, fallenguru for non root steps.
build_dir="$HOME/.tmp/build-makemkv"
build_log="$HOME/.tmp/makemkv_install.log" # Keep this outside of your build_dir as it gets removed at the end of the script.
url_ffmpeg_releases="https://www.ffmpeg.org/releases/"
url_makemkv="http://makemkv.com/download/"
url_makemkv_serial="http://www.makemkv.com/forum2/viewtopic.php?f=5&t=1053"
serial_makemkv=$(curl -s4 --url ""${url_makemkv_serial}"" | grep -oP 'T-[\w\d@]{66}')
vers_ffmpeg=$(curl -s4 "${url_ffmpeg_releases}" | egrep -o 'ffmpeg-([0-9]{1,}\.)+[0-9]{1,}' | sort -t. -rn | head -n 1)
vers_makemkv=$(curl -s4 "${url_makemkv}" | grep -oP '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1)

if [ -z "$url_ffmpeg_releases" ] || [ -z "$url_makemkv" ] || [ -z "$url_makemkv_serial" ] || [ -z "$serial_makemkv" ] || [ -z "$vers_ffmpeg" ] || [ -z "$vers_makemkv" ]; then
    echo "ERR: Uh-oh, looks like one of the URLs has changed and the curls were no good. Aborting..." | tee -a "$build_log"
    exit
fi

echo "INFO: See $build_log for details...."
mkdir -p ${build_dir} | tee -a "$build_log"

if [ ! -d "$build_dir" ]; then
    echo "ERR: Seems like you don't have permission to .tmp. Aborting.." | tee -a "$build_log" 
    exit
fi

cd ${build_dir}
echo "INFO: Downloading latest ffmpeg and makemkv from source." | tee -a "$build_log"
wget "${url_ffmpeg_releases}${vers_ffmpeg}.tar.bz2" -O "${vers_ffmpeg}.tar.bz2" | tee -a "$build_log"
wget "${url_makemkv}makemkv-bin-${vers_makemkv}.tar.gz" -O "makemkv-bin-${vers_makemkv}.tar.gz" | tee -a "$build_log"
wget "${url_makemkv}makemkv-oss-${vers_makemkv}.tar.gz" -O "makemkv-oss-${vers_makemkv}.tar.gz" | tee -a "$build_log"

echo "INFO: Extracting archives." | tee -a "$build_log"
tar xvf ${vers_ffmpeg}.tar.bz2 | tee -a "$build_log"
tar xvf makemkv-bin-${vers_makemkv}.tar.gz | tee -a "$build_log"
tar xvf makemkv-oss-${vers_makemkv}.tar.gz | tee -a "$build_log"

echo "INFO: Building ffmpeg." | tee -a "$build_log"
cd ${build_dir}/${vers_ffmpeg}
PKG_CONFIG_PATH="${build_dir}/ffmpeg_build/lib/pkgconfig"
echo "INFO: Configuring ffmpeg." | tee -a "$build_log"
./configure --prefix="${build_dir}/ffmpeg_build" --extra-cflags="-I${build_dir}/ffmpeg_build/include" --extra-ldflags="-L${build_dir}/ffmpeg_build/lib" --enable-static --disable-shared --enable-pic | tee -a "$build_log"
echo "INFO: Installing ffmpeg." | tee -a "$build_log"
make -j `getconf _NPROCESSORS_ONLN` install | tee -a "$build_log"
 
echo "INFO: Building makemkv-oss." | tee -a "$build_log"
cd ${build_dir}/makemkv-oss-${vers_makemkv}
sed -i '/ldconfig/d' Makefile.in
PKG_CONFIG_PATH={build_dir}ffmpeg/lib/pkgconfig ./configure --prefix=$HOME --disable-gui
echo "INFO: Making makemkv-oss." | tee -a "$build_log"
make -j `getconf _NPROCESSORS_ONLN` | tee -a "$build_log"
echo "INFO: Installing makemkv-oss." | tee -a "$build_log"
make -j `getconf _NPROCESSORS_ONLN` install | tee -a "$build_log"
export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH"
cd ${build_dir}/makemkv-bin-${vers_makemkv}
echo "Auto Accepting License Agreement" | tee -a "$build_log"
mkdir tmp
echo -n accepted >tmp/eula_accepted
echo "INFO: Making makemkv-bin." | tee -a "$build_log"
sed -i "s|/usr|${HOME}|" Makefile
make -j `getconf _NPROCESSORS_ONLN` | tee -a "$build_log" 
echo "INFO: Installing makemkv-bin." | tee -a "$build_log"
make -j `getconf _NPROCESSORS_ONLN` install | tee -a "$build_log"

echo "INFO: Testing makemkv binary." | tee -a "$build_log"
if [ ! -f "$HOME/bin/makemkvcon" ]; then
    echo "ERR: Missing $HOME/bin/makemkvcon, better check the logs. Aborting.." | tee -a "$build_log"   
    exit
fi

echo "INFO: Registering MakeMKV with latest beta key for you." | tee -a "$build_log"   
echo "INFO: Current key $serial_makemkv" | tee -a "$build_log"   
mkdir -p $HOME/.MakeMKV/
echo "app_Key = \"$serial_makemkv\"" > $HOME/.MakeMKV/settings.conf
cd $HOME/.tmp
echo "INFO: Cleaning up build directory" | tee -a "$build_log"
rm -rf "$build_dir"
echo "If you haven't already, make sure that these two lines are in your .bashrc file.
LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH"
echo "INFO: Exiting."
exit

Post Reply