I get sound from the speakers but not the 3.5 mm audio output. To my surprise Ubuntu knows when headphones are plugged in, so this has the potential to be an operating system or software issue. The following shows how the settings change when the 3.5 mm plug gets inserted.
After inserting the 3.5 mm headphone plug...
I changed from one external audio device to another and they have a different audio cable. Both external audio devices fail so it is probably not an external hardware problem. There is still the chance there is a hardware problem internal to the computer that prevents 3.5 mm audio output but the fact that Ubuntu can detect the device means there is potential for a mode change that prevents correct operation when a device gets plugged in. Rebooting does not fix the problem.
This hardware is a HP Elitebook 840 G2.
alsamixer
(as a command in a terminal) and see if the headphone output isn't muted or has the volume set to 0.100<>100
for either headphones or speaker depending upon if it is plugged in.