To install the virtualbox extension pack on a headless machine, I needed to run the virtualbox gui app as root via sudo. This did not pass authentication through and X11 failed. Solution was found at the link below.
X11 connection rejected because of wrong authentication.The error
xauth merge /home/<USER>/.XauthorityThe solution