It seems that existing mailbox MD5 ends up nicely in /etc/dovecot/passwd. Problem is that authentication fails. It just seems that dovecot refuses to authenticate with that scheme, so I tried to add plain-md5 to the configuration, but it does not recognise it either:
dovecot: auth: Fatal: Unknown authentication mechanism 'plain-md5'
Could this be a distribution issue? May be the Ubuntu version does not support it any more?