A bubble in a vertical cylindrical capillary can get stuck due to the drainage of its lubrication film, according to the prediction originally made by Bretherton. When stuck, the profile of the lubrication film around the bubble is measured using an optical interference method. Our experimental results verified the theoretical prediction of the time-dependent minimum thickness h(min) similar to t(-4/5) [C. Lamstaes and J. Eggers, Arrested bubble 'rise' in a narrow tube, J. Stat. Phys. 167, 656-682 (2017)]. The bubble is stuck in a cylindrical capillary if the critical radius is proportional to the capillary length. We show that this result can be extended to square capillaries, where bubbles will get stuck in square capillaries below a critical width. For the same capillary length, the critical width of the square capillaries is much smaller than the critical radius of the cylindrical ones, due to the fluid leakage at the corners. As the square channels are also commonly used in microfluidic devices, our results provide helpful insights into the different features of the motion of bubbles resulting from the shape of channels.