When I install the lua5.2 package on Ubuntu 16.10:

sudo apt-get install lua5.2

it installs /usr/bin/lua as a symlink to /etc/alternatives/lua-interpreter, which in turn is a symlink to `/usr/bin/lua5.2.

When I install the lua-5.3 package, it doesn't create the symlinks; I only get /usr/bin/lua5.3.

The output of dkg -L lua5.X, which lists the files owned by the package, is identical (aside from version numbers on some files) for the lua5.2 and lua5.3 packages.

What I want to do is just install the latest and greatest version of Lua, which is currently 5.3, and be able to use #!/usr/bin/lua in scripts.

I know I can work around this by creating the symlinks manually or by using the update-alternatives command (which I haven't yet figured out, but that's not what I'm asking about).

My question is, why does the lua5.3 package not set up the /usr/bin/lua symlink when I install it, while the lua5.2 package does? Is this deliberate, perhaps an Ubuntu policy, or is it just an oversight by the people who created the package?

2 Answers 2


This is still an issue in 18.04 Bionic. Workaround:

sudo update-alternatives --install /usr/bin/lua lua-interpreter \
/usr/bin/lua5.3 130 --slave /usr/share/man/man1/lua.1.gz \
lua-manual /usr/share/man/man1/lua5.3.1.gz

sudo update-alternatives --install /usr/bin/luac lua-compiler \
/usr/bin/luac5.3 130 --slave /usr/share/man/man1/luac.1.gz \
lua-compiler-manual /usr/share/man/man1/luac5.3.1.gz
  • 1
    Thanks. Your workaround also works on Ubuntu 20.04 LTS.
    – SebMa
    Jun 16, 2021 at 10:32

Because the package maintainer didn't provide the alternatives infrastructure. Unfortunately no way around it but to set it up manually or just plain symlink /usr/bin/lua to /usr/bin/lua5.3.

I've submitted a bug report: https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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