顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

2021年3月15日 星期一

 


假日在家 Lab Proxmox cluster ,基本的2 node ( 1PC + 1NB) + 1 NFS on NAS,測試 VM migration (相等於 vmware 的 VM vMotion ),簡易無痛。
 
遷移過程中,VM上面跑 x2go server,從 x2go client上開的 youtube 影片 + ping 8.8.8.8 都沒中斷。 
 
好用。
 
看了一下共同供應契約 ,VMware vSphere Essentials Plus Kit for 3 hosts (Max 2 processors per host)要 NT$199590 ,省下來。

2021年2月3日 星期三

firmware: failed to load iwl-debug-yoyo.bin (-2)

debian_version: bullseye/sid

Error message 

kernel:  iwlwifi 0000:05:00.0: firmware: failed to load iwl-debug-yoyo.bin (-2)

temp solution:

vi /etc/modprobe.d/iwlwifi.conf

add following line:  

options iwlwifi enable_ini=N


disabled this warning after reboot.


Reference link :

https://www.reddit.com/r/debian/comments/i60j1c/firmware_failed_to_load_iwldebugyoyobin_2_debian/

https://patchwork.kernel.org/project/linux-wireless/patch/20200625165210.14904-1-wsa@kernel.org/





2021年1月16日 星期六

Debian 11 bullseye KVM host installation with public bridge network

Debian 11 bullseye KVM host installation with public bridge network


#install packages

#apt install --no-install-recommends qemu-system qemu-utils libvirt-clients libvirt-daemon-system bridge-utils

#adduser <youruser> libvirt

#create bridge interface 
# ip link add br0 type bridge
## brctl addbr br0 (deprecated, use ip link instead!)
# vi /etc/network/interfaces

#add/modify following

......
# The primary network interface
#allow-hotplug eno1 # eno1 is my interface name ,change to yours
#iface eno1 inet dhcp

## kvm bridge
##
iface eno1 inet manual
auto br0
iface br0 inet dhcp
pre-up ip tuntap add dev tap0 mode tap user root
pre-up ip link set tap0 up
bridge_ports eno1 tap0
bridge_stp off
bridge_maxwait 0
bridge_fd 0
post-down ip link set tap0 down
post-down ip tuntap del dev tap0 mode tap



Now you can connect from remote virt-manager something like this: 

qemu+ssh://root@<kvm host br0 IP >/system





2020年10月14日 星期三

 

# cvlc -I http --http-password 1234 ./ 

  • VLC headless web ui
  • running cvlc from console without xwindow and control vial http
  • works on Raspberry Pi zero w



2020年8月7日 星期五

Synology NAS smartctl

需要兩個額外參數

smartctl -a -d sat -T permissive /dev/sda

-d sat

Specifies device type. [Sat]  is SCSI to ATA Translation (SAT) that is required with Synology.

 -T permissive
Defines tolerance type. [Permissive] tells to ignore failure(s) of mandatory SMART commands and is required with Synology.

2020年8月2日 星期日

centos 7 + mysql 5.7 + /tmp/mysql.sock



## install mysql 5.7

yum update

yum install yum-utils -y

yum localinstall  https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm -y

yum-config-manager --disable mysql80-community

yum-config-manager --enable mysql57-community

yum install mysql-community-server -y


# edit  /etc/my.cnf

# 1. change socket=/tmp/mysql.sock under [mysqld] section

# add [client] section if not exist

# 2. change or add  socket=/tmp/mysql.sock under [client] section


# install selinux utils

yum install policycoreutils-python-2.5-34.el7.x86_64


# start mysql service to get fail audit log for next step

systemctl start mysqld.service  # this will not work and report error at this time


# modify selinux by analyzing audit log automatically

ausearch -c 'mysqld' --raw | audit2allow -m my-mysqld

semodule -i my-mysqld.pp


# start mysql service

systemctl start mysqld.service   # service should  start up accordingly


# get mysql temporary password in /var/log/mysqld.log

grep 'temporary password' /var/log/mysqld.log


# test mysql client connection

 mysql -p 


# change mysql root password and secure installation

mysql_secure_installation




2019年5月30日 星期四

Wordpress 代誌毋是親像憨人所想的遐爾簡單

代誌毋是親像憨人所想的遐爾簡單。wordpress很好裝沒錯,但是加上 AWS Load Balancer / SSL termination 就搞死人囉。



if($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){

    $_SERVER['HTTPS'] = 'on';
    $_SERVER['SERVER_PORT'] = 443;
}



/* That's all, stop editing! Happy publishing. */

2018年2月28日 星期三

debian sid python3-zeitgeist bug dirty fix

