Non-deterministic behavior of `sudo`

Solution 1:

Sid is still not stable, it might be a bug, I suggest you submit it to Debian here.

Solution 2:

Bug already filled. Workaround:

In my case I've changed /etc/pam.d/login and /etc/pam.d/gdm3* and added a line

session required        pam_loginuid.so

just before @include common-session

(from Michael Biebl's response)