Possible and very probable reason is the bug of libmtp.
It seems that it is caused by file with name like 20180915_180351(0).jpg. Samsung phones for example like to create files with such names.
There are several tickets (one, two and etc) and question about it.
So possible workaround is to use different mtp options for such directories or somehow change file naming policy of your phone camera (or switch to another camera app like Open Camera for example).
I use Ubuntu 18.04.
I have a Samsung 8, and I have the same problem.
I tried all of the above, and it didn't work.
I deleted about half of my files from my phone, and that solved the problem.
I believe that the problem was too many files on the phone. The reason I believe this is that, over time, as the number of files on the phone increased, it took longer and longer to find them, and eventually it stopped working.
My Motorola G5 suddenly became visible on my Ubuntu 18.04 system after I moved the conection from a USB2 PC socket to a USB3 socket. Moving back to the USB2 socket: failure. To the USB3 socket: instant correct connection.
Heaven knows where the issue actually is, but in my case avoiding USB2 ports works around the problem. If you have the option, you may want to try it.
Bottom line: my hang may differ from yours. The PTP and MTP protocols are very finicky.
On the Phone side:
Ensure device is unlocked
Try changing usb connection options:
On the Ubuntu side:
You may need to install the libmtp packages:
General Troubleshooting
Try a different USB cable
Try a different USB port
Use a powered USB hub
Possible and very probable reason is the bug of libmtp.
It seems that it is caused by file with name like
20180915_180351(0).jpg
. Samsung phones for example like to create files with such names.There are several tickets (one, two and etc) and question about it.
So possible workaround is to use different mtp options for such directories or somehow change file naming policy of your phone camera (or switch to another camera app like Open Camera for example).
I use Ubuntu 18.04. I have a Samsung 8, and I have the same problem. I tried all of the above, and it didn't work. I deleted about half of my files from my phone, and that solved the problem.
I believe that the problem was too many files on the phone. The reason I believe this is that, over time, as the number of files on the phone increased, it took longer and longer to find them, and eventually it stopped working.
My Motorola G5 suddenly became visible on my Ubuntu 18.04 system after I moved the conection from a USB2 PC socket to a USB3 socket. Moving back to the USB2 socket: failure. To the USB3 socket: instant correct connection.
Heaven knows where the issue actually is, but in my case avoiding USB2 ports works around the problem. If you have the option, you may want to try it.
Bottom line: my hang may differ from yours. The PTP and MTP protocols are very finicky.