We should forget about small efficiencies — Donald Knuth
31 Aug
Gentoo Linux 2006.1 released, from LWN.
這次的比較大的改變是:
如果已經裝 Gentoo 2006.0 以前的話, 那升級主要就是升 gcc 和 glibc. 要小心的是, 安裝 glibc 的過程一但出狀況, 事情會很複雜, 可能絕大部份的指令都不能用 (ls, bash, emerge and so on). 要特別注意.
glibc 2.4 預設已經 enable NPTL only, 所以 Gentoo 的 glibc 也不會採 NPTL 和 LinuxThread 雙行的模式了, 因此沒有在 /etc/make.conf 中設 nptlonly 的 USE flag, 是沒辦法裝 glibc 2.4 的. 因為我之前就有設 nptlonly, 所以無法知道沒設的話 migration 會有甚麼問題.
根據 GWN 08/28/2006, 說要升級 gcc 要參考這篇 GCC Upgrading Guide. 那我的步驟大致如下:
(Do upgrade new version of gcc)
# emerge --sync
# emerge -uav gcc
(Select new version of gcc in current shell session)
# gcc-config i686-pc-linux-gnu-4.1.1
# source /etc/profile
(Very important Step!!)
# fix_libtool_files.sh 3.4.6
* Scanning libtool files for hardcoded gcc library paths...
* [1/4] Scanning /lib …
* [2/4] Scanning /usr/lib …
* FIXING: /usr/lib/libasprintf.la …[vl]
* FIXING: /usr/lib/libMagick++.la …[vl]
* FIXING: /usr/lib/libusbpp.la …[vl]
* FIXING: /usr/lib/libpcrecpp.la …[vl]
* FIXING: /usr/lib/libdb_cxx-4.2.la …[vl]
* [3/4] Scanning /usr/i686-pc-linux-gnu/lib …
* [4/4] Scanning /usr/local/lib …
(Rebuilding libtool)
# emerge --oneshot -av libtool
(Upgrade glibc to 2.4 and so on)
# emerge -eav system
# emerge -eav world
(remove the older gcc version)
# emerge -Ca `equery l gcc | grep 3.4`
這樣就可以把 gcc 從 gcc-3.4.6-r1 升到 sys-devel/gcc-4.1.1 (PS: I remove gcc-3.4.6-r1 here), sys-libs/2.3.6-r4 升到 sys-libs/glibc-2.4-r3 了.
題外話, 根據 DesktopLinux.com 的 2006 Desktop Linux Market survey 訪問一萬五千個 Linux User 票選 most popular desktop of Linux 的結果如下:
God, Gentoo 竟然打敗 Fedora?! :p
Popularity: 30% [?]
30 Aug
Ubuntu upgrade ugliness, from linux-watch.
Ubuntu 在前幾天出大包, 在 UTC 時間 08/21/2006 17:30 到 08/22/2006 10:00 中有進行 update 系統的話, 會導致開 X-window 開不起來. 原因是 xserver-xorg-core 那個版本並不 stable. 解決的辦法就是裝更新過的 xserver-xorg-core 即可.
這個錯誤影響應該非常大, 畢竟 Ubuntu 主打是 End-user, 連 X-window 都進不去, 還要讓他們學怎麼用 command line 去更新 xserver-xorg-core 耶! 而且連這麼明顯的錯誤都沒發現, 那其它軟體的 stability 應該也要重新評估才對. 還蠻令失望的消息 :( 衷心的希望 Ubuntu 能夠 refine 整個 QA verify program 啊!
Popularity: 29% [?]
29 Aug
Installing Debian GNU/Linux using debootstrap, from Linux.com.
If you’re not afraid of getting your hands dirty with the command line when you install Gentoo Linux, you may like to try this alternative method for installing Debian GNU/Linux.
Debootstrap creates a basic Debian installation, and can also be used for creating custom, minimal installations on embedded systems or for replacing a pre-installed Linux distribution with Debian on a co-located server.
Popularity: 26% [?]
25 Aug
To get a core dump you need to do something to change the max core file size, because it’s 0 by default.
In Linux, default shell bash has a built-in command which lets you set various resource limits for the processes started by the shell, like the core file size, called ulimit. You, hence, have to change these limitations before executing any program you want.
Let’s see how it work:
sojia [~] -pigfoot- [W0] ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
pending signals (-i) 32767
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 32767
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
“core file size” line says 0 blocks. Change it by using ‘ulimit -c’:
sojia [~] -pigfoot- [W0] ulimit -c
0
sojia [~] -pigfoot- [W0] ulimit -c unlimited
sojia [~] -pigfoot- [W0] ulimit -c
unlimited
As you think, to enlarge the available FDs is to set the option of “-n”. Not exactly. It’s because only privileged user (root) can set this option. Here we go:
sojia [~] -pigfoot- [W0] ulimit -n
1024
sojia [~] -pigfoot- [W0] ulimit -n 8192
bash: ulimit: open files: cannot modify limit: Operation not permitted
sojia [~] -pigfoot- [W0] su
Password:
sojia ~ # ulimit -c
unlimited
sojia ~ # ulimit -n
1024
sojia ~ # ulimit -n 8192
sojia ~ # ulimit -n
8192
sojia ~ # exit
logout
sojia [~] -pigfoot- [W0] ulimit -n
1024
The first, we can see it encounters “Operation not permitted” as normal user. Second, coredump size is inherited. The last but the important thing is, when we terminate privileged session and return to normal user shell, the maximum number of FDs is back. You know why? Feedback please. ;-)
AS a result, if we want to change the maximum number of FDs for some program, we must execute it as root. Please keep it in mind.
Popularity: 17% [?]
21 Aug
Why Doesn’t Linux Need Defragmenting?, from OSNews.
It’s a question that crops up with depressing regularity: Why don’t Linux filesystems need to be defragmented?. Here’s my attempt at answering once and for all.
Rather than simply stumble through lots of dry technical explanations, I’m opting to consider that an ASCII picture is worth a thousand words.
Although oneandoneis2 doesn’t mention either NTFS or ext3, but I think this article gives a simplistic overview of how filesystems writes files.
Popularity: 10% [?]
20 Aug
20 Aug
在看 Gentoo 的 portage log 時, 看到一個還蠻有趣的軟體, 叫做 cryctcat (portage/net-analyzer/cryptcat , ports/net/cryptcat).
雖然整體功能來說, 我覺得還是 socat (portage/net-misc/socat, ports/net/socat) 比較強, 不過就編密這方面, 因為 socat 是利用 OpenSSL 來達成這個效果, 就 netcat 簡而易用的角度, 不如用 cryptcat 所採用的 Twofish 這種 symmetric key block cipher 來的簡單易用了.
原先利用 netcat 來傳檔的方法如下:
MachineA:
nc -l 12345 < file.orig
MachineB:
nc MachineA.IP 12345 > file.sent.by.MachineA
要改成
MachineA:
cryptcat -l -p 12345 < file.orig
MachineB:
cryptcat MachineA.IP 12345 > file.sent.by.MachineA
這樣就會利用預設的密碼 metallica, 透過 Twofish 加密. 當然, 也可以用 -k 這個 option 來改變預設的密碼 ;-)
Popularity: 33% [?]