又撞上一個熱騰騰的 Debian sid bug ,是在更新  python3-zeitgeist 套件時報掉的。

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891615

看來是開發者沒有留意python2 |  python3  try except raise 的語法差異所造成。

我不會寫 python ,可是照著 error message 丟出來的訊息


Setting up python3-zeitgeist (1.0.1-0.1) ...

File "/usr/lib/python3/dist-packages/zeitgeist/client.py", line 1061

raise TypeError, 'enabled_callback: expected a callable method'

^

SyntaxError: invalid syntax

,再查一下 python3 語法範例,土法煉鋼把報錯的檔案改完,ㄝ,可以了
apt upgrade 就過了。

跟Sid朝夕相處的刺激感覺實在不錯啊。

2018年1月2日 星期二

Synology Router 1900 / 2600 CLI

Synology Router 相關指令

 

How to get a list of connected clients?

wireless.utilities
# Proprietary Broadcom (wl)  ---> Synology RT-1900ac
wl -i wlan0 assoclist
 
# Proprietary Atheros (madwifi)  ---> Synology RT-2600ac
wlanconfig wlan0 list sta
 
# MAC80211
iw dev wlan0 station dump
 
# Universal
iwinfo wlan0/wl0/ath0 assoclist
 
reference : https://wiki.openwrt.org/doc/faq/faq.wireless 

2014年12月30日 星期二

Trackpoint speed and sensitivity tweek

Addd following line to /etc/rc.local

## Trackpoint speed and sensitivity tweek, echo number 0-255 to sysfs
echo -n 120 > /sys/devices/platform/i8042/serio1/speed
echo -n 220 > /sys/devices/platform/i8042/serio1/sensitivity

一晃神,半年多沒更新這裡了。

2014年6月12日 星期四

How to install star on Debian

Star is a very fast tar(1) like tape archiver with improved functionality. Debian official repo did not include this package, thus need some trick to convert it from Redhat RPM.

Star 號稱是比正常的 Linux tar 還要快、支援格式更多、功能更強的打包軟體。碰到需要在 Debian 環境安裝這個東西,筆記如下:

1. apt-get install alien

2.find and down star RPM from http://www.rpmfind.net/linux/rpm2html/search.php?query=star

3. convert alien RPM package into DEB world
alien star-1.5.2-11.fc21.x86_64.rpm

3. install converted deb
 dpkg -i star_1.5.2-12_amd64.deb

安裝完後指令用法參考mam 或底下網頁

star(1) - Linux man page

2014年4月18日 星期五

NAT環境下從 Linux console取得外部IP位址

一隻小 shell script,一行指令

#! /bin/bash
 echo `curl -s ifconfig.me` | mutt -s ' real IP of my host ' someone@gmail.com


其中curl -s ifconfig.me 是用curl去連結回報真實IP服務的網站,類似的網站還有
curl ident.me
curl tnx.nl/ip
curl icanhazip.com
curl ipecho.net/plain
curl ip.appspot.com



2014年2月21日 星期五

Access MS SQL server from Debian/Linux console - sqlline


1.Install sqlline and jtds (using apt-get )
apt-get install libjtds-java sqlline

2.ms sql jdbc connection string syntax
jdbc:jtds:sqlserver://ip/

3.drive class syntax
net.sourceforge.jtds.jdbc.Driver


4.command line example :
sqlline -u 'jdbc:jtds:sqlserver://ip/' -n user -p pwd -d net.sourceforge.jtds.jdbc.Driver 

5.using pipe redirect
sqlline -u 'jdbc:jtds:sqlserver://ip/' -n user -p pwd -d net.sourceforge.jtds.jdbc.Driver  < script.sql

2014年2月16日 星期日

Linux NIC VLAN config

以Debian為例,

  1. apt-get install vlan
  2. vconfig add eth0 202                   ### 在 eth0上面設定VLAN 202,執行完後系統會多一個 eth0.202 網路卡
  3. ifconfig eth0.1 192.168.202.100  ### 設定 eth0.202 的IP,從這個網路卡出去的 frame都會帶vlan tag 202
vconfig --help
Usage: add             [interface-name] [vlan_id]

       rem             [vlan-name]
       set_flag        [interface-name] [flag-num]       [0 | 1]
       set_egress_map  [vlan-name]      [skb_priority]   [vlan_qos]
       set_ingress_map [vlan-name]      [skb_priority]   [vlan_qos]
       set_name_type   [name-type]

2013年10月4日 星期五

Fortigate reset trusthost setting 重設信任主機欄位設定


