-- 
Regards,     
Alex


----- Forwarded Message -----
From: "Alex Jia" <[email protected]>
To: "Lucas Meneghel Rodrigues" <[email protected]>
Sent: Wednesday, September 12, 2012 11:39:19 PM
Subject: Re: [Autotest] [autotest] How to automatically build a autotest server 
as root?

----- Original Message -----
From: "Lucas Meneghel Rodrigues" <[email protected]>
To: "Alex Jia" <[email protected]>
Sent: Wednesday, September 12, 2012 9:15:34 PM
Subject: Re: [Autotest] [autotest] How to automatically build a autotest server 
as root?

On Wed, Sep 12, 2012 at 5:53 AM, Alex Jia <[email protected]> wrote:
> Hi all,
> As subject, basically, I used contrib/install-autotest-server.sh to 
> automatically
> build a autotest server, because the script needs to create an 'autotest' 
> account,
> I ran contrib/install-autotest-server.sh as root then got the following error:
>
> <snip>
>
> 15:11:22 INFO | Setting up the database schemas
> 15:11:23 INFO | Re-starting MySQL server
> Job failed. See system logs and 'systemctl status' for details.
> 15:11:23 INFO | Building the web rpc client (may take up to 10 minutes)
> 15:11:26 ERROR| The following clients failed: autotest.TkoClient
> autotest.AfeClient
> autotest.EmbeddedSpreadsheetClient
> autotest.EmbeddedTkoClient

^ Compilation of the web client failed. Not sure why, the script
should've installed the java packages needed for that.


    Yeah, all of packages are successfully installed by the script:

14:53:36 INFO | Installing all packages (unzip wget httpd mod_wsgi Django 
mysql-server MySQL-python git java-1.6.0-openjdk-devel java-1.7.0-openjdk-devel 
python-imaging python-crypto python-paramiko python-httplib2 numpy 
python-matplotlib python-atfork selinux-policy selinux-policy-targeted 
policycoreutils-python)


> 15:11:26 INFO | Import the base tests and profilers
> Traceback (most recent call last):
>   File "/usr/local/autotest/utils/test_importer.py", line 597, in <module>
>     main(sys.argv)
>   File "/usr/local/autotest/utils/test_importer.py", line 576, in main
>     options.add_experimental)
>   File "/usr/local/autotest/utils/test_importer.py", line 81, in update_all
>     autotest_dir=autotest_dir)
>   File "/usr/local/autotest/utils/test_importer.py", line 225, in 
> update_tests_in_db
>     path=test.replace(autotest_dir, '').lstrip('/'))[0]
>   File "/usr/lib/python2.7/site-packages/django/db/models/manager.py", line 
> 135, in get_or_create
>     return self.get_query_set().get_or_create(**kwargs)
>   File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 
> 378, in get_or_create
>     return self.get(**lookup), False
>   File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 
> 344, in get
>     num = len(clone)
>   File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 82, 
> in __len__
>     self._result_cache = list(self.iterator())
>   File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 
> 273, in iterator
>     for row in compiler.results_iter():
>   File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", 
> line 680, in results_iter
>     for rows in self.execute_sql(MULTI):
>   File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", 
> line 734, in execute_sql
>     cursor = self.connection.cursor()
>   File "/usr/lib/python2.7/site-packages/django/db/backends/__init__.py", 
> line 252, in cursor
>     cursor = util.CursorWrapper(self._cursor(), self)
>   File "/usr/lib/python2.7/site-packages/django/db/backends/mysql/base.py", 
> line 322, in _cursor
>     self.connection = Database.connect(**kwargs)
>   File "/usr/lib64/python2.7/site-packages/MySQLdb/__init__.py", line 81, in 
> Connect
>     return Connection(*args, **kwargs)
>   File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 187, 
> in __init__
>     super(Connection, self).__init__(*args, **kwargs2)
> _mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL 
> server through socket '/var/lib/mysql/mysql.sock' (2)")
> 15:11:27 INFO | Restarting web server
> Restarting httpd (via systemctl):                          [  OK  ]
> 15:11:27 INFO | Installing/starting scheduler
> ln -s '/etc/systemd/system/autotestd.service' 
> '/etc/systemd/system/multi-user.target.wants/autotestd.service'
> 15:11:28 INFO | autotestd.service - Autotest scheduler Loaded: loaded 
> (/etc/systemd/system/autotestd.service; enabled) Active: active (running) 
> since Wed, 12 Sep 2012 15:11:28 +0800; 61ms ago Main PID: 13397 
> (autotest-schedu) CGroup: name=systemd:/system/autotestd.service └ 13397 
> /usr/bin/python -u /usr/local/autotest/scheduler/a...
> 15:11:28 INFO | Finished installing autotest server 0.14.1-559-gb50e at: Wed 
> Sep 12 15:11:28 CST 2012
> 15:11:28 INFO | You can access your server on http://10.66.82.148/afe
>
> </snip>
>
>
> WRT above error message, there are 2 questions, the one is mysql error 
> "(2002, "Can't connect to local MySQL server
> through socket '/var/lib/mysql/mysql.sock' (2)")"; moreover, the mysql error 
> will results in defunct 'autotest-schedu',
> and the other one is "You can access your server on http://10.66.82.148/afe";, 
> in fact, this link isn't available.

