Guest session stopped working on Ubuntu versions later than 16.04

Solution 1:

The guest session was intentionally disabled by default due to a security issue, where the guest session was not contained by the AppArmor profile that usually limits guest sessions. This AppArmor profile, among other things, prevents a guest user from using su to switch to other users, or viewing other users' home directories.

You can enable it, if you consider the issue to be manageable on your system, as explained in comment #24 of the bug report or by using this one liner:

sudo sh -c 'printf "[Seat:*]\nallow-guest=true\n" >/etc/lightdm/lightdm.conf.d/40-enable-guest.conf'

To reverse it back to the disabled state, simply do:

sudo rm /etc/lightdm/lightdm.conf.d/40-enable-guest.conf