如果不小心把Fortigate的Admin 管理者信任主機欄位設定錯誤,導致無法從網頁管理界面或 ssh / telnet 登入管理,可以透過Fortigate的console埠重設信任主機欄位。以下是從Linux / Debian 電腦上面,透過USB轉序列埠連接上Fortigate。


Fortigate serial port configuration : 9600 8N1 / none HW flow control / none SW flow control

Under Linux terminal :

Option 1 : cu command

:~$ cu -l /dev/ttyUSB0 -s 9600 --parity=none --nostop
Connected.
FGT60C login:
FGT60C login: admin
Password: ******
Welcome !
FGT60C #


FGT60C # config system admin
FGT60C (admin) # edit admin
FGT60C (admin) # unset trusthost1
FGT60C (admin) # unset trusthost2
FGT60C (admin) # unset trusthost3
FGT60C (admin) # unset trusthost4
FGT60C (admin) # end
FGT60C # exit
FGT60C login: ~.

( here the last input "~." is the disconnect string of cu )


Option 2 : minicom command
:~$ minicom -D /dev/ttyUSB0 -b 9600 -8

others the same as above, use ctrl-a then press x to confirm leave minicom.

2013年7月23日 星期二

Procedure to install Bugzilla on Debian Wheezy without using install-module.pl


Procedure to install Bugzilla on Debian Wheezy without using install-module.pl

No build-essential / make  or other development  package needed, no CPAN / perl module manually compile needed.

Pre-request:

  1. system already installed apache2 and mysql and perl.
  2. already configured mysql user/password for bugzilla, using root or other account



##get bugzilla tarball
wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.4.tar.gz
tar xzvf bugzilla-4.4.tar.gz
mv bugzilla-4.4 /var/www/bugzilla

##install necessary perl modules
apt-get install libapache2-mod-perl2 libdatetime-perl libemail-send-perl libtemplate-perl libemail-mime-perl liburi-perl liblist-moreutils-perl  libmath-random-isaac-perl libgd-graph-perl libchart-perl libtemplate-plugin-gd-perl

##generate localonfig file by ./checksetup.pl
cd /var/www/bugzilla
./checksetup.pl

##modify localconfig
## Debian use www-data:www-data as apache2 daemon user:group
vi localconfig
change --> $webservergroup = 'www-data';
change --> $db_user = 'user For Bugzilla';
change --> $db_pass = 'password For Bugzilla';

##run checksetup.pl again , auto setup db and administrator users
## checksetup.pl will ask for administrator email as admin account
Enter the e-mail address of the administrator: bug@m$
Enter the real name of the administrator: M$ Bug
Enter a password for the administrator account:
Please retype the password to verify:
dodgelin@gmail.com is now set up as an administrator.


## modify /etc/apache2/apache2.conf , append floolwing two line, like below
tail -2 /etc/httpd/conf/httpd.conf
PerlSwitches -I/var/www/bugzilla -I /var/www/bugzilla/lib -w -T
PerlConfigRequire /var/www/bugzilla/mod_perl.pl

## add apache2 alias config
vi /etc/apache2/conf.d/bugzilla

## add bugzilla alias as following
Alias /bugzilla/ "/var/www/bugzilla/"

  AddHandler cgi-script .cgi .pl
  Options +Indexes +ExecCGI +FollowSymLinks
  DirectoryIndex index.cgi
  AllowOverride Limit



##modify /var/www/bugzilla/mod.pl
##remark following lines due to lack of Apache::SizeLimit
##otherwise you will see a error message when starting APACHE2 
## "You must install Linux::Pid for Apache::SizeLimit to work on your platform."
vi /var/www/bugzilla/mod.pl

##find following section and remark it.
#use Apache2::SizeLimit;
# This means that every httpd child will die after processing
# a CGI if it is taking up more than 45MB of RAM all by itself,
# not counting RAM it is sharing with the other httpd processes.
#Apache2::SizeLimit->set_max_unshared_size(45_000);

## restart apache2
/etc/init.d/apache2 restart

##Done.







2013年7月22日 星期一

Android TV盒? Android mini PC ?

一個比信用卡還小一點的隨身Android裝置,加上無線鍵盤滑鼠,接上客廳的電視作為螢幕,這樣的電腦設備會是PC的替代方案嗎?

有個朋友在網路上開山立寨,代理這個Android 4.2 版+四核心CPU+2GB RAM的小玩具在台灣販賣,宅男大叔對這類設備一直很有興趣,也買了一個來玩玩看。

在MK908小小的體積裡面,CPU硬體與GPU提供的運算能力可能比得上五年前工作用的筆記電腦,記憶體也是高規格的2GB,加上Google play上面有數不清的應用程式,免費的付費的各式各樣的,以及以Chrome browser為平台的HTML5應用,應付簡單的上網、文書應用照理講應該沒問題,這樣一來,不是就可以取代掉所謂的入門文書機PC了?在動手玩之前,我抱著這樣的期待。

