I had the same “Can not write to file” problem with the Music On Hold module when upgrading (on an Elastix install.) I checked the permissions for the config files and sure enough two files were set as root:root. The solution was: (as root or use “sudo”)
chown asterisk:asterisk /etc/asterisk/musiconhold_additional.conf
The zapata-channels.conf file was also set to root so it’s probably a good idea to change it as well:
chown asterisk:asterisk /etc/asterisk/zapata-channels.conf
After fixing the permissions just run the upgrade again and it should work fine. I hope that helps someone else with the same issue.