<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SpaLinux.com &#187; Troubleshooting</title>
	<atom:link href="http://spalinux.com/category/troubleshooting/feed" rel="self" type="application/rss+xml" />
	<link>http://spalinux.com</link>
	<description>Resources for Relaxing Linux System Administrators</description>
	<lastBuildDate>Mon, 26 Jul 2010 09:51:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>รัน SVN แล้วขึ้น error MKACTIVITY request</title>
		<link>http://spalinux.com/2010/07/svn_error_mkactivity_request</link>
		<comments>http://spalinux.com/2010/07/svn_error_mkactivity_request#comments</comments>
		<pubDate>Mon, 26 Jul 2010 09:51:19 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Version Control]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=1140</guid>
		<description><![CDATA[เจอปัญหารัน svn แล้วขึ้น error เลยนำมาแชร์ประสบการณ์ให้อ่าน ตัวอย่างการรัน svn แล้วเกิดปัญหา [user1@client ~]$ svn --username user1 import test_project https://192.168.1.1/svn/test_project/trunk/test_project -m 'init release' svn: Server sent unexpected return value (500 Internal Server Error) in response to MKACTIVITY request for '/repos/test_project/!svn/act/...' คอนฟิกที่ใช้เป็นการรัน svn โดยเขียน อ่าน ไฟล์ repos ผ่านทาง Apache DAV ตัวอย่างคอนฟิกไฟล์ของ Apache เพื่อเก็บ svn repos บนเซิร์ฟเวอร์     &#60;Location /svn&#62;         DAV svn [...]]]></description>
			<content:encoded><![CDATA[<p>เจอปัญหารัน svn แล้วขึ้น error เลยนำมาแชร์ประสบการณ์ให้อ่าน</p>
<p>ตัวอย่างการรัน svn แล้วเกิดปัญหา</p>
<pre>[user1@client ~]$ <strong>svn --username user1 import test_project https://192.168.1.1/svn/test_project/trunk/test_project -m 'init release'
</strong>svn: Server sent unexpected return value (500 Internal Server Error) in response to MKACTIVITY request for '/repos/test_project/!svn/act/...'</pre>
<p>คอนฟิกที่ใช้เป็นการรัน svn โดยเขียน อ่าน ไฟล์ repos ผ่านทาง Apache DAV</p>
<p><span id="more-1140"></span></p>
<p>ตัวอย่างคอนฟิกไฟล์ของ Apache เพื่อเก็บ svn repos บนเซิร์ฟเวอร์</p>
<pre>    &lt;Location /svn&gt;
        DAV svn
        SVNParentPath /var/svn/repos</pre>
<pre>        # Limit write permission to list of valid users.
        &lt;LimitExcept GET PROPFIND OPTIONS REPORT&gt;</pre>
<pre>            # Require SSL connection for password protection.
            # SSLRequireSSL</pre>
<pre>            AuthType Basic
            AuthName "Authorization Realm"
            AuthUserFile /var/svn/.htpasswd
            Require valid-user
        &lt;/LimitExcept&gt;
    &lt;/Location&gt;</pre>
<p>ตรวจสอบ error_log ที่เซิร์ฟเวอร์แล้ว มีข้อความประมาณ &#8220;couldn&#8217;t check user&#8221;</p>
<pre>[root@server ~]# <strong>tail /var/log/httpd/ssl_error_log
</strong>[Mon Jul 26 15:56:08 2010] [crit] [client x.x.x.x] configuration error:  <span style="color: #ff0000;">couldn't check <span style="color: #ff0000;">user</span></span><span style="color: #ff0000;">.  No user file?:</span> /repos/test_project/!svn/act/...</pre>
<p>ตอนแรกนึกว่าเป็นปัญหาเกี่ยวกับ permission ของไฟล์หรือไดเร็คทอรี พยายามแก้อยู่นาน จนกระทั่งเปลี่ยน chmod 777 ก็ยังไม่สามารถแก้ปัญหาได้</p>
<p>ลองแก้ปัญหาอยู่นาน ก็พบว่า ดันไปปิด module &#8220;mod_auth_basic&#8221; ในไฟล์คอนฟิก /etc/httpd/conf/httpd.conf ของ apache เลยทดลองเปิดขึ้นมา</p>
<pre>LoadModule auth_basic_module modules/mod_auth_basic.so</pre>
<p>ลองรัน svn อีกครั้ง ก็ยังขึ้น error เหมือนเดิม แต่ครั้งนี้ error_log ที่เซิร์ฟเวอร์เปลี่ยนไปเป็นบ่นเกี่ยวกับ &#8220;No groups file&#8221;</p>
<pre>[user1@client ~]$ <strong>svn --username user1 import test_project </strong><strong>https://192.168.1.1/svn/test_project/trunk/test_project</strong><strong> -m 'init release'
</strong>svn: Server sent unexpected return value (500 Internal Server Error) in response to MKACTIVITY request for '/repos/test_project/!svn/act/...'</pre>
<pre>[Mon Jul 26 16:30:05 2010] [crit] [client x.x.x.x] configuration error:  <span style="color: #ff0000;">couldn't check access.  No groups file?:</span> /repos/test_project/!svn/act/...</pre>
<p>ลองเปิด/ปิด module ต่างๆ อยู่นาน กระทั่งพบว่าต้องเปิดอีก module หนึ่งคือ &#8220;mod_authz_user&#8221;</p>
<pre>LoadModule authz_user_module modules/mod_authz_user.so</pre>
<p>หลังจากเปิด module ทั้งสองแล้วก็สามารถรัน svn ได้ตามปกติ</p>
<pre>[user1@client ~]$ <strong>svn --username user1 import test_project </strong><strong>https://192.168.1.1/svn/test_project/trunk/test_project</strong><strong> -m 'init'
</strong>Authentication realm: &lt;https://192.168.1.1:443&gt; Authorization Realm
Password for 'user1':
Adding         test_project/index.php</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/11/basic_using_subversion">การใช้งาน subversion เบื้องต้น</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2010/07/svn_error_mkactivity_request/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ปัญหาการใช้ SSH Public Key Authentication บน Solaris</title>
		<link>http://spalinux.com/2010/06/ssh_public_key_authentication_problem_on_solaris</link>
		<comments>http://spalinux.com/2010/06/ssh_public_key_authentication_problem_on_solaris#comments</comments>
		<pubDate>Sat, 05 Jun 2010 10:40:51 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[secure shell]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=1110</guid>
		<description><![CDATA[พยายามคอนฟิก Public Key Authentication เพื่อ login เข้าสู่เครื่องที่ติดตั้ง Solaris อยู่นาน ก็ไม่สามารถทำได้ แต่ในที่สุดก็สามารถหาปัญหาได้ เลยมาแชร์ประสบการณ์เผื่อจะเป็นประโยชน์ ทดสอบปัญหา เริ่มต้นเพิ่ม user บนเครื่องที่ติดตั้ง Solaris 10 สมมติว่าชื่อ user1 [root@solaris ~]# useradd user1 [root@solaris ~]# id user1 uid=502(user1) gid=1(other) groups=1(other) แก้ไข home ของ user1 ให้อยู่ใน /export/home/ และสร้างไดเร็คทอรี [root@solaris ~]# cat /etc/passwd ... user1:x:502:1::/export/home/user1:/bin/sh [root@solaris ~]# cd /export/home [root@solaris home]# mkdir user1 [root@solaris home]# chown [...]]]></description>
			<content:encoded><![CDATA[<p>พยายามคอนฟิก Public Key Authentication เพื่อ login เข้าสู่เครื่องที่ติดตั้ง Solaris อยู่นาน ก็ไม่สามารถทำได้ แต่ในที่สุดก็สามารถหาปัญหาได้ เลยมาแชร์ประสบการณ์เผื่อจะเป็นประโยชน์</p>
<p><span id="more-1110"></span></p>
<h4>ทดสอบปัญหา</h4>
<p>เริ่มต้นเพิ่ม user บนเครื่องที่ติดตั้ง Solaris 10 สมมติว่าชื่อ user1</p>
<pre>[root@solaris ~]# <strong>useradd user1
</strong>[root@solaris ~]# <strong>id user1
</strong>uid=502(user1) gid=1(other) groups=1(other)</pre>
<p>แก้ไข home ของ user1 ให้อยู่ใน /export/home/ และสร้างไดเร็คทอรี</p>
<pre>[root@solaris ~]# <strong>cat /etc/passwd
</strong>...
user1:x:502:1::<span style="color: #0000ff;">/export/home/user1</span>:/bin/sh</pre>
<pre>[root@solaris ~]# <strong>cd /export/home
</strong>[root@solaris home]# <strong>mkdir user1
</strong>[root@solaris home]# <strong>chown user1 user1/
</strong>[root@solaris home]# <strong>su - user1
</strong>[user1@solaris ~]$ <strong>pwd
</strong>/export/home/user1</pre>
<p>ต้องการให้ admin1 จากเครื่องที่ติดตั้ง linux สามารถ ssh ด้วย public key authentication เป็น user1 บนเครื่อง Solaris ได้</p>
<p>สร้าง public, private key ของ admin1</p>
<pre>[admin1@linux ~]$ <strong>ssh-keygen -t rsa
</strong>Generating public/private rsa key pair.
Enter file in which to save the key (/home/admin1/.ssh/id_rsa):
Created directory '/home/admin1/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/admin1/.ssh/id_rsa.
Your public key has been saved in /home/admin1/.ssh/id_rsa.pub.</pre>
<pre>[admin1@linux ~]$ <strong>cat .ssh/id_rsa.pub
</strong><span style="color: #0000ff;">ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtMbbgeFnn6vEo3IAVh... admin1@linux</span></pre>
<p>copy ไฟล์ id_rsa.pub ของ admin1 ไปใส่ไว้ในไฟล์ authorized_keys ของ user1 บนเครื่อง Solaris</p>
<pre>[user1@solaris ~]$ <strong>cat .ssh/authorized_keys
</strong><span style="color: #0000ff;">ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtMbbgeFnn6vEo3IAVh... admin1@linux</span></pre>
<p>ทดสอบ ssh จากเครื่อง linux</p>
<pre>[admin1@linux ~]$ <strong>ssh -l user1 solaris
</strong>The authenticity of host 'solaris (192.168.1.2)' can't be established.
RSA key fingerprint is ...
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'solaris' (RSA) to the list of known hosts.
Password:</pre>
<p>ขึ้นให้ใส่ password ไม่สามารถ login ด้วย public key authentication ได้</p>
<h4>วิธีการแก้ไขปัญหา</h4>
<p>หลังจากพยายามอยู่นาน ก็พบว่า ssh จะตรวจสอบสถานะ password ของผู้ใช้ด้วย ซึ่งถ้าดูในไฟล์ /etc/shadow จะเห็นว่า user1 จะถูก lock อยู่</p>
<pre>[root@solaris ~]# <strong>cat /etc/shadow
</strong>...
user1:<span style="color: #ff0000;"><strong>*LK*</strong></span>:::::::</pre>
<p>ฟิลด์ที่สองในไฟล์ /etc/shadow คือ encrypted password คำอธิบายจาก man ของ shadow คือ</p>
<pre># <strong>man shadow
</strong>...
     password        An encrypted password for the user generated
                     by crypt(3C), a lock string to indicate that
                     the login is not accessible, or  no  string,
                     which  shows  that  there is no password for
                     the login.</pre>
<pre>                     The lock string is defined as <span style="color: #ff0000;"> *LK*</span>  in  the
                     first four characters of the password field.
...</pre>
<p>การแก้ไขคือ ลบตัวอักษร LK ออก เช่นให้เหลือแต่เครื่องหมาย *</p>
<pre>[root@solaris ~]# <strong>cat /etc/shadow
</strong>...
user1:<span style="color: #ff0000;">*</span>:::::::</pre>
<p>ทดสอบ ssh จากเครื่อง linux อีกครั้ง ก็จะได้ตามที่ต้องการ</p>
<pre>[admin1@linux ~]$ <strong>ssh -l user1 solaris
</strong>[user1@solaris ~]$</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/10/ssh_secure_shell_login_using_public_key_authentication">SSH – Secure Shell ล็อกอินด้วย Public Key Authentication</a></li>
<li><a href="http://forums.sun.com/thread.jspa?threadID=5229706" target="_blank">Sun Networking Services and Protocols &#8211; SSH PermitEmptyPasswords with PASSREQ</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2010/06/ssh_public_key_authentication_problem_on_solaris/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>รัน mysql_secure_installation ขึ้น Read-only file system</title>
		<link>http://spalinux.com/2009/07/mysql_secure_installation_error_read-only_file_system</link>
		<comments>http://spalinux.com/2009/07/mysql_secure_installation_error_read-only_file_system#comments</comments>
		<pubDate>Sat, 18 Jul 2009 05:30:20 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=834</guid>
		<description><![CDATA[หลังจากติดตั้ง MySQL แล้ว แนะนำให้รัน mysql_secure_installation เพื่อเปลี่ยนคอนฟิกเริ่มต้นเช่น password ในการเรียกใช้ database แต่ถ้ารันคำสั่งนี้ในขณะที่อยู่ในไดเร็คทอรีที่ไม่สามารถเขียนไฟล์ได้ (read-only) เช่นอยู่ในไดเร็คทอรีที่ mount CD หรือ DVD  จะขึ้น error ตามด้านล่าง [root@fc11-64min Packages]# pwd /media/Packages [root@fc11-64min Packages]# mysql_secure_installation touch: cannot touch `.my.cnf.2100': Read-only file system touch: cannot touch `.mysql.2100': Read-only file system chmod: cannot access `.my.cnf.2100': No such file or directory chmod: cannot access `.mysql.2100': No such [...]]]></description>
			<content:encoded><![CDATA[<p>หลังจากติดตั้ง MySQL แล้ว แนะนำให้รัน mysql_secure_installation เพื่อเปลี่ยนคอนฟิกเริ่มต้นเช่น password ในการเรียกใช้ database</p>
<p>แต่ถ้ารันคำสั่งนี้ในขณะที่อยู่ในไดเร็คทอรีที่ไม่สามารถเขียนไฟล์ได้ (read-only) เช่นอยู่ในไดเร็คทอรีที่ mount CD หรือ DVD  จะขึ้น error ตามด้านล่าง</p>
<pre>[root@fc11-64min Packages]# <strong>pwd</strong>
/media/Packages</pre>
<pre>[root@fc11-64min Packages]# <strong>mysql_secure_installation
</strong><span style="color: #ff0000;">touch: cannot touch `.my.cnf.2100': Read-only file system
touch: cannot touch `.mysql.2100': Read-only file system
chmod: cannot access `.my.cnf.2100': No such file or directory
chmod: cannot access `.mysql.2100': No such file or directory</span></pre>
<pre><span style="color: #ff0000;"><span id="more-834"></span></span></pre>
<pre>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!</pre>
<pre>In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.</pre>
<pre>Enter current password for root (enter for none):
<span style="color: #ff0000;">/usr/bin/mysql_secure_installation: line 47: .my.cnf.2100: Read-only file system
/usr/bin/mysql_secure_installation: line 48: .my.cnf.2100: Read-only file system
/usr/bin/mysql_secure_installation: line 49: .my.cnf.2100: Read-only file system
/usr/bin/mysql_secure_installation: line 50: .my.cnf.2100: Read-only file system
/usr/bin/mysql_secure_installation: line 41: .mysql.2100: Read-only file system
/usr/bin/mysql_secure_installation: line 42: .mysql.2100: No such file or directory
</span>Enter current password for root (enter for none):
Aborting!</pre>
<pre>Cleaning up...
<span style="color: #ff0000;">rm: cannot remove `.my.cnf.2100': Read-only file system
rm: cannot remove `.mysql.2100': Read-only file system</span></pre>
<p>เหตุผลคือ การรันคำสั่ง mysql_secure_installation มีการเขียนไฟล์ชั่วคราว (temporary file) ขึ้นมาในไดเร็คทอรีปัจจุบันด้วย ดังนั้น ต้องเปลี่ยนไปรันใน path ที่สามารถเขียนไฟล์ได้</p>
<pre>[root@fc11-64min Packages]# <strong>cd ~</strong></pre>
<pre>[root@fc11-64min ~]# <strong>mysql_secure_installation</strong></pre>
<pre>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!</pre>
<pre>In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.</pre>
<pre>Enter current password for root (enter for none):</pre>
<p>ตัวอย่างไฟล์ชั่วคราวที่ถูกสร้างระหว่างรัน mysql_secure_installation</p>
<pre>[root@fc11-64min ~]# <strong>ls -al .my*
</strong>-rw-------. 1 root root 68 2009-07-18 19:23 .my.cnf.2111
-rw-------. 1 root root  1 2009-07-18 19:23 .mysql.2111</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2009/06/install_mysql_on_fedora_11">ติดตั้ง MySQL บน Fedora 11</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/07/mysql_secure_installation_error_read-only_file_system/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>แก้ปัญหาล็อกอิน Secure Shell ช้า</title>
		<link>http://spalinux.com/2009/02/solve_slow_login_secure_shell</link>
		<comments>http://spalinux.com/2009/02/solve_slow_login_secure_shell#comments</comments>
		<pubDate>Sat, 21 Feb 2009 09:52:05 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[SSH]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=465</guid>
		<description><![CDATA[เคยประสบปัญหาในการล็อกอินด้วย secure shell ไปยังเครื่องปลายทางช้าหรือไม่ กว่าที่จะขึ้นให้ใส่ password โดยที่เครื่องปลายทาง (secure shell server) ดูแล้วปกติไม่ได้ทำงานหนักอะไร โหลดของเครื่องก็เป็น 0.00 ตรวจสอบโหลดบนเครื่องปลายทาง ด้วยคำสั่ง uptime [root@ssh-server ~]# uptime  16:02:28 up  1:21,  1 user,  load average: 0.00, 0.00, 0.00 บทความนี้จะเสนอการแก้ไขคอนฟิกของ sshd ซึ่งทำหน้าที่เป็น secure shell server โดยตัวอย่างทดสอบ ssh จากเครื่องชื่อ ssh-client ไปยังเครื่องปลายทางชื่อ ssh-server (192.168.1.1) 1. ปิดการตรวจสอบสิทธิแบบ GSSAPI เริ่มต้นทดสอบใช้คำสั่ง ssh จากเครื่องไคลเอนต์ด้วยออปชั่น -v เพื่อดูรายละเอียดขั้นตอนในการล็อกอินด้วย secure shell ไปยังเครื่องปลายทาง ถ้าสังเกตดูหน้าจอจะค้างตรงบรรทัด ... [...]]]></description>
			<content:encoded><![CDATA[<p>เคยประสบปัญหาในการล็อกอินด้วย secure shell ไปยังเครื่องปลายทางช้าหรือไม่ กว่าที่จะขึ้นให้ใส่ password โดยที่เครื่องปลายทาง (secure shell server) ดูแล้วปกติไม่ได้ทำงานหนักอะไร โหลดของเครื่องก็เป็น 0.00</p>
<p>ตรวจสอบโหลดบนเครื่องปลายทาง ด้วยคำสั่ง uptime</p>
<pre>[root@ssh-server ~]# <strong>uptime</strong>
 16:02:28 up  1:21,  1 user,  load average: 0.00, 0.00, 0.00</pre>
<p>บทความนี้จะเสนอการแก้ไขคอนฟิกของ sshd ซึ่งทำหน้าที่เป็น secure shell server โดยตัวอย่างทดสอบ ssh จากเครื่องชื่อ ssh-client ไปยังเครื่องปลายทางชื่อ ssh-server (192.168.1.1)</p>
<p><span id="more-465"></span></p>
<h4>1. ปิดการตรวจสอบสิทธิแบบ GSSAPI</h4>
<p>เริ่มต้นทดสอบใช้คำสั่ง ssh จากเครื่องไคลเอนต์ด้วยออปชั่น -v เพื่อดูรายละเอียดขั้นตอนในการล็อกอินด้วย secure shell ไปยังเครื่องปลายทาง ถ้าสังเกตดูหน้าจอจะค้างตรงบรรทัด</p>
<pre>...
debug1: Next authentication method: gssapi-with-mic</pre>
<p>ช่วงที่หน้าจอค้าง จะเป็นขั้นตอนการตรวจสอบสิทธิ (user authentication) แบบ GSSAPI ซึ่งถ้าเราไม่ได้ใช้งาน หรือคอนฟิกไว้ สามารถเปลี่ยนคอนฟิกของ sshd เพื่อปิดการตรวจสอบสิทธิแบบนี้ออกไป</p>
<pre>[user1@ssh-client ~]$ <strong>ssh -v 192.168.1.1
</strong>OpenSSH_5.1p1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.1.1 [192.168.1.1] port 22.
debug1: Connection established.
debug1: identity file /home/user1/.ssh/identity type -1
debug1: identity file /home/user1/.ssh/id_rsa type -1
debug1: identity file /home/user1/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1
debug1: match: OpenSSH_5.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server-&gt;client aes128-cbc hmac-md5 none
debug1: kex: client-&gt;server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024&lt;1024&lt;8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.1.1' is known and matches the RSA host key.
debug1: Found key in /home/user1/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No credentials cache found</pre>
<pre>debug1: Unspecified GSS failure.  Minor code may provide more information
No credentials cache found</pre>
<pre>debug1: Unspecified GSS failure.  Minor code may provide more information</pre>
<pre>debug1: Next authentication method: publickey
debug1: Trying private key: /home/user1/.ssh/identity
debug1: Trying private key: /home/user1/.ssh/id_rsa
debug1: Trying private key: /home/user1/.ssh/id_dsa
debug1: Next authentication method: password
user1@192.168.1.1's password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
[user1@ssh-server ~]$</pre>
<p>แก้ไขคอนฟิกของ ssh-server โดยแก้ออปชั่นของ GSSAPI ดังนี้</p>
<pre>[root@ssh-server ssh]# <strong>cat /etc/ssh/sshd_config
</strong>...
# GSSAPI options
<strong>GSSAPIAuthentication no
GSSAPICleanupCredentials no
</strong>...</pre>
<p>หลังจากแก้ไข ใช้คำสั่ง service เพื่อรีโหลด secure sshd ใหม่อีกครั้ง เพื่อให้คอนฟิกใหม่มีผล</p>
<pre>[root@ssh-server ssh]# <strong>service sshd restart
</strong>Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
[root@ssh-server ssh]#</pre>
<p>ทดสอบการ ssh อีกครั้งหลังจากปิดคุณสมบัติ GSSAPI บนเซิร์ฟเวอร์ จะเห็นว่าเร็วขึ้นมาก ไม่มีบรรทัดที่เกี่ยวข้องกับ GSSAPI ขึ้นมาอีก</p>
<pre>[user1@ssh-client ~]$ <strong>ssh -v 192.168.1.1
</strong>OpenSSH_5.1p1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.1.1 [192.168.1.1] port 22.
debug1: Connection established.
debug1: identity file /home/user1/.ssh/identity type -1
debug1: identity file /home/user1/.ssh/id_rsa type -1
debug1: identity file /home/user1/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1
debug1: match: OpenSSH_5.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server-&gt;client aes128-cbc hmac-md5 none
debug1: kex: client-&gt;server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024&lt;1024&lt;8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.1.1' is known and matches the RSA host key.
debug1: Found key in /home/user1/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/user1/.ssh/identity
debug1: Trying private key: /home/user1/.ssh/id_rsa
debug1: Trying private key: /home/user1/.ssh/id_dsa
debug1: Next authentication method: password
user1@192.168.1.1's password:
[user1@ssh-client ~]$</pre>
<pre> </pre>
<pre>
<h4>2. ปิดการตรวจสอบชื่อ hostname กับ DNS (reverse hostname lookup)</h4>

ดีฟอลต์คอนฟิกของ sshd ที่ติดตั้งกับ Fedora เมื่อมีการล็อกอินเข้ามา เซิร์ฟเวอร์จะพยายามแปลง IP Address ของไคลเอนต์ที่เข้ามาเป็นชื่อ hostname โดยไปถามจาก DNS Server (reverse hostname lookup)

ถ้าเครื่อง ssh-server ไม่สามารถติดต่อกับ DNS Server หรือ ไม่มีข้อมูล IP Address ของเครื่องไคลเอนต์อยู่ใน DNS Server ที่คอนฟิกไว้ การล็อกอินจะค้างไปซักพักตรงบรรทัด
<pre>...
debug1: SSH2_MSG_SERVICE_ACCEPT received</pre>
<p>ตัวอย่างการล็อกอิน</p>
<pre>[user1@ssh-client ~]$ <strong>ssh -v 192.168.1.1
</strong>OpenSSH_5.1p1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.1.1 [192.168.1.1] port 22.
debug1: Connection established.
debug1: identity file /home/user1/.ssh/identity type -1
debug1: identity file /home/user1/.ssh/id_rsa type -1
debug1: identity file /home/user1/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1
debug1: match: OpenSSH_5.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server-&gt;client aes128-cbc hmac-md5 none
debug1: kex: client-&gt;server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024&lt;1024&lt;8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.1.1' is known and matches the RSA host key.
debug1: Found key in /home/user1/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received</pre>
<p>สามารถแก้ไขปัญหานี้ด้วยการปิดคุณสมบัติการตรวจสอบชื่อ hostname จาก IP Address ของไคลเอนต์ โดยแก้ออปชั่นของ UseDNS ให้เป็นค่า no ดังนี้</p>
<pre>[root@ssh-server ssh]# <strong>cat /etc/ssh/sshd_config
</strong>...
<strong>UseDNS no
</strong>...</pre>
<p>หลังจากแก้ไข ใช้คำสั่ง service เพื่อรีโหลด sshd ใหม่อีกครั้ง เพื่อให้คอนฟิกใหม่มีผล</p>
<pre>[root@ssh-server ssh]# <strong>service sshd restart
</strong>Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
[root@ssh-server ssh]#</pre>
</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/10/introduction_to_secure_shell_ssh">แนะนำการใช้งานโปรแกรม Secure Shell (SSH)</a></li>
<li>man sshd_config(5)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/02/solve_slow_login_secure_shell/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>การเปลี่ยน IP Address ของ Samba PDC</title>
		<link>http://spalinux.com/2008/10/changing_samba_pdc_ip_address</link>
		<comments>http://spalinux.com/2008/10/changing_samba_pdc_ip_address#comments</comments>
		<pubDate>Sat, 25 Oct 2008 12:14:23 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Samba]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[pdc]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=300</guid>
		<description><![CDATA[บทความนี้จะอธิบายการแก้ไขปัญหาหลังจากเปลี่ยน IP Address ของเครื่องเซิร์ฟเวอร์ที่รัน Samba ทำหน้าที่เป็น Domain Controller หรือ PDC บนลีนุกซ์ ตัวอย่างในบทความนี้จะเป็นการแก้ไขหลังจากเปลี่ยน IP ของเครื่องเซิร์ฟเวอร์จาก 10.1.0.1 ไปเป็น IP ใหม่คือ 192.168.1.1 ของโดเมน SMBLDAP ก่อนการแก้ไข หลังจากที่เปลี่ยน IP Addres ของลีนุกซ์แล้ว โดยอาจใช้คำสั่ง system-config-network หรือใช้คำสั่ง ifconfig โดยตรง ทดลองรัน Samba เพื่อทำหน้าที่ PDC ขึ้นมาใหม่ เครื่องไคลเอนต์จะไม่สามารถ join เข้าโดเมนได้ ปัญหาที่เกิดขึ้น เนื่องมาจาก มีการเก็บข้อมูล IP เก่าว่าเป็น Domain Controller อยู่ ซึ่งสามารถตรวจสอบได้จากไฟล์ /var/log/samba/log.nbmd จะขึ้นข้อความว่า Domain Controller ยังผูกกับ IP เก่าอยู่ [...]]]></description>
			<content:encoded><![CDATA[<p>บทความนี้จะอธิบายการแก้ไขปัญหาหลังจากเปลี่ยน IP Address ของเครื่องเซิร์ฟเวอร์ที่รัน Samba ทำหน้าที่เป็น Domain Controller หรือ PDC บนลีนุกซ์</p>
<p>ตัวอย่างในบทความนี้จะเป็นการแก้ไขหลังจากเปลี่ยน IP ของเครื่องเซิร์ฟเวอร์จาก 10.1.0.1 ไปเป็น IP ใหม่คือ 192.168.1.1 ของโดเมน SMBLDAP</p>
<p><span id="more-300"></span></p>
<h4>ก่อนการแก้ไข</h4>
<p>หลังจากที่เปลี่ยน IP Addres ของลีนุกซ์แล้ว โดยอาจใช้คำสั่ง system-config-network หรือใช้คำสั่ง ifconfig โดยตรง ทดลองรัน Samba เพื่อทำหน้าที่ PDC ขึ้นมาใหม่ เครื่องไคลเอนต์จะไม่สามารถ join เข้าโดเมนได้</p>
<p>ปัญหาที่เกิดขึ้น เนื่องมาจาก มีการเก็บข้อมูล IP เก่าว่าเป็น Domain Controller อยู่ ซึ่งสามารถตรวจสอบได้จากไฟล์ /var/log/samba/log.nbmd จะขึ้นข้อความว่า Domain Controller ยังผูกกับ IP เก่าอยู่</p>
<p>ตัวอย่างการรัน Samba หลังจากเปลี่ยน IP Adddress</p>
<pre>[root@samba-server ~]#<strong> service smb start
</strong>Starting SMB services:                                     [  OK  ]
[root@samba-server ~]#<strong> service nmb start
</strong>Starting NMB services:                                     [  OK  ]</pre>
<p>ตัวอย่างไฟล์ log.nmbd ที่มีปัญหา</p>
<pre>[root@samba-server ~]# <strong>tail -f /var/log/samba/log.nmbd
</strong>[2008/10/25 16:41:02,  0] nmbd/nmbd.c:main(849)
  nmbd version 3.2.3-0.20.fc9 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2008
[2008/10/25 16:41:02,  0] nmbd/asyncdns.c:start_async_dns(155)
  started asyncdns process 2161
[2008/10/25 16:41:02,  0] nmbd/nmbd_logonnames.c:add_logon_names(160)
  add_domain_logon_names:
  Attempting to become logon server for workgroup SMBLDAP on subnet 192.168.1.1
[2008/10/25 16:41:02,  0] nmbd/nmbd_logonnames.c:add_logon_names(160)
  add_domain_logon_names:
  Attempting to become logon server for workgroup SMBLDAP on subnet UNICAST_SUBNET
[2008/10/25 16:41:02,  0] nmbd/nmbd_become_dmb.c:become_domain_master_browser_wins(336)
  become_domain_master_browser_wins:
  Attempting to become domain master browser on workgroup SMBLDAP, subnet UNICAST_SUBNET.
[2008/10/25 16:41:02,  0] nmbd/nmbd_become_dmb.c:become_domain_master_browser_wins(350)
  become_domain_master_browser_wins: querying WINS server from IP 192.168.1.1 for domain master browser name SMBLDAP&lt;1b&gt; on workgroup SMBLDAP
[2008/10/25 16:41:02,  0] nmbd/nmbd_become_dmb.c:become_domain_master_query_success(234)
  become_domain_master_query_success:
 <span style="color: #ff0000;"> There is already a domain master browser at IP 10.1.0.1 for workgroup SMBLDAP registered on subnet UNICAST_SUBNET.
</span>[2008/10/25 16:41:02,  0] nmbd/nmbd_logonnames.c:become_logon_server_success(121)
  become_logon_server_success: Samba is now a logon server for workgroup SMBLDAP on subnet UNICAST_SUBNET
[2008/10/25 16:41:06,  0] nmbd/nmbd_logonnames.c:become_logon_server_success(121)
  become_logon_server_success: Samba is now a logon server for workgroup SMBLDAP on subnet 192.168.1.1
[2008/10/25 16:41:24,  0] nmbd/nmbd_become_lmb.c:become_local_master_stage2(395)
  *****</pre>
<pre>  Samba name server SAMBA-SERVER is now a local master browser for workgroup SMBLDAP on subnet 192.168.1.1</pre>
<pre>  *****
[2008/10/25 16:41:24,  0] libsmb/nmblib.c:send_udp(839)
 <span style="color: #ff0000;"> Packet send failed to 10.1.0.1(137) ERRNO=Network is unreachable
</span>[2008/10/25 16:41:24,  0] nmbd/nmbd_packets.c:send_netbios_packet(160)
 <span style="color: #ff0000;"> send_netbios_packet: send_packet() to IP 10.1.0.1 port 137 failed
</span>[2008/10/25 16:41:24,  0] nmbd/nmbd_nodestatus.c:node_status(87)
 <span style="color: #ff0000;"> node_status: Failed to send packet trying to get node status for name SMBLDAP&lt;1b&gt;, IP address 10.1.0.1</span></pre>
<pre>ใน Samba จะมีการเก็บข้อมูลของโดเมนว่า เครื่องใดทำหน้าที่อะไรบ้างในเน็ตเวิร์ก จะเก็บไว้ในหลายๆ ไฟล์ ไฟล์หนึ่งที่สามารถดูได้อย่างง่ายคือไฟล์ wins.dat</pre>
<p>ตัวอย่างไฟล์ wins.dat</p>
<pre>[root@samba-server ~]# <strong>cat /var/lib/samba/wins.dat</strong>
VERSION 1 0
"SMBLDAP#1e" 1225185500 0.0.0.0 e4R
"SAMBA-SERVER#00" 1225185500 10.1.0.1 192.168.1.1 66R
"SAMBA-SERVER#03" 1225185500 10.1.0.1 192.168.1.1 66R
"SMBLDAP#1b" 1225184635 10.1.0.1 64R
"SAMBA-SERVER#20" 1225185500 10.1.0.1 192.168.1.1 66R
"SMBLDAP#00" 1225185500 0.0.0.0 e4R
"SMBLDAP#1c" 1225185500 10.1.0.1 192.168.1.1 e4R</pre>
<p>จะเห็นได้ว่าไฟล์นี้ยังเก็บข้อมูล IP เก่าอยู่ ทำให้ Samba ทำงานได้ไม่ถูกต้อง</p>
<h4>การแก้ไข Samba หลังจากเปลี่ยน IP Address ของเครื่องเซิร์ฟเวอร์</h4>
<p>ขั้นตอนแรกต้อง stop เซอร์วิส Samba ก่อน ทั้ง smb และ nmb</p>
<p>ตัวอย่างการ stop เซอร์วิส Samba</p>
<pre>[root@samba-server ~]# <strong>service smb stop
</strong>Shutting down SMB services:                                [  OK  ]
[root@samba-server ~]# <strong>service nmb stop
</strong>Shutting down NMB services:                                [  OK  ]</pre>
<p>ลบไฟล์ที่เก็บข้อมูลของโดเมน โดยไฟล์เหล่านี้จะถูกสร้างขึ้นมาใหม่โดยอัตโนมัติหลังจากรันเซอร์วิส Samba อีกครั้ง</p>
<pre>[root@samba-server ~]# <strong>rm -f /var/lib/samba/wins.dat
</strong>[root@samba-server ~]# <strong>rm -f /var/lib/samba/browse.dat</strong>
[root@samba-server ~]# <strong>rm -f /var/lib/samba/gencache.tdb</strong></pre>
<p>รันเซอร์วิส Samba อีกครั้ง</p>
<pre>[root@samba-server ~]#<strong> service smb start
</strong>Starting SMB services:                                     [  OK  ]
[root@samba-server ~]# <strong>service nmb start</strong>
Starting NMB services:                                     [  OK  ]</pre>
<p>ตรวจสอบไฟล์ log.nmbd หลังการแก้ไข</p>
<pre>[root@samba-server ~]# tail -f /var/log/samba/log.nmbd
[2008/10/25 16:46:05,  0] nmbd/nmbd.c:main(849)
  nmbd version 3.2.3-0.20.fc9 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2008
[2008/10/25 16:46:05,  0] nmbd/asyncdns.c:start_async_dns(155)
  started asyncdns process 2269
[2008/10/25 16:46:05,  0] nmbd/nmbd_logonnames.c:add_logon_names(160)
  add_domain_logon_names:
  Attempting to become logon server for workgroup SMBLDAP on subnet 192.168.1.1
[2008/10/25 16:46:05,  0] nmbd/nmbd_logonnames.c:add_logon_names(160)
  add_domain_logon_names:
  Attempting to become logon server for workgroup SMBLDAP on subnet UNICAST_SUBNET
[2008/10/25 16:46:05,  0] nmbd/nmbd_become_dmb.c:become_domain_master_browser_wins(336)
  become_domain_master_browser_wins:
  Attempting to become domain master browser on workgroup SMBLDAP, subnet UNICAST_SUBNET.
[2008/10/25 16:46:05,  0] nmbd/nmbd_become_dmb.c:become_domain_master_browser_wins(350)
  become_domain_master_browser_wins: querying WINS server from IP 192.168.1.1 for domain master browser name SMBLDAP&lt;1b&gt; on workgroup SMBLDAP
[2008/10/25 16:46:05,  0] nmbd/nmbd_logonnames.c:become_logon_server_success(121)
  become_logon_server_success: Samba is now a logon server for workgroup SMBLDAP on subnet UNICAST_SUBNET
[2008/10/25 16:46:05,  0] nmbd/nmbd_become_dmb.c:become_domain_master_stage2(110)
  *****</pre>
<pre>  Samba server SAMBA-SERVER is now a domain master browser for workgroup SMBLDAP on subnet UNICAST_SUBNET</pre>
<pre>  *****
[2008/10/25 16:46:05,  0] nmbd/nmbd_become_dmb.c:become_domain_master_browser_bcast(291)
  become_domain_master_browser_bcast:
  Attempting to become domain master browser on workgroup SMBLDAP on subnet 192.168.1.1
[2008/10/25 16:46:05,  0] nmbd/nmbd_become_dmb.c:become_domain_master_browser_bcast(304)
  become_domain_master_browser_bcast: querying subnet 192.168.1.1 for domain master browser on workgroup SMBLDAP
[2008/10/25 16:46:09,  0] nmbd/nmbd_logonnames.c:become_logon_server_success(121)
  become_logon_server_success: Samba is now a logon server for workgroup SMBLDAP on subnet 192.168.1.1
[2008/10/25 16:46:13,  0] nmbd/nmbd_become_dmb.c:become_domain_master_stage2(110)
  *****</pre>
<pre>  Samba server SAMBA-SERVER is now a domain master browser for workgroup SMBLDAP on subnet 192.168.1.1</pre>
<pre>  *****
[2008/10/25 16:46:27,  0] nmbd/nmbd_become_lmb.c:become_local_master_stage2(395)
  *****</pre>
<pre>  Samba name server SAMBA-SERVER is now a local master browser for workgroup SMBLDAP on subnet 192.168.1.1</pre>
<pre>  *****</pre>
<p>ตรวจสอบไฟล์ wins.dat หลังการแก้ไข</p>
<pre>[root@samba-server ~]#<strong> cat /var/lib/samba/wins.dat
</strong>VERSION 1 0
"SMBLDAP#1e" 1225187165 0.0.0.0 e4R
"SAMBA-SERVER#00" 1225187165 192.168.1.1 66R
"SAMBA-SERVER#03" 1225187165 192.168.1.1 66R
"SMBLDAP#1b" 1225187165 192.168.1.1 64R
"SAMBA-SERVER#20" 1225187165 192.168.1.1 66R
"SMBLDAP#00" 1225187165 0.0.0.0 e4R
"SMBLDAP#1c" 1225187165 192.168.1.1 e4R</pre>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/10/changing_samba_pdc_ip_address/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ตรวจสอบสถานะของการ์ดเน็ตเวิร์กบนลีนุกซ์</title>
		<link>http://spalinux.com/2008/09/verify_lan_network_interface_status_on_linux</link>
		<comments>http://spalinux.com/2008/09/verify_lan_network_interface_status_on_linux#comments</comments>
		<pubDate>Sat, 20 Sep 2008 18:51:00 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=187</guid>
		<description><![CDATA[บทความนี้ขอแนะนำการใช้คำสั่ง ethtool บนลีนุกซ์เพื่อตรวจสอบสถานะของการ์ดเน็ตเวิร์กว่าเป็นอย่างไร เช่น สถานะของลิ้งก์ที่เชื่อมต่ออยู่ว่า Up หรือ Down ความเร็ว (speed) ของการเชื่อมต่อเท่าไร ลีนุกซ์ส่วนใหญ่มีคำสั่ง ethtool ติดตั้งมาอยู่แล้ว ไม่จะเป็นต้องติดตั้งเพิ่มแต่อย่างไร ตัวอย่างเวอร์ชั่นของ ethtool ที่ติดตั้งมากับ Fedora 9 [root@server ~]# rpm -q ethtool ethtool-6-1.fc9.x86_64 วิธีการใช้คำสั่ง ethtool การใช้คำสั่ง ethtool ต้องระบุการ์ดเน็ตเวิร์กที่ต้องการตรวจสอบ เช่นตัวอย่างด้านล่างเป็นการตรวจสอบสถานะของการ์ด eth0 [root@server ~]# ethtool eth0 Settings for eth0:         Supported ports: [ TP ]         Supported link modes:   10baseT/Half 10baseT/Full                                 100baseT/Half 100baseT/Full [...]]]></description>
			<content:encoded><![CDATA[<p>บทความนี้ขอแนะนำการใช้คำสั่ง ethtool บนลีนุกซ์เพื่อตรวจสอบสถานะของการ์ดเน็ตเวิร์กว่าเป็นอย่างไร เช่น สถานะของลิ้งก์ที่เชื่อมต่ออยู่ว่า Up หรือ Down ความเร็ว (speed) ของการเชื่อมต่อเท่าไร</p>
<p><span id="more-187"></span></p>
<p>ลีนุกซ์ส่วนใหญ่มีคำสั่ง ethtool ติดตั้งมาอยู่แล้ว ไม่จะเป็นต้องติดตั้งเพิ่มแต่อย่างไร</p>
<p>ตัวอย่างเวอร์ชั่นของ ethtool ที่ติดตั้งมากับ Fedora 9</p>
<pre>[root@server ~]# <strong>rpm -q ethtool
</strong>ethtool-6-1.fc9.x86_64</pre>
<h4>วิธีการใช้คำสั่ง ethtool</h4>
<p>การใช้คำสั่ง ethtool ต้องระบุการ์ดเน็ตเวิร์กที่ต้องการตรวจสอบ เช่นตัวอย่างด้านล่างเป็นการตรวจสอบสถานะของการ์ด eth0</p>
<pre>[root@server ~]# <strong>ethtool eth0
</strong>Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised auto-negotiation: Yes
<span style="color: #339966;">  </span><span style="color: #339966;"><strong>      Speed: 1000Mb/s
</strong>  </span><strong><span style="color: #339966;">      Duplex: Full
</span></strong>        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: g
        Current message level: 0x000000ff (255)
<strong><span style="color: #339966;">        Link detected: yes</span></strong></pre>
<p>ผลลัพธ์ที่ได้แสดงถึงสถานะของการ์ดเน็ตเวิร์กคร่าวๆ ดังนี้</p>
<ul>
<li><span style="color: #339966;"><strong>Link detected: yes</strong>    </span>สถานะการเชื่อมต่อ Up</li>
<li><span style="color: #339966;"><strong>Speed: 1000Mb/s </strong>    </span>เชื่อมต่อที่ความเร็ว 1000Mb/s หรือ Gigabit</li>
<li><span style="color: #339966;"><strong>Duplex: Full</strong>             </span>  สามารถรับส่งข้อความได้แบบ Full Duplex</li>
</ul>
<p>อีกตัวอย่างหนี่ง เป็นการตรวจสอบการ์ดเน็ตเวิร์กที่สถานะการเชื่อมต่อมีปัญหาหรือ Down</p>
<pre>[root@server ~]# <strong>ethtool eth1
</strong>Settings for eth1:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised auto-negotiation: Yes
<strong><span style="color: #ff0000;">        Speed: Unknown! (0)
</span></strong>        Duplex: Half
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: g
        Current message level: 0x000000ff (255)
 <strong><span style="color: #ff0000;">       Link detected: no</span></strong></pre>
<p>ผลลัพธ์ที่ได้คือ</p>
<ul>
<li><span style="color: #ff0000;"><strong>Link detected: no     </strong></span>สถานะการเชื่อมต่อ Down</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/09/verify_lan_network_interface_status_on_linux/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>การแก้ไขเมื่อลืม root password ในลินุกซ์</title>
		<link>http://spalinux.com/2008/09/linux_root_password_recovery</link>
		<comments>http://spalinux.com/2008/09/linux_root_password_recovery#comments</comments>
		<pubDate>Sat, 13 Sep 2008 09:22:51 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[root password recovery]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=150</guid>
		<description><![CDATA[รหัสผ่านของ root หรือ root password เป็นสิ่งสำคัญอย่างยิ่งในลินุกซ์ เพราะการแก้ไขทุกอย่างในลินุกซ์ต้องเข้าเป็น root ก่อนถึงจะทำได้ การลืมรหัสผ่านจึงทำให้เราไม่สามารถแก้ไขอะไรได้เลยในลินุกซ์ บทความนี้แนะนำวิธีหนึ่งที่สามารถแก้ไขปัญหาเมื่อลืมรหัสผ่านของ root ได้ แต่ต้องมีการรีบู๊ตเครื่อง ซึ่งทำให้เวลาแก้ไขระบบไม่สามารถใช้งานได้ โดยตัวอย่างในบทความนี้จะทดสอบบน Fedora 9 วิธีที่แนะนำคือการเข้าสู่โหมด single user ซึ่งจะเป็นโหมดที่ใช้ในการแก้ไขปัญหาหรือบำรุงรักษาเครื่อง ตัวอย่างอื่นๆ ที่ใช้โหมด single user ก่อนคือการสำรองข้อมูลแบบเต็มรูปแบบ (full backup) คำแนะนำ ถ้าระบบยังใช้งานได้อยู่ตามปกติ ให้ทำหลังจากเลิกการใช้งานแล้ว การเข้าสู่โหมด single user วิธีการเข้านั้นทำได้โดยต้องรีบู๊ตเครื่อง แต่ถ้าเราลืมรหัสผ่านของ root เราก็ไม่สามารถใช้คำสั่ง shutdown เพื่อทำการรีบู๊ตได้ วิธีหนึ่งที่ทำได้คือที่หน้าจอคอนโซลของเครื่องที่เราต้องการแก้ไข แล้วกดปุ่ม [Ctrl-Alt-Delete] โดยดีฟอลต์แล้ว การกดปุ่มสามปุ่มพร้อมกันนี้เป็นการสั่งให้รีบู๊ตเครื่อง แต่ถ้าเราไปปิดคุณสมบัตินี้ออกไป [ปรับแต่งเครื่องหลังจากติดตั้ง Fedora 9 - แก้ไขคอนโซล] จะเหลืออยู่วิธีเดียวคือต้องกดปุ่มปิดเครื่อง แล้วเปิดขึ้นมาใหม่ ขณะที่บู๊ตเครื่องเมื่อมีข้อความ [...]]]></description>
			<content:encoded><![CDATA[<p>รหัสผ่านของ root หรือ root password เป็นสิ่งสำคัญอย่างยิ่งในลินุกซ์ เพราะการแก้ไขทุกอย่างในลินุกซ์ต้องเข้าเป็น root ก่อนถึงจะทำได้ การลืมรหัสผ่านจึงทำให้เราไม่สามารถแก้ไขอะไรได้เลยในลินุกซ์</p>
<p>บทความนี้แนะนำวิธีหนึ่งที่สามารถแก้ไขปัญหาเมื่อลืมรหัสผ่านของ root ได้ แต่ต้องมีการรีบู๊ตเครื่อง ซึ่งทำให้เวลาแก้ไขระบบไม่สามารถใช้งานได้ โดยตัวอย่างในบทความนี้จะทดสอบบน Fedora 9</p>
<p><span id="more-150"></span></p>
<p>วิธีที่แนะนำคือการเข้าสู่โหมด single user ซึ่งจะเป็นโหมดที่ใช้ในการแก้ไขปัญหาหรือบำรุงรักษาเครื่อง ตัวอย่างอื่นๆ ที่ใช้โหมด single user ก่อนคือการสำรองข้อมูลแบบเต็มรูปแบบ (full backup)</p>
<p><strong>คำแนะนำ</strong> ถ้าระบบยังใช้งานได้อยู่ตามปกติ ให้ทำหลังจากเลิกการใช้งานแล้ว</p>
<h4>การเข้าสู่โหมด single user</h4>
<p>วิธีการเข้านั้นทำได้โดยต้องรีบู๊ตเครื่อง แต่ถ้าเราลืมรหัสผ่านของ root เราก็ไม่สามารถใช้คำสั่ง shutdown เพื่อทำการรีบู๊ตได้ วิธีหนึ่งที่ทำได้คือที่หน้าจอคอนโซลของเครื่องที่เราต้องการแก้ไข แล้วกดปุ่ม [Ctrl-Alt-Delete] โดยดีฟอลต์แล้ว การกดปุ่มสามปุ่มพร้อมกันนี้เป็นการสั่งให้รีบู๊ตเครื่อง แต่ถ้าเราไปปิดคุณสมบัตินี้ออกไป [<a href="http://spalinux.com/2008/09/fedora_9_post_installation_configure_console">ปรับแต่งเครื่องหลังจากติดตั้ง Fedora 9 - แก้ไขคอนโซล</a>] จะเหลืออยู่วิธีเดียวคือต้องกดปุ่มปิดเครื่อง แล้วเปิดขึ้นมาใหม่</p>
<p>ขณะที่บู๊ตเครื่องเมื่อมีข้อความ &#8220;<strong>Press any key to enter the menu</strong>&#8221;  ให้กดปุ่มอะไรก็ได้เพื่อเข้าสู่หน้าจอเมนู GRUB ซึ่งเป็นโปรแกรม boot loader โดยดีฟอลต์ของลินุกซ์</p>
<p>ตัวอย่างหน้าจอเมนูของ GRUB<br />
<img title="Fedora 9 GRUB Menu" src="http://spalinux.com/wp-content/uploads/2008/09/fedora_9_grub_menu.png" alt="Fedora 9 GRUB Menu" width="500" height="200" /></a></p>
<p>ในหน้าจอเมนู GRUB กดปุ่ม &#8216;<strong>e</strong>&#8216; เพื่อเข้าสู่เมนูย่อยเพื่อการแก้ไขค่าคอนฟิกสำหรับการบู๊ตเครื่อง</p>
<p>ตัวอย่างหน้าจอเมนูย่อยของ GRUB เพื่อการแก้ไขค่าคอนฟิก<br />
<img title="Fedora 9 GRUB Sub Menu" src="http://spalinux.com/wp-content/uploads/2008/09/fedora_9_grub_sub_menu.png" alt="Fedora 9 GRUB Sub Menu" width="500" height="200" /></a></p>
<p>ในหน้าจอเมนูย่อยจะมีอยู่สามบรรทัด ให้เลือกบรรทัดที่ขึ้นต้นด้วยคำว่า kernel แล้วกดปุ่ม &#8216;<strong>e</strong>&#8216; อีกครั้ง จะเข้าสู่ shell ของ GRUB ซึ่งจะอนุญาตให้เราแก้ไขค่าคอนฟิกได้ ให้พิมพ์คำว่า single ต่อท้ายบรรทัดลงไปแล้วกดปุ่ม <strong>[ Enter ]</strong> หน้าจอจะกลับมาที่เมนูย่อยอีกครั้ง กดปุ่ม &#8216;<strong>b</strong>&#8216; เพื่อการบู๊ตเครื่องด้วยค่าคอนฟิกใหม่</p>
<p>ตัวอย่างการเพิ่มคำว่า single ต่อท้าย<br />
<img title="Fedora 9 Append Single to GRUB" src="http://spalinux.com/wp-content/uploads/2008/09/fedora_9_append_single.png" alt="Fedora 9 Append Single to GRUB" width="500" height="200" /></a></p>
<p>เครื่องก็จะบู๊ตไปตามปกติ แต่จะรันโปรแกรมเฉพาะเพื่อให้เครื่องทำงานได้เท่านั้น เช่น mount disk ขึ้นมา และเมื่อบู๊ตเสร็จจะขึ้น root shell prompt ให้เราสามารถพิมพ์คำสั่งต่างๆ ได้เลย โดยไม่จำเป็นต้อง login แต่อย่างใด</p>
<p>ตัวอย่าง root shell prompt ในโหมด single user<br />
<img title="Fedora 9 Single User Shell Prompt" src="http://spalinux.com/wp-content/uploads/2008/09/fedora_9_single_user_shell.png" alt="Fedora 9 Single User Shell Prompt" width="500" height="278" /></a></p>
<p>เราสามารถใช้คำสั่ง passwd เพื่อแก้ไขรหัสผ่านของ root ได้เลย</p>
<p>ตัวอย่างการใช้คำสั่ง passwd เพื่อเปลี่ยนรหัสผ่านของ root</p>
<pre>[root@server /]# <strong>passwd root</strong>
Changing password for user root.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.</pre>
<p>หลังจากแก้ไขรหัสผ่านเรียบร้อย วิธีการกลับสู่โหมดการทำงานของเครื่องปกติ ให้พิมพ์คำสั่ง exit หรือกดปุ่ม <strong>[Ctrl-D]</strong> เพื่อออกสู่โหมด single user เครื่องจะรันโปรแกรมต่างๆ ขึ้นมา สุดท้ายจะขึ้น login เหมือนเดิม</p>
<pre>[root@server /]# <strong>exit</strong>
Bringing up loopback interface:        [ OK ]
Bringing up interface eth0:            [ OK ]
Starting system logger:                [ OK ]
...</pre>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/09/linux_root_password_recovery/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>แก้ไขปัญหาในการรัน VMware Server บน Fedora 9</title>
		<link>http://spalinux.com/2008/09/troubleshooting_vmware_server_on_fedora_9</link>
		<comments>http://spalinux.com/2008/09/troubleshooting_vmware_server_on_fedora_9#comments</comments>
		<pubDate>Sat, 06 Sep 2008 18:17:26 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=131</guid>
		<description><![CDATA[เพื่อสะดวกในการอ้างอิง จะขอแยกบทความที่กล่าวถึงปัญหาที่เกิดขึ้นในการรัน VMware Server บน Fedora 9 โดยจะแยกเป็นหัวข้อต่างๆ ตามข้อความที่ขึ้น วิธีการแก้ไข ก็เหมือนกับโปรแกรมอื่นๆ คือดูข้อความที่ขึ้นเตือนมา อีกส่วนหนึ่งที่ต้องดูเพิ่มเติมสำหรับการแก้ไขปัญหาของ VMware Server บนลินุกซ์ คือดูในไฟล์ /var/log/secure และไฟล์ /var/log/messages ตอนรัน vmware-config.pl มีข้อความว่าไม่สามารถหาไฟล์ /lib/ld-linux.so.2 ตัวอย่าง sh: /usr/bin/vmware-ping: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory การแก้ไข - ติดตั้ง glibc-2.8-3.i686.rpm ตอนรัน vmware-config.pl ขึ้นข้อความว่าไม่สามารถหาไฟล์ Library ที่จำเป็นในการรัน VMware Server ตัวอย่าง [root@vmware-host ~]# /usr/bin/vmware-config.pl The correct version of [...]]]></description>
			<content:encoded><![CDATA[<p>เพื่อสะดวกในการอ้างอิง จะขอแยกบทความที่กล่าวถึงปัญหาที่เกิดขึ้นในการรัน VMware Server บน Fedora 9 โดยจะแยกเป็นหัวข้อต่างๆ ตามข้อความที่ขึ้น</p>
<p>วิธีการแก้ไข ก็เหมือนกับโปรแกรมอื่นๆ คือดูข้อความที่ขึ้นเตือนมา อีกส่วนหนึ่งที่ต้องดูเพิ่มเติมสำหรับการแก้ไขปัญหาของ VMware Server บนลินุกซ์ คือดูในไฟล์ /var/log/secure และไฟล์ /var/log/messages</p>
<p><span id="more-131"></span></p>
<h4>ตอนรัน vmware-config.pl มีข้อความว่าไม่สามารถหาไฟล์ /lib/ld-linux.so.2</h4>
<p>ตัวอย่าง</p>
<pre>sh: /usr/bin/vmware-ping: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory</pre>
<p><strong>การแก้ไข</strong><br />
- ติดตั้ง glibc-2.8-3.i686.rpm</p>
<hr />
<h4>ตอนรัน vmware-config.pl ขึ้นข้อความว่าไม่สามารถหาไฟล์ Library ที่จำเป็นในการรัน VMware Server</h4>
<p>ตัวอย่าง</p>
<pre>
[root@vmware-host ~]# <strong>/usr/bin/vmware-config.pl</strong>
The correct version of one or more libraries needed to run VMware Server may be
missing.  This is the output of ldd /usr/bin/vmware:
        linux-gate.so.1 =&gt;  (0x00110000)
        libm.so.6 =&gt; /lib/libm.so.6 (0x0011e000)
        libdl.so.2 =&gt; /lib/libdl.so.2 (0x00147000)
        libpthread.so.0 =&gt; /lib/libpthread.so.0 (0x0014c000)
        libX11.so.6 =&gt; not found
        libXtst.so.6 =&gt; not found
        libXext.so.6 =&gt; not found
        libXt.so.6 =&gt; not found
        libICE.so.6 =&gt; not found
        libSM.so.6 =&gt; not found
        libXrender.so.1 =&gt; not found
        libz.so.1 =&gt; not found
        libc.so.6 =&gt; /lib/libc.so.6 (0x004d2000)
        /lib/ld-linux.so.2 (0x004b2000)
This program cannot tell for sure, but you may need to upgrade libc5 to glibc
before you can run VMware Server.
</pre>
<p><strong>การแก้ไข</strong><br />
ลงไฟล์ rpm ที่เป็น Library ต่างๆ ให้ครบ</p>
<ul>
<li>libXau-1.0.3-5.fc9.i386.rpm</li>
<li>libXdmcp-1.0.2-5.fc9.i386.rpm</li>
<li>libxcb-1.1-4.fc9.i386.rpm</li>
<li>libX11-1.1.4-1.fc9.i386.rpm</li>
<li>libXext-1.0.4-1.fc9.i386.rpm</li>
<li>libXtst-1.0.3-3.fc9.i386.rpm</li>
<li>libICE-1.0.4-3.fc9.i386.rpm</li>
<li>libSM-1.0.2-5.fc9.i386.rpm</li>
<li>libXt-1.0.4-5.fc9.i386.rpm</li>
<li>libXrender-0.9.4-3.fc9.i386.rpm</li>
<li>zlib-1.2.3-18.fc9.i386.rpm</li>
</ul>
<hr />
<h4>ตอนรัน vmware-config.pl ขึ้นข้อความว่าไม่สามารถหา kernel header file หรือ /usr/src/linux/include</h4>
<p>ตัวอย่าง</p>
<pre>What is the location of the directory of C header files that match your running
kernel? [/usr/src/linux/include]</pre>
<pre>The path "/usr/src/linux/include" is not an existing directory.</pre>
<p><strong>การแก้ไข<br />
</strong>ติดตั้ง rpm ไฟล์ชื่อ kernel-devel เพิ่มเติม</p>
<ul>
<li>สำหรับ i386 ติดตั้งไฟล์ kernel-devel-2.6.25-14.fc9.i386.rpm</li>
<li>สำหรับ x86_64 ติดตั้งไฟล์ kernel-devel-2.6.25-14.fc9.x86_64.rpm</li>
</ul>
<hr />
<h4>ตอนรัน vmware-config.pl ขึ้นข้อความว่าไม่มี inetd หรือ xinetd ติดตั้งอยู่ในเครื่อง</h4>
<p>ตัวอย่าง</p>
<pre>Unable to find any instance of the super-server "inetd" or "xinetd".  It is
possible that you do not have one of these packages installed on this machine.
Please install "inetd" or "xinetd".</pre>
<pre>If you do have "inetd" or "xinetd" installed, make sure that /etc/inetd.conf or
/etc/xinetd.d exists.
The configuration will continue, but you should re-run
/usr/bin/vmware-config.pl after you fix the super-server.</pre>
<p><strong>การแก้ไข<br />
</strong>ติดตั้ง rpm ไฟล์ชื่อ xinetd เพิ่มเติม</p>
<p>สำหรับ i386 ติดตั้งไฟล์ xinetd-2.3.14-18.fc9.i386.rpm<br />
สำหรับ x86_64 ติดตั้งไฟล์ xinetd-2.3.14-18.fc9.x86_64.rpm</p>
<hr />
<h4>ตอนรัน vmware-config.pl ขึ้นข้อความว่าไม่สามารถหา Perl module ชื่อ Embed.pm</h4>
<p>ตัวอย่าง</p>
<pre>Can't locate ExtUtils/Embed.pm in @INC (@INC contains: /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi
/usr/lib/perl5/5.10.0 /usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.0 /usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .).
BEGIN failed--compilation aborted.
Use of uninitialized value $inc in substitution (s///) at /usr/bin/vmware-config.pl line 6775.
Use of uninitialized value $inc in substitution (s///) at /usr/bin/vmware-config.pl line 6776.
Use of uninitialized value $inc in substitution (s///) at /usr/bin/vmware-config.pl line 6776.
Could not find necessary components to build the VMware VmPerl Scripting API.
Look in your Linux distribution to see if there is a perl-devel package.
Install that package if it exists and then re-run this installation program.</pre>
<pre>********
The VMware VmPerl Scripting API was not installed.  Errors encountered during
compilation and installation of the module can be found here:
/tmp/vmware-config0</pre>
<pre>You will not be able to use the "vmware-cmd" program.</pre>
<pre>Errors can be found in the log file:
'/tmp/vmware-config0/control-only/make.log'
********</pre>
<p><strong>การแก้ไข<br />
</strong>ติดตั้ง rpm ไฟล์ชื่อ xinetd เพิ่มเติม</p>
<ul>
<li>สำหรับ i386 ติดตั้งไฟล์ perl-ExtUtils-Embed-1.27-20.fc9.i386.rpm</li>
<li>สำหรับ x86_64 ติดตั้งไฟล์ perl-ExtUtils-Embed-1.27-20.fc9.x86_64.rpm</li>
</ul>
<hr />
<h4>ตอนรัน vmware-config.pl ขึ้นข้อความว่าไม่สามารถหา libX11 ได้ หรือขึ้นฟ้องว่า serial number ที่ใส่ไม่ถูกต้อง</h4>
<p>ตัวอย่าง</p>
<pre>/usr/lib/vmware/bin/vmware-vmx: error while loading shared libraries: libX11.so.6: cannot open shared object file:
No such file or directory
Please enter your 20-character serial number.</pre>
<pre>Type XXXXX-XXXXX-XXXXX-XXXXX or 'Enter' to cancel:  91N2W-YMR0Q-2544K-4UJV8</pre>
<pre>/usr/lib/vmware/bin/vmware-vmx: error while loading shared libraries: libX11.so.6: cannot open shared object file:
No such file or directory
The serial number 91N2W-YMR0Q-2544K-4UJV8 is invalid.</pre>
<p><strong>การแก้ไข</strong><br />
ลงไฟล์ rpm ที่เป็น Library ต่างๆ ให้ครบ</p>
<ul>
<li>libXau-1.0.3-5.fc9.i386.rpm</li>
<li>libXdmcp-1.0.2-5.fc9.i386.rpm</li>
<li>libxcb-1.1-4.fc9.i386.rpm</li>
<li>libX11-1.1.4-1.fc9.i386.rpm</li>
<li>libXext-1.0.4-1.fc9.i386.rpm</li>
<li>libXtst-1.0.3-3.fc9.i386.rpm</li>
<li>libICE-1.0.4-3.fc9.i386.rpm</li>
<li>libSM-1.0.2-5.fc9.i386.rpm</li>
<li>libXt-1.0.4-5.fc9.i386.rpm</li>
<li>libXrender-0.9.4-3.fc9.i386.rpm</li>
<li>zlib-1.2.3-18.fc9.i386.rpm</li>
</ul>
<hr />
<h4>ตอนรัน vmware-config.pl ขึ้นข้อความเตือนให้ใส่ Serial number</h4>
<p>ตัวอย่าง</p>
<pre>You cannot power on any virtual machines until you enter a valid serial number.
To enter the serial number, run this configuration program again, or choose
'Help &gt; Enter Serial Number' in the virtual machine console.</pre>
<p><strong>การแก้ไข</strong><br />
ใส่ Serial number ให้ถูกต้อง</p>
<hr />
<h4>ใช้โปรแกรม VMware Server Console รีโมตเข้าไป แต่ไม่สามารถเข้าได้ ฟ้องว่า Login (username/password) incorrect  ในไฟล์ /var/log/secure ขึ้นข้อความ</h4>
<p>ตัวอย่าง</p>
<pre>Sep  4 01:37:04 vmware-host vmware-authd[7944]: PAM unable to dlopen(/usr/lib/vmware/lib/libpam.so.0/security/pam_unix2.so):/usr/lib/vmware/lib/libpam.so.0/security/pam_unix2.so: cannot open shared object file: No such file or directory
Sep  4 01:37:04 vmware-host vmware-authd[7944]: PAM adding faulty module: /usr/lib/vmware/lib/libpam.so.0/security/pam_unix2.so
Sep  4 01:37:04 vmware-host vmware-authd[7944]: pam_unix_auth(vmware-authd:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=  user=root</pre>
<p><strong>การแก้ไข</strong><br />
- ลงไฟล์ rpm เพิ่มเติมดังนี้</p>
<ul>
<li>audit-libs-1.7.2-6.fc9.i386.rpm</li>
<li>cracklib-2.8.12-2.i386.rpm</li>
<li>libselinux-2.0.61-1.fc9.i386.rpm</li>
<li>pam-1.0.1-2.fc9.i386.rpm</li>
</ul>
<p>- แก้ไขไฟล์ /etc/pam.d/vmware-authd ให้ถูกต้อง โดยต้องแก้เป็นดังนี้</p>
<pre>[root@vmware-host ~]# cat /etc/pam.d/vmware-authd
#%PAM-1.0
auth       sufficient       pam_unix.so shadow nullok
auth       required         pam_unix_auth.so shadow nullok
account    sufficient       pam_unix.so
account    required         pam_unix_acct.so</pre>
<hr />
<h4>สร้าง Guest OS ไม่ได้ ดูในไฟล์ /var/log/messages มีข้อความ  libgcc_s.so.1 must be installed for pthread_cancel to work</h4>
<p><strong>การแก้ไข<br />
</strong>ติดตั้ง libgcc-4.3.0-8.i386.rpm</p>
<hr />
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/09/install_vmware_server_on_fedora_9">ติดตั้ง VMware Server บน Fedora 9</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/09/troubleshooting_vmware_server_on_fedora_9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>คอนฟิก Serial Port เพื่อใช้เป็น Console Redirection บนลินุกซ์</title>
		<link>http://spalinux.com/2008/08/configuring_serial_port_for_console_redirection_on_linux</link>
		<comments>http://spalinux.com/2008/08/configuring_serial_port_for_console_redirection_on_linux#comments</comments>
		<pubDate>Fri, 15 Aug 2008 15:13:53 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Utility]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=86</guid>
		<description><![CDATA[ในบางครั้งที่เกิดปัญหากับลินุกซ์จนทำให้ไม่สามารถจะ login, telnet หรือ ssh เข้าไปที่ตัวเครื่องได้ ซึ่งอาจเนื่องมาจาก network ที่ต่ออยู่มีปัญหาหรืออาจจะเป็นปัญหาอื่นๆ การที่จะแก้ปัญหาในเบื้องต้นจำเป็นต้องใช้หน้าจอ console ของเครื่องโดยตรงเพื่อ login เข้าไป ซึ่งการที่จะทำได้นั้น จำเป็นต้องมีคีย์บอร์ดและจอภาพต่ออยู่ ซึ่งถ้ามีอยู่แล้วหรือใช้เป็นแบบ KVM ก็สามารถทำได้ทันที แต่ในบางกรณีไม่ได้ต่ออุปกรณ์จำพวกนี้ไว้ ต้องไปหามาแล้วยกมาจากที่อื่น บางทีอาจต้องไปถอดจากเครื่องอื่นมาทำให้ไม่สะดวก วิธีการหนึ่งที่ทำได้ แต่ต้องคอนฟิกไว้ตั้งแต่ตอนต้น ก่อนเกิดปัญหาคือ การใช้ console ผ่านทาง Serial Port หรือ COM Port ของเครื่อง โดยคอนฟิกพอร์ตนี้ให้ทำหน้าที่เป็น console ของเครื่อง แล้วใช้เครื่องอื่นๆ เช่น notebook ต่อสาย console เข้าไป ก็สามารถที่จะ login ผ่าน console ได้ ถ้าเปรียบเทียบก็เหมือนกับใช้ notebook ต่อสาย console เข้ากับอุปกรณ์ network ที่มีแต่ [...]]]></description>
			<content:encoded><![CDATA[<p>ในบางครั้งที่เกิดปัญหากับลินุกซ์จนทำให้ไม่สามารถจะ login, telnet หรือ ssh เข้าไปที่ตัวเครื่องได้ ซึ่งอาจเนื่องมาจาก network ที่ต่ออยู่มีปัญหาหรืออาจจะเป็นปัญหาอื่นๆ</p>
<p>การที่จะแก้ปัญหาในเบื้องต้นจำเป็นต้องใช้หน้าจอ console ของเครื่องโดยตรงเพื่อ login เข้าไป ซึ่งการที่จะทำได้นั้น จำเป็นต้องมีคีย์บอร์ดและจอภาพต่ออยู่ ซึ่งถ้ามีอยู่แล้วหรือใช้เป็นแบบ KVM ก็สามารถทำได้ทันที แต่ในบางกรณีไม่ได้ต่ออุปกรณ์จำพวกนี้ไว้ ต้องไปหามาแล้วยกมาจากที่อื่น บางทีอาจต้องไปถอดจากเครื่องอื่นมาทำให้ไม่สะดวก</p>
<p>วิธีการหนึ่งที่ทำได้ แต่ต้องคอนฟิกไว้ตั้งแต่ตอนต้น ก่อนเกิดปัญหาคือ การใช้ console ผ่านทาง Serial Port หรือ COM Port ของเครื่อง โดยคอนฟิกพอร์ตนี้ให้ทำหน้าที่เป็น console ของเครื่อง แล้วใช้เครื่องอื่นๆ เช่น notebook ต่อสาย console เข้าไป ก็สามารถที่จะ login ผ่าน console ได้ ถ้าเปรียบเทียบก็เหมือนกับใช้ notebook ต่อสาย console เข้ากับอุปกรณ์ network ที่มีแต่ Serial Port เท่านั้น เช่น Cisco, 3Com, Alcatel,..</p>
<p><span id="more-86"></span></p>
<p>คุณสมบัตินี้โดยทั่วไปเรียกกันว่า Console Redirection ซึ่งถ้าเป็นเครื่องระดับ server ของ IBM, HP, Dell จะมีคุณสมบัติพวกนี้ติดมาอยู่แล้ว ส่วนถ้าเป็นเครื่อง PC ทั่วไปต้องตรวจสอบจากเครื่องหรือ mainboard ดู ว่ามีหรือไม่ ถ้ามีก็สามารถทำได้เหมือนกัน ในที่นี้จะแสดงตัวอย่างการคอนฟิกบนเครื่อง IBM x3400</p>
<p><strong>การเปิดคุณสมบัติ Console Redirection ใน BIOS ของเครื่องที่รันลินุกซ์<br />
</strong>เริ่มต้นต้อง reboot เครื่องเพื่อเข้าสู่โหมดคอนฟิก BIOS ของเครื่อง เพื่อเปิดคุณสมบัติ (enable) Console Redirection ซึ่งส่วนใหญ่โดยดีฟอลต์คุณสมบัตินี้จะถูกปิดอยู่ (disable) ลองหาเมนูที่เกี่ยวกับ I/O port สำหรับเครื่อง IBM x3400 จะอยู่ในเมนู Device and I/O Ports</p>
<p>หลังจากเปิดคุณสมบัติแล้ว จะมีเมนูย่อยเพื่อให้ตั้งค่าต่างๆ เกี่ยวกับ Serial Port โดยจะมีค่าต่างๆ เช่น Baud Rate, Flow Control, Type ซึ่งด้านล่างจะเป็นตัวอย่างการตั้งค่าคอนฟิก Serial Port ของเครื่อง IBM x3400</p>
<pre>Console Redirection:
 Remote Console Serial Port [<strong>COM1</strong>]
 Baud Rate: <strong>115.2K
</strong> Console Type: <strong>VT100
</strong> Flow Control [<strong>CTS/RTS</strong>]
 Console Connection: [<strong>Direct</strong>]
 Console Redirection after POST: [<strong>On</strong>]</pre>
<p>ความหมายของค่าต่างๆ จะมีดังนี้</p>
<ul>
<li> Remote Console Serial Port : เลือกว่าจะใช้พอร์ตไหนเพื่อทำหน้าที่เป็น console โดยทั่วไปก็เลือกได้เป็น COM1 หรือ COM2</li>
<li> Baud Rate : เลือกความเร็วในการรับส่งข้อมูล ซึ่งต้องตรงกับการตั้งค่าในโปรแกรมที่จะทำหน้าที่เป็น Terminal ด้วย ในที่นี้เลือกไว้สูงสุด 115.2K ซึ่งอาจต้องจดจำค่านี้ไปด้วย เพื่อไปตั้งค่าในโปรแกรม Terminal เพราะว่าถ้าความเร็วนี้ไม่ตรงก็ไม่สามรถ console ได้</li>
<li>Console Type : เลือกชนิดของ Terminal</li>
<li>Flow Control : การควบคุมการส่งข้อมูลผ่าน console แนะนำให้เลือกเป็น CTS/RTS (ใน HyperTerminal จะเรียกเป็น Hardware)</li>
<li>Console Connection : ลักษณะการเชื่อมต่อ</li>
<li>Console Redirection after POST : โดยดีฟอลต์ คุณสมบัติของ Console Redirection จะมีผลตอนบู๊ตเครื่องเท่านั้น หลังจากที่ขึ้นเมนูบู๊ตของ OS แล้ว เช่นอยู่ใน grub แล้ว คุณสมบัตินี้จะปิดไป   ต้องเปิดคุณสมบัตินี้หลังจากการบู๊ตเครื่องเสร็จด้วย เพื่อให้สามารถ login ได้</li>
</ul>
<p><strong>การรันโปรแกรม  Terminal บน Notebook และต่อสาย console</strong><br />
เราสามารถใช้สาย console ที่ใช้กับอุปกรณ์เช่น Cisco ได้ เพียงแต่ต้องมีหัวแปลงเพิ่มเติมตรงปลายสายจาก RJ45 – DB9 เพื่อต่อเข้ากับ Serial Port ของเครื่องลินุกซ์</p>
<p>แล้วก็ใช้โปรแกรม Terminal เช่น HyperTerminal โดยต้องตั้งค่าโปรแกรมให้ตรงกับที่ตั้งใน BIOS ของเครื่องลินุกซ์ เช่น Baud Rate และ Flow Control</p>
<p>หลังจากต่อสายและคอนฟิกโปรแกรม Terminal เรียบร้อย ก็บู๊ตเครื่องลินุกซ์อีกครั้งหนึ่ง ตอนนี้ข้อความต่างๆ ตอนบู๊ตเครื่อง จะมาแสดงในหน้าโปรแกรม Terminal ด้วย</p>
<p><strong>แก้ไขคอนฟิก grub.conf<br />
</strong>เมื่อบู๊ตเครื่องขึ้นมาเสร็จเรียบร้อย จะยังไม่สามารถ login ผ่าน console ได้ ต้องแก้ไขคอนฟิกเพิ่มเติม  สำหรับ grub ต้องเพิ่มคอนฟิก “console=ttyS0,115200 console=tty1” เข้าไปในไฟล์ /etc/grub.conf โดยอยู่ต่อท้ายบรรทัดที่มีการระบุ kernel ที่ใช้บู๊ตเครื่อง</p>
<p>ตัวอย่างการเพิ่มคอนฟิกเข้าไปในไฟล์ /etc/grub.conf  ใน Fedora 9</p>
<pre>default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.25-14.fc9.x86_64)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.25-14.fc9.x86_64 ro root=UUID=xxx  <strong>console=ttyS0,115200 console=tty1</strong>
        initrd /boot/initrd-2.6.25-14.fc9.x86_64.img</pre>
<p><strong>แก้ไขคอนฟิก inittab หรือ event.d</strong><br />
ส่วนการแก้ไขไฟล์ inittab นั้นจะแตกต่างกันระหว่างลินุกซ์เวอร์ชั่นใหม่กับเก่า ซึ่งจะมีการคอนฟิก inittab แตกต่างกัน สำหรับ Fedora นั้น เวอร์ชั่นเก่าๆ ถึง Fedora 8 จะใช้ไฟล์ /etc/inittab แต่ถ้าเป็น Fedora 9 คอนฟิกจะแยกเป็นไฟล์อยู่ใน /etc/event.d/</p>
<p>ตัวอย่างการเพิ่มคอนฟิกในไฟล์ /etc/inittab ให้เพิ่มบรรทัดนี้เข้าไปต่อท้ายไฟล์ /etc/inittab &lt;= Fedora 8</p>
<pre>s0:2345:respawn:/sbin/agetty -h ttyS0 115200 vt100</pre>
<p>ในกรณีนี้ หลังจากแก้ไขไฟล์ /etc/inittab เพื่อให้มีผลเลย ต้องใช้คำสั่ง init q เพื่อให้ระบบมีการอ่านไฟล์ /etc/inittab</p>
<p>หมายเหตุ การอ้างอิง Serial Port หรือ console บนลินุกซ์นั้น จะอ้างอิงชื่อเป็น ttyS0, ttyS1</p>
<p>ส่วนเวอร์ชั่นใหม่ๆ นั้น คอนฟิกของ init จะถูกแยกเป็นไฟล์ต่างๆ อยู่ใน /etc/event.d/ ซึ่งถ้ามีคอนฟิกเพิ่มเติม ต้องมีการสร้างไฟล์ใหม่ ในที่นี้จะใช้ชื่อเป็น ttyS0</p>
<p>ตัวอย่างไฟล์คอนฟิก /etc/event.d/ttyS0 Fedora 9</p>
<pre># ttyS0 - agetty
#
# Console Redirection</pre>
<pre>start on stopped rc2
start on stopped rc3
start on stopped rc4
start on started prefdm</pre>
<pre>stop on runlevel 0
stop on runlevel 1
stop on runlevel 6</pre>
<pre>respawn
exec /sbin/agetty -h ttyS0 115200 vt100</pre>
<p>เมื่อเพิ่มไฟล์เข้าไปใน /etc/event.d/ ต้องรันคำสั่ง initctl ตามตัวอย่างต่อไปนี้</p>
<pre>[root@server ~]# <strong>initctl start ttyS0
</strong>ttyS0 (start) waiting
ttyS0 (start) starting
ttyS0 (start) pre-start
ttyS0 (start) spawned, process 2504
ttyS0 (start) post-start, (main) process 2504
ttyS0 (start) running, process 2504</pre>
<p><strong>แก้ไขคอนฟิก /etc/ securetty<br />
</strong>สุดท้ายต้องเพิ่มบรรทัดที่มี ttyS0 เข้าไปในไฟล์ /etc/securetty ด้วย เพื่ออนุญาตให้ root สามารถ login ผ่าน ttyS0 ได้ด้วย มิฉะนั้น root จะไม่สามารถ login ผ่าน console ได้เลย</p>
<p><strong>สรุป<br />
</strong>เมื่อแก้ไขคอนฟิกต่างๆ แล้ว ก็สามารถจะ login ทาง console โดยผ่าน Serial Port ได้แล้ว โดยไม่จำเป็นต้องใช้คีย์บอร์ดหรือจอภาพเพื่อต่อเข้ากับเครื่องอีกต่อไป เหมาะสำหรับคอนฟิกเผื่อไว้ สำหรับในกรณีฉุกเฉิน</p>
<p>ถ้าทดลองบู๊ตเครื่องอีกครั้งการแก้ไขไฟล์ /etc/grub.conf จะทำให้ข้อความต่างๆ ตอนที่ลินุกซ์บู๊ตนั้น จะแสดงผลผ่านทาง console ด้วย ทำให้เราสามารถที่จะวิเคราะห์ปัญหาได้</p>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/08/configuring_serial_port_for_console_redirection_on_linux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ทดสอบแก้ไขดิสก์ที่มีปัญหาใน Software-RAID บนลินุกซ์</title>
		<link>http://spalinux.com/2008/08/troubleshooting_software_raid_on_linux</link>
		<comments>http://spalinux.com/2008/08/troubleshooting_software_raid_on_linux#comments</comments>
		<pubDate>Sat, 09 Aug 2008 13:11:04 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Filesystem]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[RAID]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=78</guid>
		<description><![CDATA[หลังจากที่เราคอนฟิก Software RAID จากบทความที่ผ่านมาแล้ว ในบทความนี้จะกล่าวถึงวิธีการทดสอบในกรณีที่ดิสก์มีปัญหา วิธีการแก้ไข การป้องกันโดยเพิ่มดิสก์เพื่อทำหน้าที่เป็น spare สถานการณ์ปกติหลังจากคอนฟิก RAID-5 เริ่มต้นจะเราจะสร้าง RAID-5 ที่ประกอบด้วยดิสก์จำนวน 3 partition ซึ่งประกอบด้วย /dev/sdb1, /dev/sdc1, /dev/sdd1 ตัวอย่างการสร้าง RAID-5 [root@test-raid ~]# mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 mdadm: layout defaults to left-symmetric mdadm: chunk size defaults to 64K mdadm: size set to 987840K mdadm: array /dev/md0 started. ให้รอจนกว่าการสถานะการ build ข้อมูลของ [...]]]></description>
			<content:encoded><![CDATA[<p>หลังจากที่เราคอนฟิก Software RAID จากบทความที่ผ่านมาแล้ว ในบทความนี้จะกล่าวถึงวิธีการทดสอบในกรณีที่ดิสก์มีปัญหา วิธีการแก้ไข การป้องกันโดยเพิ่มดิสก์เพื่อทำหน้าที่เป็น spare</p>
<p><span id="more-78"></span></p>
<p><strong>สถานการณ์ปกติหลังจากคอนฟิก RAID-5</strong><br />
เริ่มต้นจะเราจะสร้าง RAID-5 ที่ประกอบด้วยดิสก์จำนวน 3 partition ซึ่งประกอบด้วย /dev/sdb1, /dev/sdc1, /dev/sdd1</p>
<p>ตัวอย่างการสร้าง RAID-5</p>
<pre>[root@test-raid ~]# <strong>mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1</strong>
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: size set to 987840K
mdadm: array /dev/md0 started.</pre>
<p>ให้รอจนกว่าการสถานะการ build ข้อมูลของ RAID-5 ครบ 100% แล้วสร้าง filesystem เพื่อ mount เข้ากับ /export</p>
<pre>[root@test-raid ~]#  <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 sdd1[2] sdc1[1] sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

unused devices: &lt;none&gt;

[root@test-raid ~]# <strong>mkfs.ext3 /dev/md0</strong>
[root@test-raid ~]# <strong>mount /dev/md0 /export</strong></pre>
<p><strong>เมื่อดิสก์มีปัญหา (fail)</strong><br />
เราสามารถใช้คำสั่ง mdadm &#8211;fail เพื่อใช้ในการจำลองสถานการณ์ว่าดิสก์มีปัญหา เพื่อดูผลกระทบที่เกิดขึ้น โดยไม่จำเป็นต้องไปดึงดิสก์ออกจริงๆ ซึ่งเสี่ยงต่ออุปกรณ์เสียหาย</p>
<p>ตัวอย่างการใช้คำสั่ง mdadm &#8211;fail เพื่อจำลองว่าดิสก์ /dev/sdc มีปัญหา</p>
<pre>[root@test-raid ~]# <strong>mdadm /dev/md0 --fail /dev/sdc1</strong>
mdadm: set /dev/sdc1 faulty in /dev/md0</pre>
<p>ตรวจสอบสถานะ RAID-5 เมื่อดิสก์มีปัญหา</p>
<pre>[root@test-raid ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 sdd1[2] <span style="color: #ff0000;"><strong>sdc1[3](F)</strong></span> sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/2] [U_U]

unused devices: &lt;none&gt;</pre>
<p>จากไฟล์ /proc/mdstat จะเห็นการเปลี่ยนแปลงคือ สถานะในวงเล็บหลัง sdc1 เปลี่ยนเป็นตัวอักษร F ซึ่งหมายถึงดิสก์นี้มีปัญหา (fail)</p>
<p>เนื่องจากเป็น RAID-5 ทำให้ /dev/md0 ยังสามารถใช้งานได้อยู่ในกรณีที่ดิสก์มีปัญหาก้อนเดียว โดยข้อมูลไม่เสียหาย ซึ่งสามารถตรวจสอบได้ ในที่เรา mount ไว้ ซึ่งยังสามารถเขียน/อ่าน ข้อมูลต่างๆ ได้ตามปกติ</p>
<p><strong>การคอนฟิกดิสก์ที่มีปัญหาออกจาก RAID</strong><br />
เมื่อดิสก์ที่มีปัญหาไม่ว่าจากการคอนฟิกโดยใช้คำสั่ง mdadm หรือเสียจริงๆ ที่อุปกรณ์เลย การแก้ไขในเบื้องต้น ต้องเอาคอนฟิกของดิสก์นั้นออกจาก RAID</p>
<p>ตัวอย่างการใช้คำสั่ง mdadm &#8211;remove เพื่อเอาคอนฟิกของดิสก์ที่มีปัญหาออก</p>
<pre>[root@test-raid ~]# <strong>mdadm /dev/md0 --remove /dev/sdc1</strong>
mdadm: hot removed /dev/sdc1</pre>
<p>ตรวจสอบสถานะของ RAID หลังจากที่เอาคอนฟิกดิสก์ที่มีปัญหาออก</p>
<pre>[root@test-raid ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 sdd1[2] sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/2] [U_U]

unused devices: &lt;none&gt;</pre>
<p>จากผลลัพธ์ ดิสก์ที่มีปัญหา (sdc) จะหายไป ถ้าเสียที่อุปกรณ์จริงๆ ก็ต้องดึงดิสก์ออกจากเครื่อง เพื่อเปลี่ยนตัวใหม่เข้ามาแทน</p>
<p><strong>การเปลี่ยนดิสก์ก้อนใหม่เข้าไปใน RAID</strong><br />
เมื่อได้ดิสก์ก้อนใหม่ที่ใช้งานได้แล้ว ต้องคอนฟิกเพื่อเพิ่มดิสก์ก้อนนี้เข้าไปใน RAID</p>
<p>ตัวอย่างการใช้คำสั่ง mdadm &#8211;add เพื่อเพิ่มดิสก์ก้อนใหม่เข้าไปใน RAID</p>
<pre>[root@test-raid ~]# <strong>mdadm /dev/md0 --add /dev/sdc1</strong>
mdadm: re-added /dev/sdc1</pre>
<p>เมื่อเพิ่มดิสก์เข้าไปใหม่ จะมีการ re-build ข้อมูลใน RAID-5 ใหม่อีกครั้ง เพื่อทำให้คอนฟิกกลับมาเป็นปกติ</p>
<p>ตัวอย่างสถานะของ RAID-5 ในขณะที่มีการ re-build ข้อมูลใหม่</p>
<pre>[root@test-raid ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 sdc1[3] sdd1[2] sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/2] [U_U]
      [==&gt;..................]  recovery = 12.2% (121296/987840) finish=1.7min speed=8086K/sec

unused devices: &lt;none&gt;</pre>
<p>ตัวอย่างสถานะของ RAID-5 เมื่อการ re-build เสร็จสิ้น</p>
<pre>[root@test-raid ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 sdc1[1] sdd1[2] sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

unused devices: &lt;none&gt;</pre>
<p>จากที่ดิสก์มีปัญหาหนึ่งก้อน ดึงดิสก์ก้อนที่มีปัญหาออก เปลี่ยนดิสก์ใหม่ที่ใช้ได้ลงไป จนถึง re-build ข้อมูลใน RAID-5 ใหม่ ผู้ใช้งานทั่วไป (users) ยังสามารถที่จะเขียน/อ่าน ข้อมูลได้ตลอดเวลา โดยอาจมีผลกระทบบ้างเช่นความเร็วจะลดลง</p>
<p><strong>การเพิ่มดิสก์เพื่อทำหน้าที่เป็น Spare</strong></p>
<p>ถึงแม้ RAID-5 จะรองรับปัญหาในกรณีที่ดิสก์เสียได้ก้อนนึง แต่ข้อควรระวังอย่างหนึ่งคือ ในช่วงที่รออุปกรณ์ใหม่มาทดแทนเพื่อเปลี่ยน จะมีดิสก์ที่เสียอีกไม่ได้แล้ว ซึ่งถ้าเสียอีกหนึ่งก้อน ข้อมูลทั้งหมดจะเสียหายไปเลย</p>
<p>วิธีการหนึ่งที่ช่วยแก้ไขปัญหานี้ได้คือคอนฟิกดิสก์เปล่าๆ ก้อนหนึ่งเพื่อทำหน้าที่เป็น spare โดยดิสก์ที่เป็น spare นี้ในสถานการณ์ปกติจะไม่ถูกนำมาใช้งาน แต่จะถูกใช้โดยอัตโนมัติในกรณีที่ดิสก์ที่คอนฟิกอยู่ใน RAID-5 มีปัญหาเท่านั้น</p>
<p>ตัวอย่างการเพิ่ม /dev/sde เพื่อทำหน้าที่เป็น spare</p>
<pre>[root@test-raid ~]# <strong>mdadm /dev/md0 --add /dev/sde1</strong>
mdadm: added /dev/sde1</pre>
<p>สถานะของ RAID เมื่อมีการเพิ่มดิสก์เพื่อทำหน้าที่เป็น spare</p>
<pre>[root@test-raid ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 <span style="color: #0000ff;"><strong>sde1[3](S)</strong></span> sdc1[1] sdd1[2] sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

unused devices: &lt;none&gt;</pre>
<p>จากผลลัพธ์สถานะของดิสก์ที่ทำหน้าที่เป็น spare จะมีตัวอักษร S อยู่ในวงเล็บ</p>
<p><strong>ทดสอบการทำงานของ spare เมื่อดิสก์ใน RAID มีปัญหา</strong><br />
เราสามารถทดสอบการทำงานของ spare ได้ โดยจำลองว่าดิสก์ที่อยู่ใน RAID ก้อนหนึ่งมีปัญหา เช่นสมมติว่า sdd เสียหายไป</p>
<pre>[root@test-raid ~]# <strong>mdadm /dev/md0 --fail /dev/sdd1</strong>
mdadm: set /dev/sdd1 faulty in /dev/md0</pre>
<p>ตรวจสอบสถานะของ RAID ในกรณีที่มีดิสก์ spare</p>
<pre>[root@test-raid ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 <span style="color: #0000ff;"><strong>sde1[3]</strong></span> sdc1[1] <span style="color: #ff0000;"><strong>sdd1[4](F)</strong></span> sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_]
      [====&gt;................]  recovery = 21.3% (211584/987840) finish=1.5min speed=8463K/sec

unused devices: &lt;none&gt;</pre>
<p>จากผลลัพธ์จะเห็นว่าดิสก์ spare จะถูกนำมาอยู่ใน RAID โดยอัตโนมัติเลย โดยเปลี่ยนตัวอักษรจาก (S) เป็น (3) และเมื่อถูก re-build เรียบร้อยจะเปลี่ยนเป็น (2)</p>
<p>ตัวอย่างสถานะของ RAID-5 เมื่อดิสก์ spare ถูกนำมารวมเรียบร้อย</p>
<pre>[root@test-raid ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 sde1[2] sdc1[1] sdd1[3](F) sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

unused devices: &lt;none&gt;</pre>
<p><strong>การเปลี่ยนดิสก์ที่มีปัญหาในกรณีที่มี spare</strong><br />
จากตัวอย่างที่แล้ว เราทำให้ /dev/sdd มีปัญหา การแก้ไขก็ต้องเอาคอนฟิกออกไป แล้วเพิ่มกลับเข้าไปใหม่</p>
<p>แต่ให้สังเกตว่า ในกรณีที่มีดิสก์ spare อยู่แล้ว เมื่อเปลี่ยนดิสก์อันใหม่ลงไปแทนที่ดิสก์ที่มีปัญหา ดิสก์ก้อนนี้จะถูกตั้งให้เป็น spare แทน จะไม่มีการ re-build เพื่อรวมดิสก์ที่เพิ่งเปลี่ยนเข้าไปใหม่</p>
<pre>[root@test-raid ~]# <strong>mdadm /dev/md0 --remove /dev/sdd1</strong>
mdadm: hot removed /dev/sdd1

[root@test-raid ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 sde1[2] sdc1[1] sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

unused devices: &lt;none&gt;

[root@test-raid ~]# <strong>mdadm /dev/md0 --add /dev/sdd1</strong>
mdadm: added /dev/sdd1

[root@test-raid ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 sdd1[3](S) sde1[2] sdc1[1] sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

unused devices: &lt;none&gt;

<strong>การคอนฟิกดิสก์ spare ตอนเริ่มต้นสร้าง RAID-5</strong>
ถ้าต้องการคอนฟิกดิสก์ spare ตั้งแต่เริ่มต้นสร้าง RAID สามารถทำได้ โดยเพิ่ม option ลงไปดังนี้

ตัวอย่างการสร้าง RAID-5 พร้อมดิสก์ spare
<pre>[root@test-raid ~]# <strong>mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 --spare-devices=1  /dev/sde1</strong>
[root@test-raid ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid5 sdd1[4] sde1[3](S) sdc1[1] sdb1[0]
      1975680 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_]
      [&gt;....................]  recovery =  2.4% (24836/987840) finish=1.2min speed=12418K/sec

unused devices: &lt;none&gt;</pre>
</pre>
<p><strong>ข้อมูลอ้างอิง</strong></p>
<ul>
<li><a href="http://spalinux.com/2008/08/creating_software_raid_on_linux">การสร้าง Software RAID บนลินุกซ์ </a></li>
<li><a href="http://linux-raid.osdl.org" target="_blank">Linux Raid</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/08/troubleshooting_software_raid_on_linux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
