2014/02/26

scp protocol error: mtime.sec not present

After setting up a chroot sftp as described here https://wiki.archlinux.org/index.php/SFTP-chroot, I ran into a problem. Trying to scp fails with the following error:
protocol error: mtime.sec not present
There was no google result for this error, so I'm documenting it, maybe it will come handy for others. The best thing to do in this case is to run scp -v. That gave me a bit more information:
Sink: This service allows sftp connections only.
protocol error: mtime.sec not present
And really, silly me, trying scp where I should use sftp. And indeed, with sftp it works.

2014/02/15

"Boot failed: Could not read from CDROM (code 0003)" on ganeti

I couldn't find the right pages with a google search for the following error while booting a virtual machine on ganeti:
Boot failed: Could not read from CDROM (code 0003)
The virtual machine was started to boot from a cdrom like this:

gnt-instance start -H kvm:boot_order=cdrom -H cdrom_image_path=/boot/systemrescuecd-x86-4.0.0.iso $INSTANCE

The problem is that ganeti by default uses the same value for cdrom_disk_type than what's set for disk_type. This means if you set disk_type=paravirtual, then you'll get the following as a parameter to kvm:
-drive file=/boot/systemrescuecd-x86-4.0.0.iso,format=raw,media=cdrom,if=virtio
and this fails to boot because of the if=virtio part. It seems the kvm bios can't boot from virtio cdrom. The best way to fix this is to change cdrom_disk_type from default to scsi or ide:
gnt-cluster modify -H kvm:cdrom_disk_type=scsi

2014/01/13

File "something.php" is writeable by group on cPanel

On a cPanel system, if your php files are group writable, then you'll get HTTP 500 Internal Server Errors, and the following in /usr/local/apache/logs/error_log (not in the error_log in the documentroot):

SoftException in Application.cpp:256: File "/home/netfecom/subdomains/store/index.php" is writeable by group
Premature end of script headers: index.php
This check is silly, as cPanel uses user private groups. All the resources on google will tell you something like do a chmod g-w or change umask to 022. But the whole point of user private groups is to have the files group writable by default. So we need to change suphp behaviour. But unfortunately the config file is not anywhere where you would look for it, and searching for "configure suphp cpanel" leads to nothing. So the key information is that it can be found at /opt/suphp/etc/suphp.conf. These changes will do:
--- /opt/suphp/etc/suphp.conf.orig 2014-01-13 15:21:07.000000000 -0500
+++ /opt/suphp/etc/suphp.conf 2014-01-13 15:22:04.000000000 -0500
@@ -28,9 +28,9 @@
 
 
 ; Security options
-allow_file_group_writeable=false
+allow_file_group_writeable=true
 allow_file_others_writeable=false
-allow_directory_group_writeable=false
+allow_directory_group_writeable=true
 allow_directory_others_writeable=false
 
 

Correctly install xdebug on cPanel

There is a lot of conflicting and incomplete information about this around so let me write how to correctly install xdebug on a cPanel system.

First we need to actually install the xdebug php extension. This will of course not work with yum because cPanel replaces the distro php with it's own source-compiled one. So we'll need to install it through cPanel. Go to WHM -> Software -> Module Installers -> PHP Pecl -> Manage. In the search box type "xdebug", for me it currently shows version 2.2.3. Click install. It looks that it actually configures php.ini correctly and if you verify it with phpinfo(), then it actually works.

But in reality it doesn't work properly. You'll get the following messages in the error_log:

PHP Warning:  Xdebug MUST be loaded as a Zend extension in Unknown on line 0
This is annoying and fills up the logs fast. So go to WHM -> Service Configuration -> PHP Configuration Editor -> Advanced Mode. Look for "extension", you'll find that the value is "xdebug.so", delete it.

The above will take care of the warning in the error_log, but xdebug will stop working. For it to work again look for "zend_extension", you'll see "xdebug.so" as a value there, so everything looks fine. But the trick is, that you need to use the full path here. You can find it on the install screen, for me it is /usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so. Save the configuration and voila, xdebug works and there is no warning in the error_log.

PS: If you know how to do these from the command line, I'd appreciate it.

2014/01/05

Installing sysbench on cPanel

I'm making a note of it because it was non-trivial and no google search led me to the solution.

The problem is that the sysbench package won't install on cPanel infested CentOS:

# yum install sysbench
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                                                                                                            |  24 kB     00:00     
 * base: ftp.nluug.nl
 * epel: ftp.nluug.nl
 * extras: ftp.nluug.nl
 * updates: ftp.nluug.nl
