I'm not sure if this is a bug or I've done something wrong (or I simply don't know luatex well enough). This minimal example file test.tex

\documentclass{article}
\usepackage{luacode}

\begin{document}
A random number:
\begin{luacode}
  tex.print(math.random())
\end{luacode}
\end{document}

Should compile with lualatex test.tex but fails with:

! LaTeX Error: File `luacode.sty' not found.

It sounds like something was messed up in the installation of luatex. They look to be installed:

> dpkg --get-selections | grep luatex
luatex                  install
texlive-luatex          install

The file exists on my system:

> locate luacode.sty 
/usr/local/texlive/2011/texmf-dist/tex/lualatex/luacode/luacode.sty

so I'm not how to troubleshoot this. Is the package messed up or is it a problem on my end?


The path /usr/local/texlive... indicates that you've mixed up Ubuntu packages and TeXLive from source (upstream).

Don't do this.

lualatex isn't looking for the file in that location. Install texlive-luatex now properly (possibly apt-get install --reinstall).