...and being woken up more than once during the night for passport checks
Official border control (passport checks, customs etc.) were abandoned rather long time ago, actually in 2007 when most of the Central European countries entered Schengen agreement. So nowadays it might be just random police check, but unlike in Germany or France, this happens really rarely in that region of Europe.
I'm understanding from reading posts that it's best to buy tickets for these night trips once we're in Budapest and Krakow? Some people have talked of waiting for hours in long lines to buy tickets on night trains but replies have suggested that they'd save time by paying a small fee and buying tickets through nearby agencies - often in the railway station. Would you agree??
In case of Budapest-Krakow overnight carriages you can actually purchase discounted international tickets from Hungarian Railways website (
http://elvira.mav-start.hu/elvira.dll/xslms/), so you would pay only 49 EUR per person in 2 bed compartment, which is really good price in this case. The interface is a bit problematic since partly in Hungarian, but till the time of your travel they might fix it or you can always use google translate.
In case of Krakow-Prague, as of today Polish Railways officially doesn't sell international tickets online, so it is either purchase at the ticket counter already in Poland or use agency.
Concerning
long lines to buy tickets and agencies: it all really depends on time of the day and actual ticket counter. Obviously during peak hours there might be some queues, but you can always purchase your ticket not at busy railway station, but Hungarian Railways office in the city center (on Jozsef Attila ut. near Deak Ferenc ter.) or do it during evening walk when there is already no queues at the station etc. With agencies it is complicated, some like Wasteels at Budapest-Keleti station (to your left when you enter from the main entrance) doesn't charge any commission at all. But generally, there is no need to pay more and buy from agency, because you can easily avoid queues and purchase directly from train companies.