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?

  • This is a very well phrased question, but I wonder if this wouldn't be better suited for SO or Unix.SX. – Henri Menke May 13 '16 at 8:14
  • @HenriMenke Thanks, I thought about that as well, might post it there too... – David Wright May 13 '16 at 9:06

Turns out that there was still residue from my previous texlive installation that I made via apt repositories. There were texlive directories in /usr/share/texlive/ (from repositories) and /usr/local/texlive/2015/texmf-dist/tex/latex (user installed). The shutdown script apparently called the wrong compiler, which was the one /usr/share. When I uninstalled the repositories via apt-get purge, rather than apt-get remove this folder was deleted and everything worked perfectly fine with the installation in /usr/local.

| improve this answer | |

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.