[客家話, hak-Hant-TW]
FreeBSD 下是講要看麼介 process 用了麼介 port,最簡單的方式就是 sockstat,毋過這隻是 FreeBSD 限定,Linux 下就做不得用了。好在還有其他替代方案: lsof
講實在的 lsof 主要不是拿來看開麼介 port 的,是拿來看 process 開了麼介檔案,是講也有看用了麼介 port 的功能就是。 lsof -i 就可以看到那隻 process 開了那隻 port,同 sockstat,也當方便啦。
[客家話, hak-Hant-TW]
FreeBSD 下是講要看麼介 process 用了麼介 port,最簡單的方式就是 sockstat,毋過這隻是 FreeBSD 限定,Linux 下就做不得用了。好在還有其他替代方案: lsof
講實在的 lsof 主要不是拿來看開麼介 port 的,是拿來看 process 開了麼介檔案,是講也有看用了麼介 port 的功能就是。 lsof -i 就可以看到那隻 process 開了那隻 port,同 sockstat,也當方便啦。
[客家話, hak-Hant-TW]
有一台的 multimedia/kdemultimedia4 毋知哪下開始就編不過,毋過那台咩沒用到這邊的功能,就沒特別去看是什麼問題,就放著。後來有閒那下去看才知說是要編 kscd 時節,很像是尋不到 alsa 這種的問題,毋重新編過 audio/alsa-* 咩沒用,共樣編不過。 看一下別台有 kde 的有堵到共樣的問題沒,結局那台是根本就沒裝 alsa,按仔就是說 alsa 是沒一定要用到的, 正經反安裝 alsa 後這台就編過了,問題解決。
[華語, cmn-Hant-TW]
ports 裡面的 xorg 前一陣子終於更新到 7.5 了 ,啊找一天就給他整個升下去。
結果升完之後發現 KDE SC 特效只剩 xrender 可用,opengl 的選項失效了。查了一下 xorg 的 log 發現 nvidia 的 driver 是有跑起來沒錯,可是他在抱怨 glx 不能動,所以就從這邊出發去找解法。後來在這篇裡面瞄到了 x11/nvidia-driver 這個 port 會裝自己的 libglx 到 extension 裡面,也許是升級的時候又把 nvidia-driver 的那份蓋掉了。重新安裝一次 nvidia-driver 再試開一次 opengl 的選項也確實可以用,問題解決。
btw, xorg 升級到 7.5 之後似乎順非常多,就算用 xrender 跑那堆特效也不會有很強烈的遲滯感,整個 KDE SC 的介面反應速度快得讓人驚訝。當然了,資源還是一樣吃很兇就是,但是至少用起來爽度大增。
[華語, cmn-Hant-TW]
每次都會忘記,記錄一下省得每次都要用 Google 找半天
-a file ~ True if file exists.
-b file ~ True if file exists and is a block special file.
-c file ~ True if file exists and is a character special file.
-d file ~ True if file exists and is a directory.
-e file ~ True if file exists.
-f file ~ True if file exists and is a regular file.
-g file ~ True if file exists and its set-group-id bit is set.
-h file ~ True if file exists and is a symbolic link.
-k file ~ True if file exists and its “sticky” bit is set.
-p file ~ True if file exists and is a named pipe (FIFO).
-r file ~ True if file exists and is readable.
-s file ~ True if file exists and has a size greater than zero.
-t fd ~ True if file descriptor fd is open and refers to a terminal.
-u file ~ True if file exists and its set-user-id bit is set.
-w file ~ True if file exists and is writable.
-x file ~ True if file exists and is executable.
-O file ~ True if file exists and is owned by the effective user id.
-G file ~ True if file exists and is owned by the effective group id.
-L file ~ True if file exists and is a symbolic link.
-S file ~ True if file exists and is a socket.
-N file ~ True if file exists and has been modified since it was last read.
file1 -nt file2 ~ True if file1 is newer (according to modification date) than file2, or if file1 exists and file2 does not.
file1 -ot file2 ~ True if file1 is older than file2, or if file2 exists and file1 does not.
file1 -ef file2 ~ True if file1 and file2 refer to the same device and inode numbers.
-o optname ~ True if shell option optname is enabled. The list of options appears in the description of the -ooption to the set builtin (see The Set Builtin).
-z string ~ True if the length of string is zero.
-n string ~ True if the length of string is non-zero.
string1 == string2 ~ True if the strings are equal. ‘=’ may be used in place of ‘==’ for strict posix compliance.
string1 != string2 ~ True if the strings are not equal.
string1 < string2 ~ True if string1 sorts before string2 lexicographically in the current locale.
string1 > string2 ~ True if string1 sorts after string2 lexicographically in the current locale.
arg1 OP arg2 ~ OP is one of ‘-eq’, ‘-ne’, ‘-lt’, ‘-le’, ‘-gt’, or ‘-ge’. These arithmetic binary operators return true if arg1 is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to arg2, respectively. Arg1 and arg2 may be positive or negative integers.
資料來源: http://www.gnu.org/software/bash/manual/bashref.html#Bash-Conditional-Expressions
-r Read access -w Write access -x Execute access -X Executable in the path or shell builtin, e.g., `-X ls' and `-X ls-F' are generally true, but `-X /bin/ls' is not (+) -e Existence -o Ownership -z Zero size -s Non-zero size (+) -f Plain file -d Directory -l Symbolic link (+) * -b Block special file (+) -c Character special file (+) -p Named pipe (fifo) (+) * -S Socket special file (+) * -u Set-user-ID bit is set (+) -g Set-group-ID bit is set (+) -k Sticky bit is set (+) -t file (which must be a digit) is an open file descriptor for a terminal device (+) -R Has been migrated (convex only) (+) -L Applies subsequent operators in a multiple-operator test to a symbolic link rather than to the file to which the link points (+) *
資料來源 FreeBSD tcsh manual pages
[客家話, hak-Hant-TW]
手上有一隻二手的 Apple Keyboard 有問題,9-O-L-. 這排打毋出來 (其他的沒問題)。毋過按仔就毋用咩當打爽、就看看有軟體的方法可以用老鼠輸入文字沒。作業的環境是 KDE (FreeBSD 8.0), 找到這隻 xvkbd 可以用,ports 底肚咩有 (x11/xvkbd) 所以裝起來沒什麼問題。
用起來咩沒什麼問題,可以自在變大變小,也可以同時用 gcin/oxim 輸入,就是用老鼠輸入會較慢。 (本成就是會按仔的)
[客家話, hak-Hant-TW]
一般要換 zfs 的 pool 名就直接 export 過來 import 換新名就好了,毋過是講 pool 袛肚有 root 就作不得 export,按仔就要用別隻方法來改。
要用 zfs 開機的時節,系統會參考 /boot/zfs/zpool.cache 來 import 看得到的 zfs pool,是講沒找到 /boot/loader.conf 底肚的 vfs.root.mountform 指定的地方,就會跳出錯誤訊息叫你輸入對的位仔,所以常理來講是沒要挺動較好,正經想要要改可以按仔做:
[華語, cmn-Hant-TW]
想要把一台 FreeBSD 8.0 機器硬碟升級,想說乾脆換成 GPT 弄個純 zfs 的環境來用看看。在官網的 wiki 有提到在這裡可以下載安裝光碟,裡面有一個 zfsinstall 的 script 可以幫忙把 FreeBSD 安裝到一顆乾淨的硬碟裡面,直接下載附有包好一份 FreeBSD/amd64 dist 的 special edition 比較方便,不然就得自己包一份餵給 zfsinstall 吃。
安裝過程很快,不過重開機後怪事就發生了,開機居然會卡在開機硬碟掃瞄的畫面?!一開始推測是 GPT 的問題,把硬碟清掉之後果然就不卡了,這實在沒啥道理,後來把硬碟拿去用 Mac 的磁碟工具程式分割成 GUID 分割表 (即 GPT),一試居然也不會卡,那問題是在哪? 再深入交叉測試發現原來只要用 gpart create -s GPT 指令做出來的分割表開機的時候就會卡住,就算裡面是空的也一樣,Mac 的則不會。所以結論就是用 FreeBSD 的 gpart 在 WD 6400AAKS 上產生的 GPT 會讓 MSI K8N Neo4-FI 主機板卡在硬碟掃瞄畫面,至於問題是誰造成的我就不知道了。
既然 Mac OS X 產生出來的 GPT 沒問題,那就用 Mac OS X 做一個空殼。因為 Mac 在分割的時候會很貼心的順便塞 EFI 之類的東西進去,所以在安裝前要先用 gpart delete 指令把所有分割區砍掉只留 GPT。然後 zfsinstall 也需要修改,因為他一開始會檢查確認硬碟是否為全空,要把那段註解掉或是讓他檢查沒過時不會跳出,然後 gpart create 的部份也要註解掉,因為事先已用 Mac 之工具做好 GPT 了,一切順利的話,安裝完重新開機就可以進去整顆都是 zfs 的系統了。
要把舊的系統移到新的系統問題不大,用舊硬碟開機下手動將新硬碟的 zfs dataset ( /root /var /tmp /usr ) 掛載上去後直接用 rsync 把既有資料蓋到新硬碟上的相對位置即可,蓋完之後要再修改兩處
zfs_load="YES" vfs.root.mountfrom="zfs:data/root"
/dev/gptid/78e0d9bd-1fac-11df-bc9c-0210dc9db087 none swap sw 0 0 data/usr /usr zfs rw 0 0 data/var /var zfs rw 0 0 data/tmp /tmp zfs rw 0 0
data 是 zfs pool 的名字,zfsinstall 時可以下參數指定,/etc/fstab 中 swap 的 gptid 可以用 zfs status 查到,事實上這兩個檔案在 zfsinstall 安裝時都會設定好,不過把舊硬碟資料複製到新硬碟時很有可能會被蓋掉,所以要再確認修改。
一切順利的話用新硬碟重開機應該可以看到原來的系統又跑起來了,差別只是硬碟變大、根目錄變 zfs 而已 (輕描淡寫貌)。
update: (2011-12-01)
補充一下,root partition 不要用 gzip,不然會開不了機,zfsv28 的 dedup 倒是沒差可以直接在 root 開
http://www.freebsd.org/cgi/query-pr.cgi?pr=153173
update: (2012-02-02)
試過另一顆 SSD 在原來那台機器上一樣會卡,看來是這張主機板會挑。還有就是後來的版本可以不用 legacy 模式掛載 /usr /var 等,再搭配直接在 zfs volume 上開 swap 的話那就可以完全不用 /etc/fstab ,這樣就更有 zfs 的味道了。
[華語, cmn-Hant-TW]
FAILED…
懶得在 Windows 下裝一堆開發工具,所以就動那一堆 FreeBSD 的主意。
首先要裝 mingw,用 ports 裝應該是最方便的。
測試方式也很簡單,用 mingw32-gcc 隨便編譯個小程式看能不能動即可。
OpenTTD 的原始碼的部份,要找最新的開發測試板的話直接從 svn 抓是最方便的,去抓一下
svn co svn://svn.openttd.org/trunk openttd
然後參考官網的 wiki 的做法來 make。FreeBSD 要另外裝 devel/gmake,原因不詳述,然而官網裡面說的 Makefile.config 並不會生出來,所以就卡在這邊,等以後有空再來試看看要怎麼調才能動。
[華語, cmn-Hant-TW]
Apple 現在的鍵盤直接用在一般個人電腦上沒啥大問題,主要的按鍵大部份都有對應到。不過有一個地方因為歷史及功能因素所以對應起來位置剛好相反,也就是 alt/option -> alt 以及 apple/command -> win。從功能來這個對應是完全合理,問題是這兩個鍵的排列在 Apple 系統是 ctrl-alt-command,在一般 PC 上則是 ctrl-win-alt,所以雖然預設的對應完全合理,但是按起來一點也不順手,也因此有對調的需求。
複製 /usr/share/syscons/keymaps/us.iso.kbd /usr/share/syscons/keymaps/us.apple.kbd,然後改一下 us.apple.kbd
… 056 lalt lalt lalt lalt lalt lalt lalt lalt O ... 093 ralt ralt ralt ralt ralt ralt ralt ralt O ... 105 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O 106 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O …
fkey62 就是 l-winkey,fkey63 就是 r-winkey,把前面的數字 056<->105 093<->106 互相對調即可,至於為什麼是 fkey62,fkey3 請 man keyboard。
接著在 /etc/rc.conf 裡面跟系統講說開機的時候要改載入這個改過的檔案即可。
kbdmap = "us.apple.kbd"設定檔太複雜,Xmodmap 又只能個別的改,然後 hal 進來大亂鬥又得東繞西繞,乾脆就直接改預設的檔案比較快。要改的檔案是 /usr/local/share/X11/xkb/keycodes/xfree86,把 LALT RALT 後面的數字跟 LWIN RWIN 的數字對調即可,也就是 64<->115 113<->116
直接執行登錄檔,手動改的步驟不難不過有點煩。
還原的話只要刪掉 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] 的 Scancode Map 的值即可,細節請參考 M$ 網站
系統偏好設定>鍵盤(鍵盤) 的變更鍵直接設成對調。 (幾乎不會用到這種)
[華語, cmn-Hant-TW]
隨著 FreeBSD 8.0 的推出,nVidia 也如預期的釋出了給 FreeBSD/amd64 跑的驅動程式,在這篇裡面有提到最新的 195.22 有支援64bit,而支援的版本則是 FreeBSD 8.0/7.3 。當然其實是不需要等 7.3 推出,只要跟著 RELENG_7 跑現在的版本應該就能用了,不過到目前為止(2009/12/07) ports 裡面是沒有的,所以得手動下載後編譯及安裝,最後再跑 nvidig-config 弄一個新的 xorg.conf 即可。
手上沒有啥特別需要跑 OpenGL 的程式,倒是 KDE SC 4 的介面可以開 OpenGL 加速之後用起來比 xrender 順很多,用一張舊的 7600GT 跑起來沒遇到什麼太大問題,大致來說讓人非常滿意。
UPDATE: 沒多久之後就進 ports 了