2013年10月2日 星期三

BSD 安裝 kernel source

最近跑去旁聽一門BSD的實驗課 XDDDD

順便學一下BSD好了, 科科~

----

在用portmaster安裝virtualbox-ose時, 會出現一些錯誤訊息.

其中一段是說要安裝kernel source.

然後查了一下, 一開始是用 sysinstall  去勾選src的東西 (忘記在哪看到了XD)
可是接下來就會一直出現無法連線的錯誤訊息. 囧~~

大概像這樣吧!?
Unable to transfer the sbase distribution from 
ftp://ftp.freebsd.org.                         
Do you want to try to retrieve it again?

後來在這邊找到另一個解決方法
http://forums.freebsd.org/showthread.php?t=29172

我的是9.1-RELEASE, 所以要把相關連結換成9.1
先把檔案抓下來, 然後解壓縮複製到相應的路徑, 之後再用svn更新.

一開始好像沒有svn可以用, 可以用portmaster去安裝subversion.

wget ftp://ftp.tw.freebsd.org/pub/FreeBSD/releases/i386/9.1-RELEASE/src.txz
tar -C / -xvzf src.txz
svn checkout https://svn0.us-west.freebsd.org/base/releng/9.1 /usr/src


然後一個晚上過去, 似乎是安裝完了??
沒有看到錯誤訊息 XD
可是能不能用還是未知數(???)

2013年9月4日 星期三

重新安裝 ns2

重裝ns2時, 要先把舊的設定檔/暫存都清掉, 才可以用 ./install 重新安裝.
不然就一定要放在相同路徑才可以安裝. @@

以下是我用的清除腳本, 應該是還可以再簡化一點, 可是我懶得弄 XDDDD

----------------------------------------------------------------
#! /bin/sh
# enter all folder to make clean
# only for ns 2.29

CUR_PATH=`echo $(pwd)`

rm -f $CUR_PATH/xgraph-12.1/config.cache
rm -f $CUR_PATH/tcl8.4.11/unix/config.cache
rm -f $CUR_PATH/tk8.4.11/unix/config.cache

cd $CUR_PATH/cweb; make distclean; make clean;
cd $CUR_PATH/cweb/examples; make distclean; make clean;
cd $CUR_PATH/sgb; make distclean; make clean;
cd $CUR_PATH/tclcl-1.17; make distclean; make clean;
cd $CUR_PATH/otcl-1.11; make distclean; make clean;
cd $CUR_PATH/zlib-1.2.3; make distclean; make clean;
cd $CUR_PATH/zlib-1.2.3/contrib/blast; make distclean; make clean;
cd $CUR_PATH/zlib-1.2.3/contrib/untgz; make distclean; make clean;
cd $CUR_PATH/zlib-1.2.3/contrib/puff; make distclean; make clean;
cd $CUR_PATH/zlib-1.2.3/contrib/minizip; make distclean; make clean;
cd $CUR_PATH/xgraph-12.1; make distclean; make clean;
cd $CUR_PATH/tcl8.4.11/macosx; make distclean; make clean;
cd $CUR_PATH/tcl8.4.11/unix; make distclean; make clean;
cd $CUR_PATH/tcl8.4.11/unix/dltest; make distclean; make clean;
cd $CUR_PATH/nam-1.11; make distclean; make clean;
cd $CUR_PATH/ns-2.29/indep-utils/cmu-scen-gen/setdest; make distclean; make clean;
cd $CUR_PATH/ns-2.29/indep-utils/dosdbell; make distclean; make clean;
cd $CUR_PATH/ns-2.29/indep-utils/webtrace-conv/nlanr; make distclean; make clean;
cd $CUR_PATH/ns-2.29/indep-utils/webtrace-conv; make distclean; make clean;
cd $CUR_PATH/ns-2.29/indep-utils/webtrace-conv/epa; make distclean; make clean;
cd $CUR_PATH/ns-2.29/indep-utils/webtrace-conv/dec; make distclean; make clean;
cd $CUR_PATH/ns-2.29/indep-utils/webtrace-conv/ucb; make distclean; make clean;
cd $CUR_PATH/ns-2.29/indep-utils/model-gen; make distclean; make clean;
cd $CUR_PATH/ns-2.29; make distclean; make clean;
cd $CUR_PATH/ns-2.29/ns-tutorial; make distclean; make clean;
cd $CUR_PATH/ns-2.29/emulate/support/src/nrgarp; make distclean; make clean;
cd $CUR_PATH/ns-2.29/doc; make distclean; make clean;
cd $CUR_PATH/ns-2.29/doc/kfall; make distclean; make clean;
cd $CUR_PATH/tk8.4.11/macosx; make distclean; make clean;
cd $CUR_PATH/tk8.4.11/unix; make distclean; make clean;
cd $CUR_PATH/gt-itm/sgb2ns; make distclean; make clean;
cd $CUR_PATH/gt-itm/src; make distclean; make clean;
----------------------------------------------------------------

2013年8月30日 星期五

error message (when installing backports)

