The error messages that you saw indicate that there’s a problem in Certbot’s ability to understand and modify the Apache configuration on your system. In this case, Certbot tried to change your Apache server configuration in order to pass challenges to prove your control over these names, but it didn’t succeed.
The most common reason for this is having an existing Apache configuration with multiple VirtualHosts in a single file (often in /etc/apache2/sites-available). Do you know if that’s the case in your configuration? Or do you know anything else in the Apache configuration that might be unusual, complex, or difficult for Certbot to parse somehow?
Probably splitting the virtual hosts out into individual files should fix the problem.
There is code in Certbot to warn users about this situation, but after looking at it, I think it’s only triggered when you specify -d, rather than for the automatic servername detection case.
While that is quite a severe bug that we don’t fail with a useful error in this situation, one of our developers is nearing completion of a fix to allow multiple VirtualHosts to coexist in a single file and be handled correctly by Certbot. So I think at this point we should wait for that fix in the next release rather than try to write additional code to improve detection of an error condition that’s about to be eliminated.