I was receiving this error after setting up Roundcube, Postfix and Dovecot.

Error: file_dotlock_create(/var/mail/kevin) failed: Permission denied (euid=1000(kevin) egid=1000(kevin) missing +w perm: /var/mail, we're not in group 8(mail), dir owned by 0:8 mode=0775) (set mail_privileged_group=mail)

Edit the line below in the file: /etc/dovecot/conf.d/10-mail.conf

mail_privileged_group = mail

Reference