Compilation of the web interface failed. You need to verify *why* it did fail.


    As I said, it's a mysql error.

 

> # ps -ef|grep autotest
> autotest 13397     1  0 15:11 ?        00:00:00 /usr/bin/python -u 
> /usr/local/autotest/scheduler/autotest-scheduler-watcher
> autotest 16366     1  0 16:07 ?        00:00:00 /bin/mountpoint -q 
> /sys/fs/cgroup/systemd
> autotest 16562 13397  1 16:10 ?        00:00:00 [autotest-schedu] <defunct>
> root     16572  1897  0 16:10 pts/2    00:00:00 grep --color=auto autotest
>
> # pstree -p autotest
> autotest-schedu(13397)───autotest-schedu(16803)
>
> mountpoint(16366)
>
> # ps wu -p 13397
> USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
> autotest 13397  0.0  0.0 352292 37124 ?        Ss   15:11   0:01 
> /usr/bin/python -u /usr/local/autotest/scheduler/autotest-scheduler-watcher
>
>
> Q1: mysql error
> Mysql default don't allow run mysqld as root due to security reason, but the 
> script need to create an 'autotest' account
> with root privilege, if you run mysqld as root, you will see this error  
> "Security" section of the manual to find out
> how to run mysqld as root!
>
> Notes, Need we to allow run mysqld as root?

mysqld will run as a system service

chkconfig mysqld on

service mysqld start

And that all happens as root. Used to work fine on F16, F17, RHEL6.


    it's very weird for me, I have never successfully build an autotest service 
via this script
on F16, the following is my debugger information:

# service mysqld status
Redirecting to /bin/systemctl  status mysqld.service
mysqld.service - MySQL database server
          Loaded: loaded (/lib/systemd/system/mysqld.service; enabled)
          Active: failed since Wed, 12 Sep 2012 15:31:35 +0800; 4s ago
         Process: 15678 ExecStartPre=/usr/libexec/mysqld-prepare-db-dir 
(code=exited, status=254)
          CGroup: name=systemd:/system/mysqld.service

# /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql 
--plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log 
--pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
120912 15:57:10 [ERROR] Fatal error: Please read "Security" section of the 
manual to find out how to run mysqld as root!

As you seen, the failed reason is to run mysqld as root.


>
> Q2:
> I think we need to improve script contrib/install-autotest-server.sh, if some 
> critical
> errors happened, the programming should exit and raise expected error 
> information.

Great, send us patches to do that.

>
> Another question is about "server configuration for the KVM test", the 
> following link
> points out we should change "serve_packages_from_autoserv: True" to 
> "serve_packages_from_autoserv: False"
> in global_config.ini, but it seems the script 
> contrib/install-autotest-server.sh hasn't
> do this, if so, when should we change it? after completing git clone? 
> manually modify it?

Manually change it after all is done. The script doesn't do it because
it's a *generic* script, not specifically geared for users of the kvm
test.


    Okay, thanks for your explanation.

    Alex


-- 
Lucas

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to