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

2013年12月24日 星期二

configure 時缺少 ncurses

OS:ubuntu 13.10


有時在對套件做 configure 時會遇到如下訊息,即在系統裡少了 ncurses library。


configure: error: ncurses or ncursesw selected, but library not found (--without-ncurses to disable)


這時只要使用如下指令安裝 ncurses-dev 套件即可。


#apt-get install libncurses-dev


Dec 24th, 2013 by samlin35
Last Modified on Dec 24th, 2013

2013年1月11日 星期五

Fedora 17 更改 host name

Fedora 17 更改 host name

Jan 11th, 2013 by samlin35

Environment:
    OS: Fedora 17 64bit
    ip address:  192.168.205.116 (by DHCP)
    netmask: 255.255.0.0
    hostname: testpc1
   
假設我們要將原 host name 是 testpc1 設定成 testpc2,步驟如下:

1. 使用 root 帳號。
$ su

2. 編輯 /etc/hosts,將 host name 是 testpc1 的字眼都改成 testpc2。我的 /etc/hosts 如下:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 testpc2
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 testpc2

3. 編輯 /etc/sysconfig/network,將裡頭的 HOSTNAME 指定成你要的 hostname。我的 /etc/sysconfig/network 如下:

NETWORKING=yes
HOSTNAME=testpc2

4. 使用 hostname 指令設定一次。

# hostname testpc2

5. 重新登入後,就會看到提示符號有正常顯示,使用 hostname 指令查看,也可看到已使用新的 hostname 了。

[sam@testpc2 ~]$
# hostname
testpc2

Fedora 17 切換 runlevel

Fedora 17 切換  runlevel

Jan 11th, 2013 by samlin35

如果要讓 Fedora 17 開機後就跑在文字模式 (Text Mode) 下的話,執行:
# ln -sf  /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target

如果要跑在圖形模式 (Graphical Mode) 的話,執行:
# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target

以上動作記得使用 root 帳號來執行,不然會出現 Permission denied 的錯誤訊息。

另外,從 Fedora Documentation 可以知道 Fedora 現在定義的 Runlevel 如下,並且 level 2, level 4 已不再使用。

0 — Halt
1 — Single-user text mode
2 — Not used (user-definable)
3 — Full multi-user text mode
4 — Not used (user-definable)
5 — Full multi-user graphical mode (with an X-based login screen)
6 — Reboot

參考資料:

2009年7月15日 星期三

Linux 上使用 NTFS

Linux 上使用 NTFS

July 14th, 2009 by Chuan-Hsien Lin
Last Modified on July 14th, 2009

先來說說我的環境,我是使用一塊 ARM 相容的開發板,Linux Kernel 採用 2.6.22.18。

可以看的出來,硬碟中有個 NTFS 的 Partition。

-sh-3.2# fdisk -l
Disk /dev/sda: 82.3 GB, 82348277760 bytes
255 heads, 63 sectors/track, 10011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot  Start  End  Blocks  Id System
/dev/sda1    1      123  987966  7  HPFS/NTFS  

尚未在 Linux Kernel 勾選支援 NTFS,直接去掛載 NTFS Partition 會出現問題。

-sh-3.2# mount -t ntfs /dev/sda1 /mnt/hd1
mount: mounting /dev/sda1 on /mnt/hd1 failed: No such device

由於 Linux Kernel 本身就可支援 NTFS 了,所以我們 make menuconfig 來設定支援 NTFS,

<*> NTFS file system support
[*] NTFS write support

再來執行一次 mount,成功的掛載了,

-sh-3.2# mount -t ntfs /dev/sda1 /mnt/hd1
NTFS volume version 3.1.

-sh-3.2# mount
rootfs on / type rootfs (rw)
/dev/root on / type nfs (rw,vers=2,rsize=4096,wsize=4096,hard,nolock,proto=udp,timeo=11,retrans=2,sec=sys,addr=192.168.51.15)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw)
/dev/sda1 on /mnt/hd1 type ntfs (rw,uid=0,gid=0,fmask=0177,dmask=077,nls=iso8859-1,errors=continue,mft_zone_multiplier=1)