base                                                                                                                                                                                                     | 3.7 kB     00:00     
epel                                                                                                                                                                                                     | 4.2 kB     00:00     
epel/primary_db                                                                                                                                                                                          | 5.8 MB     00:00     
extras                                                                                                                                                                                                   | 3.4 kB     00:00     
updates                                                                                                                                                                                                  | 3.4 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package sysbench.x86_64 0:0.4.12-5.el6 will be installed
--> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) for package: sysbench-0.4.12-5.el6.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: sysbench-0.4.12-5.el6.x86_64
--> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: sysbench-0.4.12-5.el6.x86_64
--> Running transaction check
---> Package postgresql-libs.x86_64 0:8.4.18-1.el6_4 will be installed
---> Package sysbench.x86_64 0:0.4.12-5.el6 will be installed
--> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) for package: sysbench-0.4.12-5.el6.x86_64
--> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: sysbench-0.4.12-5.el6.x86_64
--> Finished Dependency Resolution
Error: Package: sysbench-0.4.12-5.el6.x86_64 (epel)
           Requires: libmysqlclient_r.so.16()(64bit)
Error: Package: sysbench-0.4.12-5.el6.x86_64 (epel)
           Requires: libmysqlclient_r.so.16(libmysqlclient_16)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

The problem is that cPanel adds exclude=mysql* to /etc/yum.conf. But even when ignoring the excludes, installing sysbench won't work:

# yum install --disableexcludes=all sysbench
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.nluug.nl
 * epel: ftp.nluug.nl
 * extras: ftp.nluug.nl
 * updates: ftp.nluug.nl
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package sysbench.x86_64 0:0.4.12-5.el6 will be installed
--> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) for package: sysbench-0.4.12-5.el6.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: sysbench-0.4.12-5.el6.x86_64
--> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: sysbench-0.4.12-5.el6.x86_64
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be installed
---> Package postgresql-libs.x86_64 0:8.4.18-1.el6_4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================================================
 Package                                                    Arch                                              Version                                                     Repository                                       Size
================================================================================================================================================================================================================================
Installing:
 sysbench                                                   x86_64                                            0.4.12-5.el6                                                epel                                             74 k
Installing for dependencies:
 mysql-libs                                                 x86_64                                            5.1.71-1.el6                                                base                                            1.2 M
 postgresql-libs                                            x86_64                                            8.4.18-1.el6_4                                              base                                            201 k

Transaction Summary
================================================================================================================================================================================================================================
Install       3 Package(s)

Total download size: 1.5 M
Installed size: 4.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): mysql-libs-5.1.71-1.el6.x86_64.rpm                                                                                                                                                                | 1.2 MB     00:00     
(2/3): postgresql-libs-8.4.18-1.el6_4.x86_64.rpm                                                                                                                                                         | 201 kB     00:00     
(3/3): sysbench-0.4.12-5.el6.x86_64.rpm                                                                                                                                                                  |  74 kB     00:00     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                           9.4 MB/s | 1.5 MB     00:00     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid : EPEL (6) 
 Package: epel-release-6-8.noarch (@epel/6.5)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test


Transaction Check Error:
  file /usr/share/mysql/charsets/README from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/Index.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/armscii8.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/ascii.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/cp1250.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/cp1251.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/cp1256.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/cp1257.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/cp850.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/cp852.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/cp866.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/dec8.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/geostd8.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/greek.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/hebrew.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/hp8.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/keybcs2.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/koi8r.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/koi8u.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/latin1.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/latin2.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/latin5.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/latin7.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/macce.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/macroman.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/charsets/swe7.xml from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/czech/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/danish/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/dutch/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/english/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/estonian/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/french/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/german/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/greek/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/hungarian/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/italian/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/japanese/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/korean/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/norwegian-ny/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/norwegian/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/polish/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/portuguese/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/romanian/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/russian/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/serbian/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/slovak/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/spanish/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/swedish/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64
  file /usr/share/mysql/ukrainian/errmsg.sys from install of mysql-libs-5.1.71-1.el6.x86_64 conflicts with file from package MySQL55-server-5.5.34-2.cp1136.x86_64

Error Summary
-------------

Ok, let's try to install without dependencies:

# yumdownloader sysbench
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.nluug.nl
 * epel: ftp.nluug.nl
 * extras: ftp.nluug.nl
 * updates: ftp.nluug.nl
