Image rotation and editing stopped working in WordPress after upgrading Ubuntu from 16.04 to 18.04

GD uses the function imagerotate. According to this answer on stackoverflow the function isn’t included on some OS’es because of a memory leak. This problem is also mentioned as comment in the WordPress code:

On some setups GD library does not provide imagerotate() – Ticket #11536

The ticket number belongs to the WordPress Ticket #11536.

As a solution you can try to use the workaround mentioned in the stackoverflow answer or you can install php-imagick as an alternative to gd, which is also supported by WordPress.