I got an error message when I install backports.
(how to type Chinese under Ubuntu? orz....)

the following is the error message:

-----------------------------------------------------------
backports-3.10-2$ make menuconfig

Generating local configuration database from kernel ... done.
cc -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -DCURSES_LOC="" -DLOCALE   -c -o mconf.o mconf.c
In file included from mconf.c:23:0:
lxdialog/dialog.h:38:21: fatal error: ncurses.h: No such file or directory
compilation terminated.
make[2]: *** [mconf.o] Error 1
make[1]: *** [menuconfig] Error 2
make: *** [menuconfig] Error 2

-----------------------------------------------------------
and, the solution is just using apt-get to install some packages. XD

sudo apt-get install libncurses5-dev libncursesw5-dev

2013年7月18日 星期四

tcl 內建語法 (!?)

無意中發現的 XD

http://www.tcl.tk/man/tcl8.4/TclCmd/

expr應該比較容易用到!?
http://www.tcl.tk/man/tcl8.4/TclCmd/expr.htm

----

科科

2013年7月16日 星期二

在windows讀取linux的磁區

http://www.diskinternals.com/linux-reader/

DiskInternals Linux Reader is a new easy way to do this. This program plays the role of a bridge between your Windows and Ext2/Ext3/Ext4, HFS and ReiserFS file systems.

Linux Reader is 100% FREE.

----

看起來應該是可以用!? XD

2013年6月26日 星期三

用shell script產生兩個不重複的亂數

#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin

n=`expr \( \( $RANDOM % 7 \) + 1 \)`
echo $n

m=`expr \( \( $RANDOM % 7 \) + 1 \)`

while [ $n == $m ]
  do
    m=`expr \( \( $RANDOM % 7 \) + 1 \)`
  done

echo $m

----

單純紀錄 XD

2013年5月23日 星期四

win7不能開機!! (安裝Fedora之後)

今天幫學弟裝Fedora, 然後要切回win7的時候, 竟然出現錯誤訊息, 不能開機. 囧

BOOTMGR is missing
Press Ctrl+Alt+Del to restart 


後來查了一下, 發現只要修改grub的選單就可以開進win7了. XD

ref: http://ubuntuforums.org/showthread.php?t=1159205

以我學弟為例, 他原本win7的選單是寫 (hd0,0), 改成 (hd0,1)就可以開機了. XDD

2013年5月21日 星期二

openwrt 的開機選單

其實只是存起來當備份而已. 科科

這樣就可以直接把這些選單語法加到Fedora的grub選單裡面,

直接用原本的開機選單選擇隨身碟開openwrt. XDD


title   OpenWrt
root    (hd0,0)
kernel  /boot/vmlinuz root=/dev/sda2 rootfstype=ext4 rootwait console=tty0 console=ttyS0,38400n8 noinitrd reboot=bios
boot

title   OpenWrt (failsafe)
root    (hd0,0)
kernel  /boot/vmlinuz failsafe=true root=/dev/sda2 rootfstype=ext4 rootwait console=tty0 console=ttyS0,38400n8 noinitrd reboot=bios
boot

2013年4月10日 星期三

把ns2(2.29, multichannel版)移到ubuntu

我用的版本是 Ubuntu 12.04.1 LTS
原本在Fedora10上面裝了ns2 with multichannel (2.29)

因為是整個資料夾移過去, 所以要重新安裝.

重新安裝的話, 我是先去各個資料夾make clean, 再把三個config.cache刪掉, 順便把ns-allinone-2.29/bin/裡面的link都刪掉, 最後再重新 ./install 就好了

只是在 ./install 過程中會出現一些錯誤訊息, 然後找到了這篇
Installing ns-2.29 in Ubuntu 12.04
http://www.nsnam.com/2012/06/installing-ns-229-in-ubuntu-1204.html

按照他的步驟去修改, 然後就安裝成功了 XD

-------
三個config.cache的位置
ns-allinone-2.29/xgraph-12.1/config.cache
ns-allinone-2.29/tcl8.4.11/unix/config.cache
ns-allinone-2.29/tk8.4.11/unix/config.cache


-------
進去每個資料夾make clean (其實只要找出Makefile在哪個資料夾, 就知道要去哪裡make clean了)