實際使用之後的感想:當作智慧型電視機上盒,這隻MK908算是及格,但作為 mini PC,穩定性還有進步空間。

我測試的環境主要有二,一個是接22吋Full HD的電腦螢幕,一個是接32吋的Sharp 720P電視。MK908有內建Wifi和藍牙,但是wifi部份比較不穩定,朋友另外給了一個USB Ethernet網卡,接上網路線之後,網路傳輸狀況會穩定許多。另外我使用2.4G的無線滑鼠在電視和螢幕上操作Android。藍牙鍵盤( Sony PS3 藍牙鍵盤 ) 和 ASUS 藍牙滑鼠無法成功和這台配對

就看電視的部份來說,這隻玩具看youtube,看 rmvb / mp4 / mkv 等等視訊格式都勝任愉快,比起家中另外一台用來播放DVD的 xbox 360 有彈性,Android上面有各式各樣的播放軟體,可支援的影片格式比起xbox360好多了。但是這隻玩具的硬體穩定性還不完美,只能說堪用。我用MK908看了大約3個小時的 720P MP4 / RMVB / MKV動畫,過程中遇到兩次當機,兩次聲音消失。就看影片的需求來說,我還可以接受。使用的軟體是 mxplayer,影片放在外接的32GB SD卡中。

透過MK908在電視上看youtube或影片檔,我給稍稍及格一點的分數,65分。但是用來在電視上瀏覽網站、玩遊戲,MK908就有嚴重的缺陷,對我來說是不及格的。

照理說,影片播放順利的話,看網頁或是玩小遊戲應該不會造成系統更大負擔才對?但是很奇怪地,這隻玩具在使用Chrome瀏覽網站的時候,穩定性比看影片差很多,機體溫度也比較高,很像散熱不良熱當,很容易當機。感覺上只是瀏覽網站,玩玩Candy Crush,大約一個小時就會當機。放台電風扇吹這玩意,狀況會有改善,為了測試是否真的是散熱問題導致不穩定,以安兔兔的穩定性測試功能為標準,不吹電風扇狀況,穩定性測試執行到一半就會當機,用風扇協助散熱就可以正常跑完測試。所以基本上MK908是「冬期限定」吧,在炎炎夏日裡,不開空調的環境還要一台電風扇專門伺候它,以3C產品來說很不應該。

最後,在大電視螢幕上玩Candy Crush Saga滿爽的,糖果都好大一顆。












2013年7月14日 星期日

bash下批次縮小gif動畫指令 -- 使用 gifsicle


gifsicle --scale 0.5 --batch -i *.gif

需要安裝gifsicle套件,且上面這作法會直接複寫原本目錄中的檔案(scale in place )

bash下批次縮小目前目錄中所有圖片

指令:

for file in *; do convert $file -scale 50% ../small_0.5/`basename $file`; done

上述指令可以將目錄內所有檔案縮小50%,存放到上層的small_0.5目錄中


上面這個作法遇到gif動畫會破功,無法產生縮放過後的gif動畫,只剩下第一個frame。要能正確縮放gif動畫,需用到底下

for file in *; do convert  $file -coalesce -scale 50%  ../small_0.5/`basename $file`; done

for file in *; do convert  $file -coalesce -sample 50%  ../small_0.5/`basename $file`; done

兩種作法都可以,但是根據文件,產生的結果可能畫質上會有所差異,哪個方法比較好可能要看實際狀況才能判斷。

ImageMagick參考資料:
http://www.imagemagick.org/Usage/anim_mods/#crop

以上需要有ImageMagick套件(convert 這隻程式屬於ImageMagick套件成員之一)

2013年7月9日 星期二

HOW to install Apache Activemq on Debian 7 Wheezy

##Debian 7 wheezy activemq install

##down apache activemq binary from http://activemq.apache.org/download.html  (current version: apache-activemq-5.8.0-bin.tar.gz)

##extract files to /opt
cd /opt
tar xzvf /root/Downloads/apache-activemq-5.8.0-bin.tar.gz


## make symbolic link
ln -s apache-activemq-5.8.0 activemq
cd /etc/init.d
ln -s /opt/activemq/bin/activemq

## generate activemq configuration file under /etc/default/activemq
/etc/init.d/activemq setup /etc/default/activemq
chown 'root':root '/etc/default/activemq'; chmod 600 '/etc/default/activemq'


##change admin password
vi /opt/activemq/conf/jetty-realm.properties

##update service autostart during boot
update-rc.d activemq defaults