雖然掛載後,但卻是只能讀不能寫入,

-sh-3.2# touch /mnt/hd1/testfile
touch: /mnt/hd1/testfile: Permission denied

如果想要可以讀寫 NTFS,得使用別的方式,目前比較流行的是使用 ntfs-3g 這個套件。

安裝好 ntfs-3g 去執行的話,會發現少了 fuse 套件,

-sh-3.2# ./ntfs-3g /dev/sda1 /mnt/hd1
modprobe: cannot parse modules.dep
ntfs-3g-mount: fuse device is missing, try 'modprobe fuse' as root

由於後來的 Linux Kernel 裡面都內建了 FUSE 了,所以在 make menuconfig 時指定,

<*> Filesystem in Userspace support

然後重新編譯 Linux Kernel 後,進到 target board 後再來 mount 一次就可成功了,

./ntfs-3g /dev/sda1 /mnt/hd1

如果要可以格式化 NTFS 的 partition 的話,得再裝另一個套件 nefsprogs, 這套件裡有蠻多針對 NTFS 運作相關的程式,像我就會使用產生出來的 mkntfs 去格式化 NTFS,用 ntfslabel 去寫 label。

相關資源:

ntfs-3g
http://www.ntfs-3g.org/

nefsprogs
http://www.linux-ntfs.org/

NTFS FAQ (中文)
http://www.linux-ntfs.org/doku.php?id=ntfs-zh_tw

2009年7月5日 星期日

Linux 好用網站

Linux 好用網站

July 4th, 2009 by Chuan-Hsien Lin
Last Modified on July 6th, 2009

Jserv's blog
http://blog.linux.org.tw/~jserv/

鳥哥的 Linux 私房菜
http://linux.vbird.org/

IBM developerWorks 的 Linux 專區
http://www.ibm.com/developerworks/linux/
http://www.ibm.com/developerworks/cn/linux/ (中國)

The Linux Kernel Archives
http://www.kernel.org/
要下載 Linux Kernel 的 Source code 就是這。

2008年3月27日 星期四

為 Fedora 8 裝上 kernel source

為 Fedora 8 裝上 kernel source

March 26th, 2008 by Chuan-Hsien Lin
Last Modified on March 26th, 2008

Fedora 8 裝好之後,會發現 kernel source 目錄是個空殼,只留下一堆 Makefile 卻不見 source code,當想要看 kernel source 時才驚覺 code 到用時方恨少,所以本文在此介紹如何在 Fedora 8 下安裝 kernel source。

首先,先確認一下系統裡的 Linux kernel 版本,

[root@chtest i386]# uname -r
2.6.23.1-42.fc8
[root@chtest i386]#

然後再到 http://download.fedora.redhat.com/pub/fedora/ linux/releases/8/Fedora/source/SRPMS/ (請自行將網址接起來) 尋找我們要的 kernel source rpm。接著在這網頁可以發現到 kernel-2.6.23.1-42.fc8.src.rpm 這個檔案存在,大約 46MB,確定了版本無誤之後,將它下載。

接著,使用 rpm 工具將它安裝,過程中會看到一堆 warning: group kojibuilder does not exist - using root 訊息,不用去理會它。

[root@chtest i386]# rpm -ivh kernel-2.6.23.1-42.fc8.src.rpm

接著執行 rpmbuild -bp --target=$(uname -m) /usr/src/redhat/SPECS/kernel.spec, kernel source 就會安裝到 /usr/src/redhat/BUILD/kernel-2.6.23 了,在這個目錄裡面有兩個子目錄 linux-2.6.23.i686 及 vanilla,vanilla 這目錄是存放原始的 kernel source, 而 linux-2.6.23.i686 則是 Fedora 團隊為原始的 kernel source 上些 patch 及 updates。

經過以上動作後,如此一來就有一份完整的 kernel source,以便要 trace 或是要寫些 driver 使用。

參考資料,Personal Fedora 8 Installation Guide , http://www.mjmwired.net/resources/mjm-fedora-f8.html