disable the desktop when rebooting

I have installed R28.2 on my TX2 board. The version of Gstreamer is 1.8.3 and the version of ubuntu is 16.04. I want to disable the desktop when rebooting. I have tried these two instructions:
sudo systemctl stop lightdm.service sudo systemctl mask lightdm.service
But it doesn’t work when rebooting. What is the problem? Thank you very much.

Try this:

sudo systemctl disable lightdm.service

(reverse is just “enable” instead of “disable”)

If that fails, try this, but save a copy of any existing file prior to the change:

sudo echo "manual" > /etc/init/failsafe-x.override
sudo echo "manual" > /etc/init/lightdm.override

Thank you. It works for me:
sudo systemctl disable lightdm.service
sudo chmod -x /usr/sbin/lightdm