Heimdall Error Protocol initialisation failed! on Ubuntu
I was experiencing the same problem, and I found a solution that worked for me in a comment on Heimdall issue #228.

The problem for me was that udev was reserving the phone as a modem when I plugged it in.  If you run dmesg and see a line that says "This device cannot do calls on its own. It is not a modem.", then this could work for you.

As root, create a file named /etc/udev/rules.d/79-samsung.rules with the following content:

ATTRS{idVendor}=="04e8", ENV{ID_MM_DEVICE_IGNORE}="1"


Then restart udev with "sudo service udev restart", and unplug/replug the device, and you can try to install again.

If that doesn't work or if it's a different problem, you can edit your question to add the output of these commands:

heimdall detect --verbose --usb-log-level debug
sudo heimdall print-pit --verbose --no-reboot