cd ns-allinone-2.29/cweb/
make clean
cd ns-allinone-2.29/cweb/examples/
make clean
cd ns-allinone-2.29/sgb/
make clean
cd ns-allinone-2.29/tclcl-1.17/
make clean
cd ns-allinone-2.29/otcl-1.11/
make clean
cd ns-allinone-2.29/zlib-1.2.3/
make clean
cd ns-allinone-2.29/zlib-1.2.3/contrib/blast/
make clean
cd ns-allinone-2.29/zlib-1.2.3/contrib/untgz/
make clean
cd ns-allinone-2.29/zlib-1.2.3/contrib/puff/
make clean
cd ns-allinone-2.29/zlib-1.2.3/contrib/minizip/
make clean
cd ns-allinone-2.29/xgraph-12.1/
make clean
cd ns-allinone-2.29/tcl8.4.11/macosx/
make clean
cd ns-allinone-2.29/tcl8.4.11/unix/
make clean
cd ns-allinone-2.29/tcl8.4.11/unix/dltest/
make clean
cd ns-allinone-2.29/nam-1.11/
make clean
cd ns-allinone-2.29/ns-2.29/indep-utils/cmu-scen-gen/setdest/
make clean
cd ns-allinone-2.29/ns-2.29/indep-utils/dosdbell/
make clean
cd ns-allinone-2.29/ns-2.29/indep-utils/webtrace-conv/nlanr/
make clean
cd ns-allinone-2.29/ns-2.29/indep-utils/webtrace-conv/
make clean
cd ns-allinone-2.29/ns-2.29/indep-utils/webtrace-conv/epa/
make clean
cd ns-allinone-2.29/ns-2.29/indep-utils/webtrace-conv/dec/
make clean
cd ns-allinone-2.29/ns-2.29/indep-utils/webtrace-conv/ucb/
make clean
cd ns-allinone-2.29/ns-2.29/indep-utils/model-gen/
make clean
cd ns-allinone-2.29/ns-2.29/
make clean
cd ns-allinone-2.29/ns-2.29/ns-tutorial/
make clean
cd ns-allinone-2.29/ns-2.29/emulate/support/src/nrgarp/
make clean
cd ns-allinone-2.29/ns-2.29/doc/
make clean
cd ns-allinone-2.29/ns-2.29/doc/kfall/
make clean
cd ns-allinone-2.29/tk8.4.11/macosx/
make clean
cd ns-allinone-2.29/tk8.4.11/unix/
make clean
cd ns-allinone-2.29/gt-itm/sgb2ns/
make clean
cd ns-allinone-2.29/gt-itm/src/
make clean

在ubuntu上安裝freenx (Ubuntu 12.04.1 LTS)

原本想要在ubuntu上設定遠端, 可是vnc一直設定失敗 -.-
用內建的desktop share又很頓, 不知道為啥 orz...
最後就改用nxserver. XD
搞了很久終於可以看到畫面了   囧~~

------------------------------------------------------
我的版本是  Ubuntu 12.04.1 LTS

主要安裝流程  (請參考 https://help.ubuntu.com/community/FreeNX )

sudo apt-add-repository ppa:freenx-team
sudo sed -i 's/natty/lucid/g' /etc/apt/sources.list.d/freenx-team-ppa-natty.list
sudo apt-get update 
sudo apt-get install freenx
wget https://bugs.launchpad.net/freenx-server/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz
tar -xvf nxsetup.tar.gz 
sudo cp nxsetup /usr/lib/nx/nxsetup
sudo /usr/lib/nx/nxsetup --install 
(安裝完會跟你說key在哪裡) 

把key找出來, 複製, 待會在windows上裝好nx-client會用到
sudo cat /var/lib/nxserver/home/.ssh/client.id_dsa.key 

================================
NX Client for Windows
http://www.nomachine.com/download-package.php?Prod_Id=3835

================================
因為我設定完連線後,會出現!M的logo, 然後畫面是黑的, 過一陣子程式就關閉了.  囧
試了一堆方法後終於成功了, 可是我也不知道哪個才是關鍵, 所以就通通記下來 XDD

================================
 [ref1] http://wiki.centos.org/zh-tw/HowTos/FreeNX
 如果 nx 在最後一步連線失敗並停了下來,請檢查你在伺服器上的主目錄。刪除所有 .Xauthority* 檔(或把它們移往別處)然後重試。要是這樣沒有幫助,請嘗試移除 /tmp/.X11-unix。
 
編輯 /etc/nxserver/node.conf 並且更改此行:
#AGENT_EXTRA_OPTIONS_X="-nolisten tcp"

為:
AGENT_EXTRA_OPTIONS_X=""

================================
[ref2] https://help.ubuntu.com/community/FreeNX

[Enabling the PASSDB database]
編輯 /etc/nxserver/node.conf , 包含這句
ENABLE_PASSDB_AUTHENTICATION="1"

[Adding the User ID and Password to the database:]
sudo nxserver --adduser xxxx
sudo nxserver --passwd  xxxx

sudo vi /etc/ssh/sshd_config , 包含這句
AllowUsers nx xxxx

sudo service ssh restart


================================
[ref 3] http://notepad2.blogspot.com/2012/04/install-freenx-server-on-ubuntu-1110.html
我忘記改到啥東西, 看到錯誤訊息跳出來 (原本都不會跳), 然後訊息有gnome-fallback
後來在這個網頁看到說要安裝東西

[Install gnome-session-fallback:]
sudo apt-get install gnome-session-fallback

[Edit /usr/NX/etc/node.conf file as root, and enable the following line]
COMMAND_START_GNOME="gnome-session --session=gnome-fallback"

[Restart freenx server]
sudo /etc/init.d/freenx-server restart

------------------------------------------------------------------------------------

最後弄完 gnome-session-fallback 就可以看到畫面了 (感動)

而且速度也比內建的desktop share快很多 = =+