Using Gparted on a live Ubuntu flash drive, I shrank the SSD partition on which my Ubuntu 18.10 installation sits. I did not move it to the right, just shrank it, leaving unused space to the right. It still had plenty of empty space even after the shrink.
Grub worked, I booted up, logged on to my user account, and had trouble launching programs.
I rebooted, and after grub, Ubuntu did not come up. I was staring at a purple screen with no text.
I rebooted into safe mode, and got a message like /dev/sda?: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY
This issue is repeatable. Every time I shrank the disk, I had the same issue.
Eventually I ran fsck manually on the specified sda (don't remember which), and clicked "yes" every time, and that fixed it. No issues since then.
So my question is: why does this happen, and how can it be avoided?