Perhaps Ubuntu is going into sleep mode after a preset time, you cancheck this by going to [ System / Preferences / Power Management ].