# Mysql-server fails on first restart within install

**URL:** <https://discourse.chef.io/t/mysql-server-fails-on-first-restart-within-install/1254>\
**Category:** Chef Infra (archive)\
**Created:** [August 7, 2009, 5:08pm UTC](https://discourse.chef.io/t/mysql-server-fails-on-first-restart-within-install/1254 "2009-08-07T17:08:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Todd](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/matthew_todd/32/923_2.png) [@Matthew\_Todd](https://discourse.chef.io/u/Matthew_Todd)\
**Post date:** [August 7, 2009, 5:08pm UTC](https://discourse.chef.io/t/mysql-server-fails-on-first-restart-within-install/1254/1 "2009-08-07T17:08:46Z")

</div>

Hi, again, all –

I’m having trouble installing mysql-server with chef – though if I  
`apt-get install mysql-server` manually, everything works fine.

Below, I’ve included the relevant output from the chef-client run,  
followed by some particularly telling bits from /var/log/daemon.log.

I first suspected (because of the pthread\_create error in daemon.log)  
resource limits imposed by “chpst” in the runit run script, although:

- Running “exec chpst /bin/sh -c ‘ulimit -a’” with chpst via runit  
shows 4096 allowed open processes, which seems like a lot.
- I’ve disabled apparmor and rebooted.
- I’ve adjusted the mysql[:tuning] attributes back down to the mysql-  
provided defaults.

And the problem remains.

Since then, I’ve also suspected the mysql recipe’s preseeding, since  
earlier messages in daemon.log seem to indicate the mysql root  
password hasn’t yet been set.

But overriding the mysql recipe’s preseed file with a more trimmed-  
down one doesn’t seem to make any difference.

Any thoughts?

We’ve got to stop meeting like this, 🙂

Cheers, – Matthew

# ======================================== From /etc/sv/chef-client/log/main/current

2009-08-07\_15:09:49.69629 INFO: Installing package[mysql-devel]  
version 5.1.30really5.0.75-0ubuntu10  
2009-08-07\_15:09:53.45174 INFO: Installing gem\_package[mysql] version  
2.7  
2009-08-07\_15:09:57.02316 INFO: Installing package[mysql-client]  
version 5.1.30really5.0.75-0ubuntu10  
2009-08-07\_15:10:01.01779 INFO: Creating directory[/var/cache/local/  
preseeding] at /var/cache/local/preseeding  
2009-08-07\_15:10:01.01782 INFO: Setting owner to 0 for directory[/var/  
cache/local/preseeding]  
2009-08-07\_15:10:01.01783 INFO: Setting group to 0 for directory[/var/  
cache/local/preseeding]  
2009-08-07\_15:10:01.01784 INFO: Setting mode to 755 for directory[/  
var/cache/local/preseeding]  
2009-08-07\_15:10:01.01784 INFO: Creating template[/var/cache/local/  
preseeding/mysql-server.seed] at /var/cache/local/preseeding/mysql-  
server.seed  
2009-08-07\_15:10:01.01785 INFO: Setting owner to 0 for template[/var/  
cache/local/preseeding/mysql-server.seed]  
2009-08-07\_15:10:01.01786 INFO: Setting group to 0 for template[/var/  
cache/local/preseeding/mysql-server.seed]  
2009-08-07\_15:10:01.01787 INFO: Setting mode to 600 for template[/var/  
cache/local/preseeding/mysql-server.seed]  
2009-08-07\_15:10:01.01787 INFO: template[/var/cache/local/preseeding/  
mysql-server.seed] sending run action to execute[preseed mysql-  
server] (immediate)  
2009-08-07\_15:10:01.30847 INFO: Ran execute[preseed mysql-server]  
successfully  
2009-08-07\_15:10:01.33990 INFO: Installing package[mysql-server]  
version 5.1.30really5.0.75-0ubuntu10  
2009-08-07\_15:10:24.88320 ERROR: package[mysql-server] (/srv/chef/  
cache/cookbooks/mysql/recipes/server.rb line 46) had an error:  
2009-08-07\_15:10:24.88323 apt-get -q -y install mysql-  
server=5.1.30really5.0.75-0ubuntu10 returned 100, expected 0  
2009-08-07\_15:10:24.88324 ---- Begin output of apt-get -q -y install  
mysql-server=5.1.30really5.0.75-0ubuntu10 ----  
2009-08-07\_15:10:24.88325 STDOUT: Reading package lists…  
2009-08-07\_15:10:24.88326 Building dependency tree…  
2009-08-07\_15:10:24.88327 Reading state information…  
2009-08-07\_15:10:24.88330 The following extra packages will be  
installed:  
2009-08-07\_15:10:24.88331 libhtml-template-perl mysql-server mysql-  
server-5.0 mysql-server-core-5.0  
2009-08-07\_15:10:24.88332 Suggested packages:  
2009-08-07\_15:10:24.88333 libipc-sharedcache-perl tinyca mailx  
2009-08-07\_15:10:24.88334 The following NEW packages will be installed:  
2009-08-07\_15:10:24.88334 libhtml-template-perl mysql-server mysql-  
server-5.0 mysql-server-core-5.0  
2009-08-07\_15:10:24.88335 Preconfiguring packages …  
2009-08-07\_15:10:24.88336 0 upgraded, 4 newly installed, 0 to remove  
and 0 not upgraded.  
2009-08-07\_15:10:24.88337 Need to get 0B/27.0MB of archives.  
2009-08-07\_15:10:24.88338 After this operation, 88.3MB of additional  
disk space will be used.  
2009-08-07\_15:10:24.88338 Selecting previously deselected package  
mysql-server-core-5.0.  
2009-08-07\_15:10:24.88339 (Reading database … 35807 files and  
directories currently installed.)  
2009-08-07\_15:10:24.88340 Unpacking mysql-server-core-5.0 (from …/  
mysql-server-core-5.0\_5.1.30really5.0.75-0ubuntu10\_i386.deb) …  
2009-08-07\_15:10:24.88344 Selecting previously deselected package  
mysql-server-5.0.  
2009-08-07\_15:10:24.88345 Unpacking mysql-server-5.0 (from …/mysql-  
server-5.0\_5.1.30really5.0.75-0ubuntu10\_i386.deb) …  
2009-08-07\_15:10:24.88345 Selecting previously deselected package  
libhtml-template-perl.  
2009-08-07\_15:10:24.88346 Unpacking libhtml-template-perl (from …/  
libhtml-template-perl\_2.9-1\_all.deb) …  
2009-08-07\_15:10:24.88347 Selecting previously deselected package  
mysql-server.  
2009-08-07\_15:10:24.88348 Unpacking mysql-server (from …/mysql-  
server\_5.1.30really5.0.75-0ubuntu10\_all.deb) …  
2009-08-07\_15:10:24.88349 Processing triggers for man-db …  
2009-08-07\_15:10:24.88349 Setting up mysql-server-core-5.0  
(5.1.30really5.0.75-0ubuntu10) …  
2009-08-07\_15:10:24.88350 Setting up mysql-server-5.0  
(5.1.30really5.0.75-0ubuntu10) …  
2009-08-07\_15:10:24.88351 \* Stopping MySQL database server mysqld  
2009-08-07\_15:10:24.88352 …done.  
2009-08-07\_15:10:24.88353 \* Mounting securityfs on /sys/kernel/  
security…  
2009-08-07\_15:10:24.88353 …done.  
2009-08-07\_15:10:24.88354 \* Reloading AppArmor profiles …  
2009-08-07\_15:10:24.88355 …done.  
2009-08-07\_15:10:24.88356 \* Starting MySQL database server mysqld  
2009-08-07\_15:10:24.88356 …fail!  
2009-08-07\_15:10:24.88357 invoke-rc.d: initscript mysql, action  
"start" failed.  
2009-08-07\_15:10:24.88358 dpkg: error processing mysql-server-5.0 (–  
configure):  
2009-08-07\_15:10:24.88359 subprocess post-installation script  
returned error exit status 1  
2009-08-07\_15:10:24.88361 Setting up libhtml-template-perl (2.9-1) …  
2009-08-07\_15:10:24.88362 dpkg: dependency problems prevent  
configuration of mysql-server:  
2009-08-07\_15:10:24.88362 mysql-server depends on mysql-server-5.0;  
however:  
2009-08-07\_15:10:24.88363 Package mysql-server-5.0 is not  
configured yet.  
2009-08-07\_15:10:24.88364 dpkg: error processing mysql-server (–  
configure):  
2009-08-07\_15:10:24.88365 dependency problems - leaving unconfigured  
2009-08-07\_15:10:24.88365 Errors were encountered while processing:  
2009-08-07\_15:10:24.88366 mysql-server-5.0  
2009-08-07\_15:10:24.88367 mysql-serverSTDERR: No apport report  
written because the error message indicates its a followup error from  
a previous failure.  
2009-08-07\_15:10:24.88368 E: Sub-process /usr/bin/dpkg returned an  
error code (1)---- End output of apt-get -q -y install mysql-  
server=5.1.30really5.0.75-0ubuntu10 ----

# ======================================== From /var/log/daemon/log

Aug 7 15:10:09 guinea mysqld\_safe[2529]: PLEASE REMEMBER TO SET A  
PASSWORD FOR THE MySQL root USER !  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: To do so, start the server,  
then issue the following commands:  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: /usr/bin/mysqladmin -u root  
password 'new-password’  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: /usr/bin/mysqladmin -u root  
-h guinea password ‘new-password’  
Aug 7 15:10:09 guinea mysqld\_safe[2529]:  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: Alternatively you can run:  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: /usr/bin/  
mysql\_secure\_installation  
Aug 7 15:10:09 guinea mysqld\_safe[2529]:  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: which will also give you  
the option of removing the test  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: databases and anonymous  
user created by default. This is  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: strongly recommended for  
production servers.  
Aug 7 15:10:09 guinea mysqld\_safe[2529]:  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: See the manual for more  
instructions.  
Aug 7 15:10:09 guinea mysqld\_safe[2529]:  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: Please report any problems  
with the /usr/bin/mysqlbug script!  
Aug 7 15:10:09 guinea mysqld\_safe[2529]:  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: The latest information  
about MySQL is available on the web at  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: [http://www.mysql.com](http://www.mysql.com)  
Aug 7 15:10:09 guinea mysqld\_safe[2529]: Support MySQL by buying  
support/licenses at [http://shop.mysql.com](http://shop.mysql.com)  
Aug 7 15:10:09 guinea mysqld\_safe[2593]: ERROR: 1046 No database  
selected  
Aug 7 15:10:09 guinea mysqld\_safe[2593]: 090807 15:10:09 [ERROR]  
Aborting  
Aug 7 15:10:09 guinea mysqld\_safe[2593]:  
Aug 7 15:10:09 guinea mysqld\_safe[2593]: 090807 15:10:09 [Note] /usr/  
sbin/mysqld: Shutdown complete  
Aug 7 15:10:09 guinea mysqld\_safe[2593]:  
Aug 7 15:10:09 guinea mysqld\_safe[2747]: started  
Aug 7 15:10:09 guinea mysqld[2750]: InnoDB: Error: pthread\_create  
returned 11  
Aug 7 15:10:09 guinea mysqld\_safe[2752]: ended  
Aug 7 15:10:24 guinea /etc/init.d/mysql[2887]: 0 processes alive and  
’/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping’  
resulted in  
Aug 7 15:10:24 guinea /etc/init.d/mysql[2887]: ^G/usr/bin/  
mysqladmin: connect to server at ‘localhost’ failed  
Aug 7 15:10:24 guinea /etc/init.d/mysql[2887]: error: 'Can’t connect  
to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)'  
Aug 7 15:10:24 guinea /etc/init.d/mysql[2887]: Check that mysqld is  
running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!  
Aug 7 15:10:24 guinea /etc/init.d/mysql[2887]:

---

<div class="post-metadata">

**Author:** ![Bryan\_McLellan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_mclellan/32/81_2.png) [@Bryan\_McLellan](https://discourse.chef.io/u/Bryan_McLellan)\
**Post date:** [August 7, 2009, 5:26pm UTC](https://discourse.chef.io/t/mysql-server-fails-on-first-restart-within-install/1254/2 "2009-08-07T17:26:37Z")

</div>

My first thought is the /etc/mysql/debian.cnf file that contains a  
username/password that debian uses in it's init scripts. I'd look at  
that and try to connect with that user, then chec to see if there are  
values for this in your debconf database, compare to the preseed  
values.

also, try 'dpkg -P --force-depends mysql-common' before the chef run.

On 8/7/09, Matthew Todd [matthew.todd@gmail.com](mailto:matthew.todd@gmail.com) wrote:

> Hi, again, all --
> 
> I'm having trouble installing mysql-server with chef -- though if I  
> `apt-get install mysql-server` manually, everything works fine.
> 
> Below, I've included the relevant output from the chef-client run,  
> followed by some particularly telling bits from /var/log/daemon.log.
> 
> I first suspected (because of the pthread\_create error in daemon.log)  
> resource limits imposed by "chpst" in the runit run script, although:
> 
> - Running "exec chpst /bin/sh -c 'ulimit -a'" with chpst via runit  
> shows 4096 allowed open processes, which seems like a lot.
> - I've disabled apparmor and rebooted.
> - I've adjusted the mysql[:tuning] attributes back down to the mysql-  
> provided defaults.
> 
> And the problem remains.
> 
> Since then, I've also suspected the mysql recipe's preseeding, since  
> earlier messages in daemon.log seem to indicate the mysql root  
> password hasn't yet been set.
> 
> But overriding the mysql recipe's preseed file with a more trimmed-  
> down one doesn't seem to make any difference.
> 
> Any thoughts?
> 
> We've got to stop meeting like this, 🙂
> 
> Cheers, -- Matthew
> 
> # ======================================== From /etc/sv/chef-client/log/main/current
> 
> 2009-08-07\_15:09:49.69629 INFO: Installing package[mysql-devel]  
> version 5.1.30really5.0.75-0ubuntu10  
> 2009-08-07\_15:09:53.45174 INFO: Installing gem\_package[mysql] version  
> 2.7  
> 2009-08-07\_15:09:57.02316 INFO: Installing package[mysql-client]  
> version 5.1.30really5.0.75-0ubuntu10  
> 2009-08-07\_15:10:01.01779 INFO: Creating directory[/var/cache/local/  
> preseeding] at /var/cache/local/preseeding  
> 2009-08-07\_15:10:01.01782 INFO: Setting owner to 0 for directory[/var/  
> cache/local/preseeding]  
> 2009-08-07\_15:10:01.01783 INFO: Setting group to 0 for directory[/var/  
> cache/local/preseeding]  
> 2009-08-07\_15:10:01.01784 INFO: Setting mode to 755 for directory[/  
> var/cache/local/preseeding]  
> 2009-08-07\_15:10:01.01784 INFO: Creating template[/var/cache/local/  
> preseeding/mysql-server.seed] at /var/cache/local/preseeding/mysql-  
> server.seed  
> 2009-08-07\_15:10:01.01785 INFO: Setting owner to 0 for template[/var/  
> cache/local/preseeding/mysql-server.seed]  
> 2009-08-07\_15:10:01.01786 INFO: Setting group to 0 for template[/var/  
> cache/local/preseeding/mysql-server.seed]  
> 2009-08-07\_15:10:01.01787 INFO: Setting mode to 600 for template[/var/  
> cache/local/preseeding/mysql-server.seed]  
> 2009-08-07\_15:10:01.01787 INFO: template[/var/cache/local/preseeding/  
> mysql-server.seed] sending run action to execute[preseed mysql-  
> server] (immediate)  
> 2009-08-07\_15:10:01.30847 INFO: Ran execute[preseed mysql-server]  
> successfully  
> 2009-08-07\_15:10:01.33990 INFO: Installing package[mysql-server]  
> version 5.1.30really5.0.75-0ubuntu10  
> 2009-08-07\_15:10:24.88320 ERROR: package[mysql-server] (/srv/chef/  
> cache/cookbooks/mysql/recipes/server.rb line 46) had an error:  
> 2009-08-07\_15:10:24.88323 apt-get -q -y install mysql-  
> server=5.1.30really5.0.75-0ubuntu10 returned 100, expected 0  
> 2009-08-07\_15:10:24.88324 ---- Begin output of apt-get -q -y install  
> mysql-server=5.1.30really5.0.75-0ubuntu10 ----  
> 2009-08-07\_15:10:24.88325 STDOUT: Reading package lists...  
> 2009-08-07\_15:10:24.88326 Building dependency tree...  
> 2009-08-07\_15:10:24.88327 Reading state information...  
> 2009-08-07\_15:10:24.88330 The following extra packages will be  
> installed:  
> 2009-08-07\_15:10:24.88331 libhtml-template-perl mysql-server mysql-  
> server-5.0 mysql-server-core-5.0  
> 2009-08-07\_15:10:24.88332 Suggested packages:  
> 2009-08-07\_15:10:24.88333 libipc-sharedcache-perl tinyca mailx  
> 2009-08-07\_15:10:24.88334 The following NEW packages will be installed:  
> 2009-08-07\_15:10:24.88334 libhtml-template-perl mysql-server mysql-  
> server-5.0 mysql-server-core-5.0  
> 2009-08-07\_15:10:24.88335 Preconfiguring packages ...  
> 2009-08-07\_15:10:24.88336 0 upgraded, 4 newly installed, 0 to remove  
> and 0 not upgraded.  
> 2009-08-07\_15:10:24.88337 Need to get 0B/27.0MB of archives.  
> 2009-08-07\_15:10:24.88338 After this operation, 88.3MB of additional  
> disk space will be used.  
> 2009-08-07\_15:10:24.88338 Selecting previously deselected package  
> mysql-server-core-5.0.  
> 2009-08-07\_15:10:24.88339 (Reading database ... 35807 files and  
> directories currently installed.)  
> 2009-08-07\_15:10:24.88340 Unpacking mysql-server-core-5.0 (from .../  
> mysql-server-core-5.0\_5.1.30really5.0.75-0ubuntu10\_i386.deb) ...  
> 2009-08-07\_15:10:24.88344 Selecting previously deselected package  
> mysql-server-5.0.  
> 2009-08-07\_15:10:24.88345 Unpacking mysql-server-5.0 (from .../mysql-  
> server-5.0\_5.1.30really5.0.75-0ubuntu10\_i386.deb) ...  
> 2009-08-07\_15:10:24.88345 Selecting previously deselected package  
> libhtml-template-perl.  
> 2009-08-07\_15:10:24.88346 Unpacking libhtml-template-perl (from .../  
> libhtml-template-perl\_2.9-1\_all.deb) ...  
> 2009-08-07\_15:10:24.88347 Selecting previously deselected package  
> mysql-server.  
> 2009-08-07\_15:10:24.88348 Unpacking mysql-server (from .../mysql-  
> server\_5.1.30really5.0.75-0ubuntu10\_all.deb) ...  
> 2009-08-07\_15:10:24.88349 Processing triggers for man-db ...  
> 2009-08-07\_15:10:24.88349 Setting up mysql-server-core-5.0  
> (5.1.30really5.0.75-0ubuntu10) ...  
> 2009-08-07\_15:10:24.88350 Setting up mysql-server-5.0  
> (5.1.30really5.0.75-0ubuntu10) ...  
> 2009-08-07\_15:10:24.88351 \* Stopping MySQL database server mysqld  
> 2009-08-07\_15:10:24.88352 ...done.  
> 2009-08-07\_15:10:24.88353 \* Mounting securityfs on /sys/kernel/  
> security...  
> 2009-08-07\_15:10:24.88353 ...done.  
> 2009-08-07\_15:10:24.88354 \* Reloading AppArmor profiles ...  
> 2009-08-07\_15:10:24.88355 ...done.  
> 2009-08-07\_15:10:24.88356 \* Starting MySQL database server mysqld  
> 2009-08-07\_15:10:24.88356 ...fail!  
> 2009-08-07\_15:10:24.88357 invoke-rc.d: initscript mysql, action  
> "start" failed.  
> 2009-08-07\_15:10:24.88358 dpkg: error processing mysql-server-5.0 (--  
> configure):  
> 2009-08-07\_15:10:24.88359 subprocess post-installation script  
> returned error exit status 1  
> 2009-08-07\_15:10:24.88361 Setting up libhtml-template-perl (2.9-1) ...  
> 2009-08-07\_15:10:24.88362 dpkg: dependency problems prevent  
> configuration of mysql-server:  
> 2009-08-07\_15:10:24.88362 mysql-server depends on mysql-server-5.0;  
> however:  
> 2009-08-07\_15:10:24.88363 Package mysql-server-5.0 is not  
> configured yet.  
> 2009-08-07\_15:10:24.88364 dpkg: error processing mysql-server (--  
> configure):  
> 2009-08-07\_15:10:24.88365 dependency problems - leaving unconfigured  
> 2009-08-07\_15:10:24.88365 Errors were encountered while processing:  
> 2009-08-07\_15:10:24.88366 mysql-server-5.0  
> 2009-08-07\_15:10:24.88367 mysql-serverSTDERR: No apport report  
> written because the error message indicates its a followup error from  
> a previous failure.  
> 2009-08-07\_15:10:24.88368 E: Sub-process /usr/bin/dpkg returned an  
> error code (1)---- End output of apt-get -q -y install mysql-  
> server=5.1.30really5.0.75-0ubuntu10 ----
> 
> # ======================================== From /var/log/daemon/log
> 
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: PLEASE REMEMBER TO SET A  
> PASSWORD FOR THE MySQL root USER !  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: To do so, start the server,  
> then issue the following commands:  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: /usr/bin/mysqladmin -u root  
> password 'new-password'  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: /usr/bin/mysqladmin -u root  
> -h guinea password 'new-password'  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]:  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: Alternatively you can run:  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: /usr/bin/  
> mysql\_secure\_installation  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]:  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: which will also give you  
> the option of removing the test  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: databases and anonymous  
> user created by default. This is  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: strongly recommended for  
> production servers.  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]:  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: See the manual for more  
> instructions.  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]:  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: Please report any problems  
> with the /usr/bin/mysqlbug script!  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]:  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: The latest information  
> about MySQL is available on the web at  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: [http://www.mysql.com](http://www.mysql.com)  
> Aug 7 15:10:09 guinea mysqld\_safe[2529]: Support MySQL by buying  
> support/licenses at [http://shop.mysql.com](http://shop.mysql.com)  
> Aug 7 15:10:09 guinea mysqld\_safe[2593]: ERROR: 1046 No database  
> selected  
> Aug 7 15:10:09 guinea mysqld\_safe[2593]: 090807 15:10:09 [ERROR]  
> Aborting  
> Aug 7 15:10:09 guinea mysqld\_safe[2593]:  
> Aug 7 15:10:09 guinea mysqld\_safe[2593]: 090807 15:10:09 [Note] /usr/  
> sbin/mysqld: Shutdown complete  
> Aug 7 15:10:09 guinea mysqld\_safe[2593]:  
> Aug 7 15:10:09 guinea mysqld\_safe[2747]: started  
> Aug 7 15:10:09 guinea mysqld[2750]: InnoDB: Error: pthread\_create  
> returned 11  
> Aug 7 15:10:09 guinea mysqld\_safe[2752]: ended  
> Aug 7 15:10:24 guinea /etc/init.d/mysql[2887]: 0 processes alive and  
> '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping'  
> resulted in  
> Aug 7 15:10:24 guinea /etc/init.d/mysql[2887]: ^G/usr/bin/  
> mysqladmin: connect to server at 'localhost' failed  
> Aug 7 15:10:24 guinea /etc/init.d/mysql[2887]: error: 'Can't connect  
> to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'  
> Aug 7 15:10:24 guinea /etc/init.d/mysql[2887]: Check that mysqld is  
> running and that the socket: '/var/run/mysqld/mysqld.sock' exists!  
> Aug 7 15:10:24 guinea /etc/init.d/mysql[2887]:

--  
Sent from my mobile device

---

<div class="post-metadata">

**Author:** ![Matthew\_Todd](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/matthew_todd/32/923_2.png) [@Matthew\_Todd](https://discourse.chef.io/u/Matthew_Todd)\
**Post date:** [August 8, 2009, 9:25am UTC](https://discourse.chef.io/t/mysql-server-fails-on-first-restart-within-install/1254/3 "2009-08-08T09:25:29Z")

</div>

Thanks again for your help, Bryan --

On Aug 7, 2009, at 8:26 PM, Bryan McLellan wrote:

> My first thought is the /etc/mysql/debian.cnf file that contains a  
> username/password that debian uses in it's init scripts. I'd look at  
> that and try to connect with that user, then chec to see if there are  
> values for this in your debconf database, compare to the preseed  
> values.

Yup, once the restart fails on install, I can /etc/init.d/mysql  
start, then mysql -u debian-sys-maint -p\<the password from /etc/mysql/  
debian.cnf\> just fine.

> also, try 'dpkg -P --force-depends mysql-common' before the chef run.

Yes, I've been rolling back to a clean VMware snapshot each time.

But!

I may have had a breakthrough:

Continuing with the resource limits theory, I've been poking around  
with chpst in the shell.

Running the following command, which has the same chpst memory limit  
as the chef-client runit service, MySQL server FAILS to create the  
initial InnoDB tables:

```
chpst -m 262144000 sh -c '/usr/bin/env  

```

DEBIAN\_FRONTEND=noninteractive apt-get -q -y install mysql-server'

If I remove the "-m 262144000", however, it SUCCEEDS.

Strangely, though, doubling the memory limit to 524288000 (512M),  
1048576000 (1G), and 2097152000 (2G) doesn't help: MySQL server still  
FAILS to restart.

(And when I use "chpst -d ..." rather than "-m" (just limiting the  
data segment), it SUCCEEDS.)

So, for now, I've draconically removed the chpst -m memory limit from  
chef-client's runit script -- and mysql-server installs just fine.  
Long-term, though, I feel a little uneasy, since I'm sure that limit  
was there for a reason.

Could someone out there confirm that the initial chpst command,  
above, also fails for you?

And would anyone be able to provide more chpst insight, either a more  
elegant solution than wholesale removing the -m, or a theory as to  
why 2G of memory weren't enough for MySQL to create a database?

Cheers! -- Matthew

---

<div class="post-metadata">

**Author:** ![Adam\_Jacob](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/adam_jacob/32/292_2.png) [@Adam\_Jacob](https://discourse.chef.io/u/Adam_Jacob)\
**Post date:** [August 8, 2009, 5:52pm UTC](https://discourse.chef.io/t/mysql-server-fails-on-first-restart-within-install/1254/4 "2009-08-08T17:52:34Z")

</div>

On Sat, Aug 8, 2009 at 2:25 AM, Matthew Todd[matthew.todd@gmail.com](mailto:matthew.todd@gmail.com) wrote:

> Running the following command, which has the same chpst memory limit as the  
> chef-client runit service, MySQL server FAILS to create the initial InnoDB  
> tables:
> 
> ```
> chpst -m 262144000 sh -c '/usr/bin/env DEBIAN_FRONTEND=noninteractive
> 
> ```
> 
> apt-get -q -y install mysql-server'
> 
> If I remove the "-m 262144000", however, it SUCCEEDS.
> 
> Strangely, though, doubling the memory limit to 524288000 (512M), 1048576000  
> (1G), and 2097152000 (2G) doesn't help: MySQL server still FAILS to restart.
> 
> (And when I use "chpst -d ..." rather than "-m" (just limiting the data  
> segment), it SUCCEEDS.)

Wow, nice troubleshooting.

You can safely remove the memory limit in the chef-client run file,  
and this might be a fine reason to do so. One interesting thing here  
is that we might be having our children inherit the limits set by  
chpst, which would be Bad (tm) for something like Chef.

> So, for now, I've draconically removed the chpst -m memory limit from  
> chef-client's runit script -- and mysql-server installs just fine.  
> Long-term, though, I feel a little uneasy, since I'm sure that limit was  
> there for a reason.

I think it's been there mainly as a form of garlic to ward off demons  
from our collective past (ie: rapid crazy memory bloating of our long  
running configuration management processes.) We haven't had many  
reports of this happening with Chef, though, so I think it should be  
safe to remove it.

0.7.6 also introduces the ability to use the splay setting without an  
interval, which means you could just use cron to get the same  
functionality as the long-running chef-client, if that sort of thing  
suits you. (It does make things harder to turn off, which is why I  
don't take that path personally.)

Best,  
Adam

--  
Opscode, Inc.  
Adam Jacob, CTO  
T: (206) 508-7449 E: [adam@opscode.com](mailto:adam@opscode.com)
