resize2fs: Read-only file system While checking for on-line resizing support

Had a problem with resize2fs not resizing the root partition of Ubuntu. Was giving the following error

resize2fs: Read-only file system While checking for on-line resizing support

The problem is the root partition I was trying to resize was mounted read only. Remounting as read/write fixed the problem

mount -o remount /

Then rerun the resize command to fill up the rest of the free space

resize2fs /dev/sda1