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:


# .... some system backup code ....

## sync linux setup document to Dropbox
# remove .pdf in order to guarantee that project is compiled
rm /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 destination
cp -rp /home/user/Documents/LaTeX/logBook/ /home/wright/Dropbox

And my Makefile contains the following lines:

FLAGS= --shell-escape
SRC= ./*.tex ./header/*.tex  ./chapters/*.tex ./references/*.bib ./titlepage/*.tex 
TIKZ= ./tikz/*.tex
LL= pdflatex

all: $(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:

Style 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>.

  • Please edit your question and give us the full paths of the sty files that aren't found. Are they in system directories or in your LaTeX project dir?
    – terdon
    May 13, 2016 at 9:24
  • @terdon I added part of the output and the file locations above. It seems that the script does not find the packages located /usr/local/texlive/2015/texmf-dist/tex/latex/ directory, doesn't it? May 13, 2016 at 9:39
  • Where are you compiling? Is it on the same machine? Your scripts are only copying files from your project dir, so it doesn't touch the .sty files. Does your project compile correctly in /home/user/Documents/LaTeX/logBook/`? Are you compiling the Dropbox copy from another machine?
    – terdon
    May 13, 2016 at 9:43
  • you can use TEXINPUTS var to hold place to look for input.
    – Archemar
    May 13, 2016 at 9:49
  • @terdon I am compiling on the same machine as the source and destination folders are, yes. Also I tried compiling directly from inside the source and from inside the destination folder, with no differences in behaviour. May 13, 2016 at 10:28

1 Answer 1


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 directly or 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.

  • That was indeed the cause, it seems that the folder /usr/share/texlive was a leftover from apt-get remove. With apt-get purge the folder was deleted. Do you know why this only affected this script when executed during shutdown? I did call it from my user, from the root user and also via sudo, this problem only appeared during the shutdown process, even though this script is called at the very beginning when this runlevel is entered... May 13, 2016 at 10:32
  • 1
    @DavidWright The environment variables, especially PATH, could be different. Use something like export >> /path/to/a/log/file in your bash script to check them.
    – jofel
    May 13, 2016 at 12:46

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.