Monday, March 9, 2020

[Short Tip] Generate password

บันทึกกันลืมสั้น ๆ

เนื่องด้วยต้องการ generate password bacula-fd configuration อีกครั้ง แต่พบว่าไม่มีคำสั่ง สำหรับ bacula-fd แต่เราสามารถใช้ openssl generate แล้วเอามาใส่ได้

openssl rand -base64 33

ก็จะได้ password ขนาด 33 ตัวอักษร ก๊อปปี้ไปใส่ได้เลย

ที่มา จากที่นี่

Read More

Monday, June 6, 2016

install xenserver traceback most recent call last /opt/xensource/install/init line 249 elements

Today I try to install Xenserver from USB key that I make from Unetbootin. Everything fine until try to install, I found error like this.

Traceback (most recent call last): File "/opt/xensource/installer/init", line 249, in ?een elements | | Help screen
reboot = main(util.splitArgs(sys.argv[1:], ('-console', '-map_netdev')))
File "/opt/xensource/instalar/init", line 229, in main
rc = install.go(ui,args,answerfile_address, answerfile_script)
File "/opt/xensource/installer/install.py", line 121, in go
serial_console = hardwre.getSerialConfig()
File "/opt/xensource/installer/hardware.py", line 128, in PhysHost_getSerialConfig
assert rc === 0
AssertionError


Image com from This link I found the solution from this link, that I need to config a bit after make usb key After make USB installer key open the terminal and go to USB key
cd /Volumes/XEN
my USB mount is XEN, then use the command like this
mv boot/isolinux/isolinux.cfg boot/isolinux/syslinux.cfg
mv boot/isolinux boot/syslinux
mv syslinux.cfg syslinux.cfg.bak
That's it and now I can install Xenserver :)

Read More

Thursday, August 20, 2015

fstab mount nfs boot press S to skip mounting

Many time when booting machine that setting fstab to boot nfs file server and found this error look like this:
The disk drive for /nfspath is not ready yet or not present
Continue to wait; or Press S to skip mounting or M for manual recovery
and found this error in syslog like this:
mountall: mount /nfspath [617] terminated with status 32
mount.nfs: Failed to resolve server nfsserver: Temporary failure in name resolution
Ater search a bit we can avoid to wait when boot by edit fstab and put "nobootwait" option after line
Before:
nfsserver:/nfsserverpath    /nfspath    nfs    bg,vers=3,tcp,hard,intr
After:
nfsserver:/nfsserverpath    /nfspath    nfs    bg,vers=3,tcp,hard,intr,nobootwait

ref:findincity

Read More

Monday, June 8, 2015

How to fix perl: warning: Setting locale failed on Mac OS X

On Mac os x after using ssh on terminal to linux box you'll see
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
  LANGUAGE = "en_US:en",
  LC_ALL = (unset),
  LC_CTYPE = "UTF-8",
  LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Create file on your home with name ".bash_profile" and add this line
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
After added if you don't want to restart or re-login you can use this command to reload bash config
source ~/.bash_profile

Read More

Tuesday, November 11, 2014

How to create group with specific group id

Today is small tip for create group
Assume I need to create group "mai-ru" and I don't want group id auto but I want group id "9999"
The command is should be
sudo groupadd -g 9999 mai-ru
* be careful group id Values between 0 and 999 are typically reserved for system accounts.
So you should use group id more than 999 and make sure that the value is not already exist.

Read More

Friday, July 18, 2014

check or remove multiple backup files filter by number

Assume on the backup directory has files like this
backup-2011-01-01-data.tar.gz
backup-2011-02-01-data.tar.gz
backup-2011-03-01-data.tar.gz
. . .
backup-2012-01-01-data.tar.gz
backup-2012-02-01-data.tar.gz
backup-2012-03-01-data.tar.gz
. . .
backup-2013-01-01-data.tar.gz
backup-2013-02-01-data.tar.gz
backup-2013-03-01-data.tar.gz
. . .

If I want to check or remove all files from year 2011 to 2012 by command line, how to do that. Do one by one? just 24 times. but if more?

You can check on file by command line by :

$du -ch backup-2012-01-01-data.tar.gz
3.4M backup-2012-01-01-data.tar.gz
3.4M total

For more files and filter by number can use this command

$du -ch backup-{2011,2012}*
3.4M backup-2011-01-01-data.tar.gz
3.4M backup-2011-02-01-data.tar.gz
3.4M backup-2011-03-01-data.tar.gz
. . .
3.4M backup-2012-12-01-data.tar.gz
81.6M total

And you can remove files

rm backup-{2011,2012}*

Read More

Sunday, July 21, 2013

squid proxy error NONE/417

เริ่มต้นจากอยากจะเข้า e-fin กะเค้าบ้าง แต่พอเข้าโปรแกรมทีไร ก็จะให้ใส่ proxy เหมือนดังรูปข้างบนตลอด ซึ่งเจ้า squid proxy เราก็ติดตั้งเอง เรื่อง authentication ก็ไม่มี ลองเทสหลายหนก็เข้าใช้งานไม่ได้
ลองหาข้อมูลในอากู๋ ที่หลาย ๆ คนใช้งาน ก็เจอหลายที่ที่มีคนถามว่าเข้าไม่ได้ แต่ส่วนใหญ่จะตอบให้ติดต่อ "ผู้ดูแลระบบ" เพื่อขอรหัสผ่านในการใช้งาน อ้าวก็เราเนี่ยแหละดูแลระบบ และเราก็ไม่ได้มีรหัสให้ต้องใช้งาน แล้วจะทำยังไงดี ...

หลังจากเกิดปัญหาดังกล่าวก็ปล่อยปัญหาไปสักพัก ใจก็ยังอยากจะเข้าให้ได้ ตอนนี้ความอยากเข้าใช้งานยังเท่าเดิม แต่ความอยากรู้ว่าทำไมเข้าโปรแกรมไม่ได้กลับมากกว่า แล้วก็นึกขึ้นได้ว่าทำไมเราไม่ลองดูใน log ของ squid ดูล่ะว่าเกิดอะไรขึ้น เมื่อนึกขึ้นได้ก็จัดการ remote เข้าไปดู แล้วเราก็เจอแบบนี้

NONE/417

ไม่ได้ก๊อปมาทั้งหมด เอามาแค่ส่วนสำคัญ ก็เลยกลับไปลองถาม google อีกครั้งนึง ก็ได้คำตอบจากเว็บนี้ ว่าต้องเพิ่มคำสั่งใน config file แบบนี้
ignore_expect_100 on
เลยจัดการเพิ่มเข้าไป แล้วจัดการให้ squid เรียก config file ที่เราแก้ไขมาใช้
bingo !!! เข้าใช้งานได้แล้ว

Read More