sysbench-0.4.12-5.el6.x86_64.rpm                                                                                                                                                                         |  74 kB     00:00     
# rpm -ivh sysbench-0.4.12-5.el6.x86_64.rpm 
warning: sysbench-0.4.12-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
error: Failed dependencies:
 libmysqlclient_r.so.16()(64bit) is needed by sysbench-0.4.12-5.el6.x86_64
 libmysqlclient_r.so.16(libmysqlclient_16)(64bit) is needed by sysbench-0.4.12-5.el6.x86_64
 libpq.so.5()(64bit) is needed by sysbench-0.4.12-5.el6.x86_64
# rpm -ivh --nodeps sysbench-0.4.12-5.el6.x86_64.rpm 
warning: sysbench-0.4.12-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:sysbench               ########################################### [100%]
Great, we have sysbench installed now, but it doesn't work:
# sysbench
sysbench: error while loading shared libraries: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
And here comes the trick, quoting cPanel support:
I can't guarantee that this will work, however the file you need is located at /usr/lib64/libmysqlclient_r.so. You may try creating a symlink from the missing file to this file to see if that resolves this issue.

# ln -s /usr/lib64/libmysqlclient_r.so /usr/lib64/libmysqlclient_r.so.16

Please note that the version installed is /usr/lib64/libmysqlclient_r.so.18 while you need /usr/lib64/libmysqlclient_r.so.16 so there is a chance that this may not work with this library, however if it will work the above should do it.
We are not done yet though, because after symlinking it still doesn't work:
# ln -s /usr/lib64/libmysqlclient_r.so /usr/lib64/libmysqlclient_r.so.16
# sysbench
sysbench: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory
But that's easy to solve:
root@three [~]# yum whatprovides libpq.so.5
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.nluug.nl
 * epel: ftp.nluug.nl
 * extras: ftp.nluug.nl
 * updates: ftp.nluug.nl
postgresql-libs-8.4.18-1.el6_4.i686 : The shared libraries required for any PostgreSQL clients
Repo        : base
Matched from:
Other       : libpq.so.5



root@three [~]# yum install postgresql-libs
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.nluug.nl
 * epel: ftp.nluug.nl
 * extras: ftp.nluug.nl
 * updates: ftp.nluug.nl
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql-libs.x86_64 0:8.4.18-1.el6_4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================================================
 Package                                                    Arch                                              Version                                                     Repository                                       Size
================================================================================================================================================================================================================================
Installing:
 postgresql-libs                                            x86_64                                            8.4.18-1.el6_4                                              base                                            201 k

Transaction Summary
================================================================================================================================================================================================================================
Install       1 Package(s)

Total size: 201 k
Installed size: 624 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : postgresql-libs-8.4.18-1.el6_4.x86_64                                                                                                                                                                        1/1 
  Verifying  : postgresql-libs-8.4.18-1.el6_4.x86_64                                                                                                                                                                        1/1 

Installed:
  postgresql-libs.x86_64 0:8.4.18-1.el6_4                                                                                                                                                                                       

Complete!

And now we are finally happy. There is still a warning on stderr, but seems to work fine (I didn't test the mysql benchmarks):

# sysbench --version
sysbench: /usr/lib64/libmysqlclient_r.so.16: no version information available (required by sysbench)
sysbench 0.4.12

2013/11/13

gentoo: htpasswd: BCRYPT algorithm not supported on this platform

I'm making a note of it, as a google search didn't find the straightforward solution. In case you get the error "htpasswd: BCRYPT algorithm not supported on this platform" when using htpasswd -B on gentoo. The solution is to recompile apr-util with the openssl USE flag. Unfortunately it's switched off by default.

echo -e 'dev-libs/apr-util\topenssl\t# htpasswd: BCRYPT algorithm not supported on this platform' >> /etc/portage/package.use

2013/02/11

Automatically connect to any unsecured Wi-Fi AP from Android

For a long time I wanted my phone to just connect to any SSID which has no password set. I'm travelling often and don't have mobile internet most of the time, and I want my phone to sync emails and stuff whenever I get to the vicinity of a publicly available Wi-Fi signal without touching my phone. Google didn't help, but I finally figured it out accidentally when searching for a solution to extract cleartext Wi-Fi passwords from my phone.

You will need to edit the file /data/misc/wifi/wpa_supplicant.conf and add the following lines:
# This is a network block that connects to any unsecured access point.
# We give it a low priority so any defined blocks are preferred.
network={
        key_mgmt=NONE
        priority=-9
}

I recommend switching off Wi-Fi first, because this file gets updated automatically. There is a drawback though, on the AP list, you won't see which SSID you are connected to, and QuickSettings will say "Connected to (null)". But it works.

PS: You need a rooted phone for this, the wpa_supplicant.conf is not writable (and not even readable) otherwise.