Many migrants who leave war-torn homelands thinking better days await in Europe make a perilous journey westward only to wind up detained for months in Greece and other countries.