<?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>Just My Life &#187; troubleshooting</title>
	<atom:link href="http://imrgill.com/tag/troubleshooting/feed/" rel="self" type="application/rss+xml" />
	<link>http://imrgill.com</link>
	<description>I&#039;m mrGilL, I&#039;m Newbie Admin</description>
	<lastBuildDate>Thu, 02 Sep 2010 08:25:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>แก้ปัญหา VirtualBox เรียกใช้งานอุปกรณ์ USB ไม่ได้บน Ubuntu</title>
		<link>http://imrgill.com/2009/11/11/how-to-fix-usb-device-problem-for-virtualbox-on-ubuntu.html</link>
		<comments>http://imrgill.com/2009/11/11/how-to-fix-usb-device-problem-for-virtualbox-on-ubuntu.html#comments</comments>
		<pubDate>Tue, 10 Nov 2009 17:47:56 +0000</pubDate>
		<dc:creator>mrgill</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://imrgill.com/?p=350</guid>
		<description><![CDATA[ผมเคยเจอปัญหา VirtualBox เรียกใช้งานอุปกรณ์ USB ไม่ได้ตั้งแต่สมัย Version แรกๆ ตอนนั้นเลยไม่ประทับใจมันเท่าไหร่ และไม่คิดจะแก้ปัญหามันด้วย ตอนที่ผมเพิ่งลง Ubuntu 9.10 ใหม่ๆ ก็ลองติดตั้ง Virtualbox แล้วลง Windows XP ปรากฏว่ามันมองเห็น Flash Drive ที่ผมเสียบเข้าไป จนมาวันนี้ผมเพิ่งสังเกตว่ามันใช้งาน USB ไม่ได้อีกแล้ว ก็เลยลองหาคำตอบจากเน็ตก็ได้คำตอบว่าต้องเพิ่มชื่อ User ของเราให้อยู่ Group เดียวกับ vboxusers โดยสามารถเข้าไปแก้ไขไฟล์ /etc/group ได้โดยตรง mrgill@mrgill-laptop:~$ sudo nano /etc/group เพิ่มชื่อ user ของคุณหลัง group vboxusers vboxusers:x:123:mrgill หรือจะใช้คำสั่งด้านล้างก็ได้ mrgill@mrgill-laptop:~$ sudo usermod -G vboxusers -a `whoami` ตัวอย่างผมใส่ `whoami` แทน [...]]]></description>
			<content:encoded><![CDATA[<p>ผมเคยเจอปัญหา VirtualBox เรียกใช้งานอุปกรณ์ USB ไม่ได้ตั้งแต่สมัย Version แรกๆ ตอนนั้นเลยไม่ประทับใจมันเท่าไหร่ และไม่คิดจะแก้ปัญหามันด้วย ตอนที่ผมเพิ่งลง Ubuntu 9.10 ใหม่ๆ ก็ลองติดตั้ง Virtualbox แล้วลง Windows XP ปรากฏว่ามันมองเห็น Flash Drive ที่ผมเสียบเข้าไป จนมาวันนี้ผมเพิ่งสังเกตว่ามันใช้งาน USB ไม่ได้อีกแล้ว ก็เลยลองหาคำตอบจากเน็ตก็ได้คำตอบว่าต้องเพิ่มชื่อ User ของเราให้อยู่ Group เดียวกับ vboxusers โดยสามารถเข้าไปแก้ไขไฟล์ /etc/group ได้โดยตรง</p>
<pre>
<div class="codesnip-container" >mrgill@mrgill-laptop:~$ sudo nano /etc/group</div>
</pre>
<p>เพิ่มชื่อ user ของคุณหลัง group vboxusers</p>
<pre>
<div class="codesnip-container" >vboxusers:x:123:mrgill</div>
</pre>
<p>หรือจะใช้คำสั่งด้านล้างก็ได้</p>
<pre>
<div class="codesnip-container" >mrgill@mrgill-laptop:~$ sudo usermod -G vboxusers -a `whoami`</div>
</pre>
<p>ตัวอย่างผมใส่ `whoami` แทน User mrgill แต่ถ้าใครจะใส่ชื่อ user ไปตรงๆ ก็ได้ครับ</p>
<p>จากนั้น Logout แล้ว Login ใหม่ อุปกรณ์ USB ก็จะพร้อมให้งานแล้วครับ<span id="more-350"></span></p>
<p>ภาพตัวอย่างก่อนเพิ่ม mrgill ใน group vboxusers</p>
<p style="text-align: center;"><a href="http://www.flickr.com/photos/imrgill/4092513529/sizes/o/" target="_blank"><img class=" aligncenter" title="ก่อนเพิ่ม user ใน group vboxusers" src="http://farm3.static.flickr.com/2762/4092513529_997d70b8db_o.png" alt="" width="503" height="426" /></a></p>
<p style="text-align: center;">
<p>จะเห็นว่าตรงอุปกรณ์ USB จะทึบไม่สามารถเรียกใช้งานได้</p>
<p>หลังเพิ่ม mrgill ใน group vboxusers</p>
<p style="text-align: center;"><a href="http://www.flickr.com/photos/imrgill/4092513533/sizes/o/" target="_blank"><img class=" aligncenter" title="หลังเพิ่ม user ใน group vboxusers" src="http://farm3.static.flickr.com/2669/4092513533_a13b155f86_o.png" alt="" width="503" height="426" /></a></p>
<p style="text-align: center;">
<p>สามารถเรียกใช้งานอุปกรณ์ USB ได้แล้ว<br />
Enjoy with VirtualBox : )</p>
]]></content:encoded>
			<wfw:commentRss>http://imrgill.com/2009/11/11/how-to-fix-usb-device-problem-for-virtualbox-on-ubuntu.html/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>จะเอา /var/lib/mysql บน Ubuntu ไปไว้ที่อื่นทำอย่างไร</title>
		<link>http://imrgill.com/2009/11/09/how-to-move-mysql-data-folder-to-another-path.html</link>
		<comments>http://imrgill.com/2009/11/09/how-to-move-mysql-data-folder-to-another-path.html#comments</comments>
		<pubDate>Mon, 09 Nov 2009 07:57:58 +0000</pubDate>
		<dc:creator>mrgill</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://imrgill.com/?p=332</guid>
		<description><![CDATA[ต้องการเอา /var/lib/mysql ไปไว้ที่อื่นครับเพราะกลัวเวลาเครื่องมีปัญหาอาจทำให้ข้อมูลหายได้เพราะ /var/lib/mysql อยู่ใน / เลย(ไม่ได้แบ่ง partition แยกออกมา) วิธีแรกที่ผมทำเลยคือ root@ubuntu:~# mv /var/lib/mysql /data/mysql root@ubuntu:~# ln -s /data/mysql /var/lib/mysql ก็คือ move จาก /var/lib/mysql ไปไว้ที่ /data/mysql ผลคือตอน restart mysql มันจะฟ้องว่า root@ubuntu:~# /etc/init.d/mysql restart * Stopping MySQL database server mysqld [ OK ] * Starting MySQL database server mysqld [fail] ไปใน /var/log/syslog ก็เจอ error ประมาณนี้ แล้วจะทำไงดี root@ubuntu:~# [...]]]></description>
			<content:encoded><![CDATA[<p>ต้องการเอา /var/lib/mysql ไปไว้ที่อื่นครับเพราะกลัวเวลาเครื่องมีปัญหาอาจทำให้ข้อมูลหายได้เพราะ /var/lib/mysql อยู่ใน / เลย(ไม่ได้แบ่ง partition แยกออกมา) วิธีแรกที่ผมทำเลยคือ</p>
<pre>
<div class="codesnip-container" >root@ubuntu:~# mv /var/lib/mysql /data/mysql
root@ubuntu:~# ln -s /data/mysql /var/lib/mysql</div>
</pre>
<p>ก็คือ move จาก /var/lib/mysql ไปไว้ที่ /data/mysql ผลคือตอน restart mysql มันจะฟ้องว่า</p>
<pre>
<div class="codesnip-container" >root@ubuntu:~# /etc/init.d/mysql restart
* Stopping MySQL database server mysqld                                 [ OK ]
* Starting MySQL database server mysqld                                 [fail]</div>
</pre>
<p>ไปใน /var/log/syslog ก็เจอ error ประมาณนี้ แล้วจะทำไงดี</p>
<pre>
<div class="codesnip-container" >root@ubuntu:~# tail -f /var/log/syslog
Nov  9 02:36:29 ubuntu kernel: [ 2394.732730] type=1503 audit(1257752189.048:131): operation="open" pid=5484 parent=5483 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
Nov  9 02:36:30 ubuntu kernel: [ 2395.745479] type=1503 audit(1257752190.061:132): operation="open" pid=5494 parent=5493 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
Nov  9 02:36:31 ubuntu kernel: [ 2396.761345] type=1503 audit(1257752191.080:133): operation="open" pid=5504 parent=5503 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
Nov  9 02:36:31 ubuntu kernel: [ 2396.774493] type=1503 audit(1257752191.092:134): operation="open" pid=5513 parent=5512 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
Nov  9 02:36:31 ubuntu /etc/init.d/mysql[5520]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Nov  9 02:36:31 ubuntu /etc/init.d/mysql[5520]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed
Nov  9 02:36:31 ubuntu /etc/init.d/mysql[5520]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Nov  9 02:36:31 ubuntu /etc/init.d/mysql[5520]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!</div>
</pre>
<p><span id="more-332"></span><br />
ผมไปเจอคำตอบที่นี่ครับ<br />
<a href="http://forums.mysql.com/read.php?24,211657,225700#msg-225700">http://forums.mysql.com/read.php?24,211657,225700#msg-225700</a><br />
เขาบอกว่าให้เข้าไปแก้ไฟล์ /etc/apparmor.d/usr.sbin.mysqld ผมก็จัดไป</p>
<pre>
<div class="codesnip-container" >root@ubuntu:~# /etc/apparmor.d/usr.sbin.mysqld</div>
</pre>
<p>โดยเปลี่ยนจาก</p>
<pre>
<div class="codesnip-container" ># vim:syntax=apparmor
# Last Modified: Tue Jun 19 17:37:30 2007
#include 

/usr/sbin/mysqld {
  #include
  #include
  #include
  #include
  #include 

  capability dac_override,
  capability sys_resource,
  capability setgid,
  capability setuid,

  network tcp,

  /etc/hosts.allow r,
  /etc/hosts.deny r,

  /etc/mysql/*.pem r,
  /etc/mysql/conf.d/ r,
  /etc/mysql/conf.d/* r,
  /etc/mysql/my.cnf r,
  /usr/sbin/mysqld mr,
  /usr/share/mysql/** r,
  /var/log/mysql.log rw,
  /var/log/mysql.err rw,
<span style="color: #ff0000;">  /var/lib/mysql/ r,
  /var/lib/mysql/** rwk,</span>
  /var/log/mysql/ r,
  /var/log/mysql/* rw,
  /var/run/mysqld/mysqld.pid w,
  /var/run/mysqld/mysqld.sock w,
}</div>
</pre>
<p>ให้เปลี่ยนเป็น</p>
<pre>
<div class="codesnip-container" ># vim:syntax=apparmor
# Last Modified: Tue Jun 19 17:37:30 2007
#include 

/usr/sbin/mysqld {
  #include
  #include
  #include
  #include
  #include 

  capability dac_override,
  capability sys_resource,
  capability setgid,
  capability setuid,

  network tcp,

  /etc/hosts.allow r,
  /etc/hosts.deny r,

  /etc/mysql/*.pem r,
  /etc/mysql/conf.d/ r,
  /etc/mysql/conf.d/* r,
  /etc/mysql/my.cnf r,
  /usr/sbin/mysqld mr,
  /usr/share/mysql/** r,
  /var/log/mysql.log rw,
  /var/log/mysql.err rw,
<span style="color: #ff0000;">  /data/mysql/ r,
  /data/mysql/** rwk,</span>
  /var/log/mysql/ r,
  /var/log/mysql/* rw,
  /var/run/mysqld/mysqld.pid w,
  /var/run/mysqld/mysqld.sock w,
}</div>
</pre>
<p>แต่อย่าเพิ่งลบ Symbolic Link นะครับยังจำเป็นต้องใช้<br />
จากนั้นก็สั่ง Restart Apparmor โดย</p>
<pre>
<div class="codesnip-container" >root@ubuntu:~# /etc/init.d/apparmor restart</div>
</pre>
<p>จากนั้นลองสั่ง Restart Mysql อีกครั้ง</p>
<pre>
<div class="codesnip-container" >root@ubuntu:~# /etc/init.d/mysql restart
 * Stopping MySQL database server mysqld                                [ OK ]
 * Starting MySQL database server mysqld                                [ OK ]
 * Checking for corrupt, not cleanly closed and upgrade needing tables.</div>
</pre>
<p>ก็คงจบแต่เพียงเท่านี้</p>
]]></content:encoded>
			<wfw:commentRss>http://imrgill.com/2009/11/09/how-to-move-mysql-data-folder-to-another-path.html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
