I had run into various install failures of the new branch on Ubuntu Xenial on my AWS installs. The specs are:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
Almost every one ended with the install failing the first time with a database access error:
"[0] => Unable to grant privileges to database users."
Or would work on a second try, but the hosting-queued.service would fail with:
"Could not find the alias @hostmaster"
The hosting-queued.service would also fail stating the service restarted too quickly.
After fooling around with various Vargant installs, I found the following pattern fixed this.
First, install aptitude and the Aegir keys. I am not sure if this is actually needed, but it was part of the original specs.
sudo apt-get install -y aptitude && sudo aptitude update && sudo aptitude -y safe-upgrade
echo "deb http://debian.aegirproject.org stable main" | sudo tee -a /etc/apt/sources.list.d/aegir-stable.list
wget -q http://debian.aegirproject.org/key.asc -O- | sudo apt-key add -
sudo apt-get update
Next, change the hostname to the FQDN. The localhost needs to be there or the database connection might fail. The hostname must be first for Aegir to properly identify itself.
### [ first line in /etc/hosts] ###
127.0.0.1 aegir.FQDN.mydomain localhost localhost.localdomain
### [ only line in /etc/hostname] ###
aegir.FQDN.mydomain
Restart the network to reflect the hostname changes:
sudo hostname $(cat /etc/hostname)
sudo systemctl restart networking.service
Install new packages:
sudo apt-get install -y mysql-server postfix
sudo apt-get install -y mysql-client sudo rsync git unzip php7.0 php7.0-cli php7.0-mysql php7.0-gd php7.0-curl php7.0-xml apache2 libapache2-mod-php7.0 make
Install aegir3:
sudo apt-get install -y aegir3-hostmaster && sudo apt-get install aegir3
Note that is does NOT install "mysql_secure_installation" I found this will lock aegir3-hostmaster out, it won't be able to grant permissions to the aegir user, and the install will fail. If you run this AFTER the install, it has no effect, but those instructions for Ubuntu 14.04 reflected the default mysql-server install did not have a root password. This has changed for the new versions. I spoke with Christopher Gervais, and he told me to submit this as a bug report.
There is a good chance this could be simplified even further, but I put this here in case anyone else runs into the same issues.
Comments
Comment #2
colanComment #3
helmo commentedPlease review the documentation updates in #2888521: Document SecureApt
Gitlab is now installing on 16.04 for every commit ... https://gitlab.com/aegir/provision/-/jobs/22325249
Please let me know if there are more changes we should make.
Comment #4
agaq commentedHello
Not entirely sure this is the best place to report this - sorry if it is not.
I had exactly the same installation error ("[0] => Unable to grant privileges to database users." then "Could not find the alias @hostmaster") when installing Aegir 3.11.2 on Ubuntu 16.04 with mysql 5.7.19:
But I traced it to having secured MYSQL with a password validation policy set to MEDIUM. If I revert to policy LOW, then installation works fine.
So I assume that AEGIR tries to create a user-password that is not secure enough for the validation policy?!
Not sure if that qualifies as a bug?
Current workaround is to set password validation policy to LOW before installing AEGIR:
Hope this helps. Cheers.
Comment #5
agaq commentedAs a follow up to my previous post.
I ran into the same problem again when updating AEGIR (from 3.121 to 3.130, on Ubuntu 16.04 using apt-get upgrade).
.
The MYSQL password policy was set to MEDIUM at the time:
.
Once again, the upgrade worked fine once I downgraded MYSQL password validation policy to LOW like this:
.
So the *permanent* workaround to allow AEGIR installation and/or subsequent upgrades on Ubuntu 16.04 is to set MYSQL password validation policy to LOW permanently by forcing it in mysqld.cnf as follows:
.
So:
Could newer versions use for the database user a password strong enough to comply with MYSQL strongest possible password validation policy?
Comment #6
agaq commentedComment #7
agaq commentedComment #8
colanAre there any other implications of switching this to LOW? I'm a little bit worried given that the default is MEDIUM.
Comment #9
agaq commentedI have just checked on a clean install. In Ubuntu 16.04.3 by default the MYSQL validate password plugin is NOT installed so AEGIR installs and updates fine until you run mysql_secure_installation and choose to setup the VALIDATE PASSWORD plugin and set it to anything else that LOW.
The possible settings are:
LOW: Length >= 8
MEDIUM: Length >= 8, numeric, mixed case, and special characters
STRONG: Length >= 8, numeric, mixed case, special characters and dictionary file
But running mysql_secure_installation and setting up the VALIDATE PASSWORD plugin to at least MEDIUM sounds like a good idea, so the AEGIR install should probably agree with that.
But has anyone else reported that problem or been able to replicate it?
Comment #10
agaq commented@colan - Should we consider this a bug and/or a security risk?
I assume the fix would be very easy (but I may be wrong): having hostmaster generate a stronger password for the database user (Length >= 8, numeric, mixed case, special characters and dictionary file)?
Comment #11
helmo commentedI'm not a huge fan of special chars in passwords, but even less of lowering default security settings ;)
Please create a new issue where we can work on the provision_password() function from provision.inc.
Comment #12
agaq commentedOk. Done: https://www.drupal.org/project/hostmaster/issues/2942248
Hopefully I did it right - was my first time.
Comment #13
helmo commentedThanks, that summarizes it well.
I think we can close this one...
Comment #14
colanComment #16
agaq commentedThe fix described above (setting validate_password_policy=LOW in mysqld.cnf) worked fine until I needed to upgrade MYSQL (from 5.7.21 to 5.7.22).
MYSQL upgrade failed with an error:
New fix is to disable mysql password validation plugin altogether: