At work I have set up a little backup script on my Ubuntu 14.04.1 machine. The script backs up my machine to an external hard drive. After this is done it copies a LaTeX project to my Dropbox and compiles it. This project is some kind of a logbook of my work.I know this is a rather unconventional use case and I could just copy the source or push it to a git repo but first of all git would be a bit of an overkill and second of all there were already two instances where I was glad for having it in pdf form on my mobile when I had to start up a tty shell because gnome wouldn't start up.The problem now is that for some reason both pdflatex and lualatex tell me that they can't find the .sty files. The backup script is the following:#!/bin/bash# .... some system backup code ....## sync linux setup document to Dropbox# remove .pdf in order to guarantee that project is compiledrm /home/user/Documents/LaTeX/logBook/logBook.pdf# compile project in origin make -C /home/user/Documents/LaTeX/logBook/ >> /home/user/Documents/LaTeX/logBook/makeLog# copy files to destinationcp -rp /home/user/Documents/LaTeX/logBook/ /home/wright/DropboxAnd my Makefile contains the following lines:SHELL=bashTARGET=linuxSetup.pdfFLAGS= --shell-escapeSRC= ./*.tex ./header/*.tex  ./chapters/*.tex ./references/*.bib ./titlepage/*.tex TIKZ= ./tikz/*.texLL= pdflatexall: $(TARGET)$(TARGET): $(TARGET:%.pdf=%.tex) $(SRC) $(TIKZ)    @$(LL) $(FLAGS) $<#   makeglossaries $(TARGET:%.pdf=%)#   makeindex -s headingsStyle.ist $(TARGET:%.pdf=%.idx)#   bibtex $(TARGET:%.pdf=%)    @$(LL) $(FLAGS) $<    @$(LL) $(FLAGS) $<The backup script is placed in /etc/init.d/backup and contains a symbolic link to /etc/rc0.d/S01Backup.The scripts are simple enough, yet they still won't find the .sty files. I tried excluding the .sty files to find out if the problem was caused by specific ones but regardless of how many I exclude there are always more that the compiler won't find. I switched the compiler yet that does not seem to be the issue either. And also I executed the complete backup script via sudo or as the root user, both of which worked perfectly fine without any errors.What am I missing?EDIT:Here is the last bit of the output:(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))(/usr/share/texlive/texmf-dist/tex/latex/cite/cite.sty)(/usr/share/texlive/texmf-dist/tex/latex/mh/empheq.sty(/usr/share/texlive/texmf-dist/tex/latex/mh/mhsetup.sty)(/usr/share/texlive/texmf-dist/tex/latex/mh/mathtools.sty(/usr/share/texlive/texmf-dist/tex/latex/tools/calc.sty)))(/usr/share/texlive/texmf-dist/tex/latex/etex-pkg/etex.sty)(/usr/share/texlive/texmf-dist/tex/latex/fancybox/fancybox.styStyle option: `fancybox' v1.4 <2010/05/15> (tvz)) (/usr/share/texlive/texmf-dist/tex/latex/float/float.sty)! LaTeX Error: File `floatflt.sty' not found.Type X to quit or <RETURN> to proceed,or enter new name. (Default extension: sty)Enter file name: The floatflt.sty file in question is located in the texlive install directory /usr/local/texlive/2015/texmf-dist/tex/latex/floatflt. The other packages that it did find above, however, are located in /usr/share/texlive/texmf-dist/tex/latex/<packagename>.
pdflatex/lualatex called from shutdown script can not find installed packages
bash;init.d;latex
You have two texlive installations. One by the system (Ubuntu) in /usr/share/texlive/ and on user-installed in /usr/local/texlive/2015/texmf-dist/tex/latex.In your shutdown script, the environment variables are not adapted, such that the wrong texlive installation is used.Try to call /usr/local/texlive/2015/bin/x86_64-linux/pdflatex directlyor adapt the PATH environment variable accordingly.There were some license problems with floatflt.sty in the past.This could be the reason, why it is not included in the texlive installation of Ubuntu. You could try to change to wrapfig.