I am trying to flash TWRP on Samsung Galaxy S6 that I inherited from someone else, there was already some custom software on it, but I am not sure what exactly. File transfer to a computer works fine. The computer I am using has ubuntu 16.04 installed and heimdall from the official repositories v1.4.1) and the following works fine on an S4 mini:
$ heimdall print-pit
Heimdall v1.4.1
Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/
This software is provided free of charge. Copying and redistribution is
encouraged.
If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/
Initialising connection...
Detecting device...
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/018: Input/output error
ERROR: Failed to access device. libusb error: -1
sudo heimdall whatevercommands
sudo chmod o+w -R /dev/bus/usb/whatevernumber
. Also remove udev restrictions.