I am planning to install some software on removable media (which will presumably always be present in the computer, though it's possible that there could be occasions where it is absent). After doing some research, I have seen three ways that seem to be preferable and also within my abilities:

  1. Having the installed files on the removable media and bind mounting their folders into the proper locations

  2. Having the installed files on the removable media and creating symlinks to the removable media; This could create a broken link if the media is removed. However, the media will usually be present and perhaps more importantly, there shouldn't be anything trying to access the folders other than the program (which wouldn't be run if the media is not present). For example, nothing should care if there is a broken link to the /var/lib/texmf folder of LaTeX.

  3. If building from source is an option, using ./configure --prefix=/path/to/media/ (or possibly similarly, dpkg -i --force-not-root --root=/path/to/media package.deb) Will there be issues with the programs not finding their dependencies which would be located on the system?

Are any of these methods obviously superior or inferior? Is there anything I'm missing? Are there any other comments?

EDIT: Most of the software I plan to install is for mathematics. The two primary programs are LaTeX and Sage. Since I had originally decided to attempt this, I realized that both of these programs can already be run locally (Sage, LaTeX) which kind of renders the point moot, but I'm still curious about the question (especially if "system integration", if you can call mounting/symlinking integrated, would work better), so I thought I would post it. I also thought I would give Mathematica a try, but wasn't sure if it would work due to licensing and such. MPI might be installed in the future; I guess mounting or compiling might be best to avoid a broken link.

  • Possibly this depends on the software being installed. Are you thinking about something in particular? – Sparhawk Dec 19 '15 at 6:02
  • 1
    I don't know if it will work (I guess it would be not enough for more complex applications), but you can give it a try: install software on your pendrive with respect to LSB and add /path/to/media/{bin|usr/local/bin|/usr/bin|/bin} to your $PATH. – patryk.beza Dec 19 '15 at 23:45

Martin Monperrus wrote a wonderfully quick guide to auto-mounting on Linux using the udev package. Here's a copy of the ussefull bits but be sure to check the comments there too

sudo nano /etc/udev/rules.d
# automounting usb flash drives 
# umask is used to allow every user to write on the stick
# we use --sync in order to enable physical removing of mounted memory sticks -- this is OK for fat-based sticks 
# I don't automount sda since in my system this is the internal hard drive # depending on your hardware config, usb sticks might be other devices than sdb* 
ACTION=="add",KERNEL=="sdb*", RUN+="/usr/bin/pmount --sync --umask 000 %k" 
ACTION=="remove", KERNEL=="sdb*", RUN+="/usr/bin/pumount %k" 
ACTION=="add",KERNEL=="sdc*", RUN+="/usr/bin/pmount --sync --umask 000 %k" 
ACTION=="remove", KERNEL=="sdc*", RUN+="/usr/bin/pumount %k"

Note the bits about KERNEL=="sdb*", and KERNEL=="sdc*", are relotive and you may wish to use UUID's to make sure that udev auto-mounts the correct drive to the correct directory path regardless of what USB port it gets re-plugged into. A quick search pulled up an Arch Linux forum post on using uuid instead of sdb* or sdc* error prone way of mounting. Once the drive auto-mounts properly then it should only require adding the proper export PATH=/mnt/media/some_usb/program/:$PATH line to the shell's enviroment variables so that the program can be called by name for that user.


For *.so search:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:your_lib_dir

For executable search:

export PATH=$PATH:your_executable_dir

I think this two environment variable is enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.