After the installation of ubuntu 18.04, I get trapped in a login loop. Then I found a solution online:
sudo add-apt-repository ppa:bumblebee/stable
sudo apt-get update
sudo apt-get install bumblebee bumblebee-nvidia
Voila! I logged in, and I found that the keyboard and mouse is unusable after logging in.
This is the solution to solve this:
sudo apt install xserver-xorg-input-all