In order to access some embedded system, network equipments, wifi routers, I usually need to use serial communication programs like kermit, minicom.

However, I usually need to access to different devices with different baud rate. So, I wrote some scripts for helping me.

The first one is kermit.sh, which get the options from environment variable. It’s using /dev/ttyUSB0 by default, and 9600 as baud rate. If you want to use differnt device name, just type

$ kermit.sh # using default
$ DEVICE=/dev/ttyUSB1 SPEED=115200 kermit.sh

The script will also save a session log in /tmp, it will show you the filename after you exit from the terminal. However, since kermit is not free. (because it ask developers who make modifications send back the chages). I also wrote another script for minicom.

This is a tip for Debian GNU/Linux.

Many times, you would like to record every work and commands in the terminal session. In the situations like checking the server’s status, testing new softwares, changing the configurations, fighting with crackers.. things like that.

In that moment, you don’t have time to take notes on every commands, but trying to get the system running. However, you will also want to check the log of the commands and outputs.

There is a very useful command named script (1) in the bsdutils packages. The software will help you make typescript of everything printed in the terminal, including your input. So, you can use this software to record your works, and review it later.

No only the things printed in your terminal, you can also save the timing data with ‘-t‘ option. The timing data will be outputted to standard error, you can save it by redirect the standard error to a file. Then you can play back the typescripts by scriptreplay (1).

Therefore, you could show how you get thing down to your friends/colleague by playing the typescript. Just like watch a movie.

For a easier usage, I wrote a small script. The script will help me save the typescript in the filename I assigned or time stamp.

Usage is very simple

$ ./script.sh # save the typescript as time stamp filename
$ ./script.sh mission-critical.log # save the typescript as mission-critical.log

This is a tip for Debian GNU/Linux.

說真的 reportbug-ng 實在遠比 reportbug 的純 CLI 介面好用太多了啊。

特別是這些特色

  • BTS 查詢功能
  • 關鍵字過濾介面
  • 網頁瀏覽介面
  • 整合郵件軟體!

最後一個功能最方便,終於可以使用 Icedove/Thunderbird 方便的撰寫問題回報了,可超方便的使用 Enigmail 與拼字檢查功能了!

備註: reportbug 與 reportbug-ng 都是 Debian GNU/Linux 的軟體瑕疵回報工具。與 Ubuntu Launchpad 的簡易回報方式有相當大的差異,詳情請參閱 Debian bug tracking system

稍早曾經介紹過 Debian 無人值守安裝程式,也就是 pre-seeding

最近看到熱血的 Daniel Bo 做了數個針對不同的桌面環境所設定的幾個預先安裝檔,如果你注意到他的網站名稱叫做 I’Been to Ubuntu,大概就不會意外他為了 Debian 做了這些桌面安裝環境的用意了。這個計畫可以協助你先排除一些需要先調整、設定才能開始使用系統的難題,於是你可以先透過 preseeds 光碟安裝一個馬上可用的系統作入門,但也保有 Debian 原有的特色。

目前支援的桌面環境有 Gnome, KDE, XFCEFVWM 等,你可以從網站上直接下載安裝光碟。對了,Daniel BoGames That Work 網站也相當精彩。

你若使用 ifupdown 於不同的網路環境間切來換去,特別是固定 IP 、PPP/PPPoE 撥接、DHCP 等不同的設定。你可能會被不同服務間使用的 Domain Name Server 設定困擾,尤其是連接某些無線網路的被配到 NAT 內的 DNS,再改回 Static IP 時,/etc/resolv.conf / resolv.conf(5) 沒有被更新,於是還必須手動更改成 NAT 外可用的 DNS 位址。

此時可以利用 resolvconf (8) 來代勞,基本概念是 resolvconf 做了一些基本的設定架構與指令,你可以透過指令或設定檔預先設定想使用的 DNS 位址。若搭配 ifupdwon 使用,只需更改 /etc/network/interfaces 如

# The primary network interface
allow-hotplug eth1
iface eth1 inet dhcp
dns-nameservers 168.95.1.1 168.192.1.1
dns-search google.com debian.org

這是一篇 Tip.

其實在 Linux 上做檔案快取 (readahead/prefetch) 的技術頗多,除了稍早講的 readahead, 還有 preload, bootcache/filecacheprefetch. (prelink 是加快 ELF shared libraries/executables 的載入速度,不算是檔案快取)

不過 readahead 只在開機的產生效用,若開機後得依賴 preload 等工具來做檔案快取。但以 user space 的 daemon 每幾秒掃一次系統的效果實在不怎麼好。

比較吸引我注意的是 SoC 2007 中的一個計畫 prefetch

prefetch 算是融合了前幾個計畫的優點與特色的專案,計畫整合了 kernel patch 與 userspace 工具,主要特色是透過核心作監視各軟體啟動所需要取用的檔案,配合 userspace 工具做到自動更新(dynamic profiling)。

對使用者而言,操作起來容易許多,不需要像 readahead 或 bootcache/filecache 作手動「教育」,且使用效率上也會比 preload 來的好。當然,與 readahead 相較起來,實做方式也比較輕盈、聰明。

技術細節可以參考 Krzysztof Lichota 的提案 (Ubuntu Wiki) 與簡報。Prefetch 原始碼可於 Launchpad 下載,相關文件與文獻位於 Google Code. 另外,Behdad Esfahbod 的論文 “Preload — An Adaptive Prefetching Daemon” 也很值得參考。

BTW, Krzysztof Lichota 也是 one-click installer 的開發者。