google code-beautifer

星期三, 9月 28, 2016

Mageia 5 WPA2 Enterprise setting [solved]!

If your you need to connect to a WPA2 Enterprise wireless  server similar to this setting in Ubuntu's network manager
    Wireless security: WPA & WPA2 Enterprise
    Authentication: Protected EAP (PEAP)
    Anonymous Identity: NetID
    CA certificate: None
    PEAP version: Automatic
    Inner Authentication: MSCHAPv2
    Username: NetID
    Password: password

This is the Ubuntu's WPA2 for setting above using network manager in wpa_supplicant.conf
network={
    pairwise=CCMP
    proto=RSN
    ssid="YOURWPA2_AP_SSID"
    password="MYPASSWD"
    eap=PEAP
    key_mgmt=WPA-EAP
    phase2="auth=MSCHAPV2"
    identity="MYNETID"
    auth_alg=OPEN
     phase1="peaplabel=auto peapver=0"
    eapol_flag s=0                  
    disbaled=1                    
}

This is the setting of  the default Mageia 5 WPA2 Enterprise setting using network manager.   in /etc/wpa_supplicant.conf.  This will not work.
network={
    pairwise=TKIP
    proto=WPA
    identity="MYNETID"
    ssid="YOURWPA2_AP_SSID"
    password="MYPASSWD"
    scan_ssid=1
    group=TKIP
    mode=0
    eap=PEAP
    key_mgmt=WPA-EAP
    phase2="auth=MSCHAPV2"
}

This is the Mageia's  working WPA2 Enterprise  setting equivalent to the one in Ubuntu .  It works!
network={
    pairwise=CCMP
    proto=RSN
    identity="MYNETID"
    ssid="YOURWPA2_AP_SSID"
    password="MYPASSWD"
    scan_ssid=1
    group=CCMP TKIP
    mode=0
    eap=PEAP
    key_mgmt=WPA-EAP
    phase2="auth=MSCHAPV2"
}

the difference between Ubuntu and Mageia's default  WPA2 enterprise setting
+ scan_ssid=1        // mageia default
+ group=TKIP        // mageia old use TKIP
+ mode=0              //  mageia default
- auth_alg=OPEN // Ubuntu's, not needed in
- phase1="peaplabel=auto peapver=0"   // Ubuntu      
- eapol_flags=0    // Ubuntu                           
-  disbaled=1        // Ubuntu

diff wpa_supplicant.conf wpa_supplicant.conf.old (the later the is Mageia's non-working default setting)
<    pairwise=CCMP
<    proto=RSN
<    group=CCMP TKIP
>    pairwise=TKIP
>    proto=WPA
>    group=TKIP

This is the 2/20 of my 開放改變20 initiative in this year.

星期六, 9月 03, 2016

.emacs 除錯

emacs 是個很強大的編輯器,把.emacs 設好就會展現強大功能,但要新手一下就能對.emacs除錯不易。

覺得emacs 起始頁說要你用emacs --debug-init真是胡扯,我照做了,啥都看不見。正解應該是(至少是在v24.4 之類在xwindows 下跑的emacs):不管錯誤先進emacs再說 ,然後用meta-x ielm進入 inferior lisp mode,下面幾乎就跟完整lisp 解譯發展環境一樣隨你跑,打入一個變數,他就會立即顯示他的值,然後去觀察這值為何沒有設定好。emacs 的外掛大部份時候其實就是把變數設正確就成了。理論上不跑 ielm 用熱鍵contrl-h v 也可以,可是變數一多,重複打熱鍵這就會很煩

而且既然是個lisp 解譯發展環境,可以拿來解決一些生活上的小問題,或拿來練練功也不錯

星期日, 8月 28, 2016

gnome 檔案管理員用/media/或/mnt/方式掛載磁碟分割區的考量

以前linux 的磁碟分割區一般都放在/mnt下。現在非native的異類檔案系統比如說osx 的hpfplus或windows 的ntfs可以放在/mnt也可放在/media (而且是預設值)怎樣用才好?一直到我最近把gnome shell整合跑一遍,我才了解一些使用設計細節:

/media/ 設計是給mount on demand 的分割區用的,所以指定掛載點要選/media/或/mnt/的方式,不是看是不是非native 檔案系統,而是看你打算怎樣用他:

在gnome 的檔案管理員,(如nemo) ,按F9 有個側邊欄可以切換顯示
  • 假如是寫/mnt/的方式在/etc/fstab 裡指定掛載點,檔案管理員側邊欄不會特別顯示(除非你特地加書籤) 
  • "外部"(這是相對應用固定掛在/mnt/下而言)磁碟分割區不管有沒有mount,都會在側邊欄裏顯示在"裝置"這一區裏,這跟是不是native的檔案系統無關(比如esata 或usb 行動碟也可以用ext 的檔案系統) 
  • * 但是假如你用/media/的方式在/etc/fstab 裡指定掛載點,一開機他就會mount 起來,但是gnome 的檔案管理員側邊欄會有多一個按鈕可以unmount 

所以有幾個應用模式可以思考:
  • 每次都掛載的固定不動磁碟分割區,請用/mnt/的方式,必要時用gnome 的書籤指定,方便在檔案管理員側邊欄裏顯示存取 
  • *不想在gnome檔案管理員側邊欄老看到某個磁碟分割區礙眼,那就在/fstab裡用/mnt的方式把他掛起來吧 
  • 固定不動磁碟分割區,但是偶一為之才要掛載,請把磁碟分割區的分割區標籤設好(不然在檔案管理員側邊欄只會顯示他的容量大小,不容易看出誰是誰),不要寫進/etc/fstab,系統開機看到他,在使用gnome 的檔案管理員,就會在側邊欄顯示,你可以按右鍵掛載,不過需要root 密碼 
  • 常常要用,但偶而要卸載的磁碟分割區(也許esata 之類的外接硬碟爾而要拿給其他電腦交換資料會有這種需求),就用/media/的方式在/etc/fstab裡指定掛載點

星期日, 7月 24, 2016

關於手機平版隨插即用的資料同步與傳輸

新型的手機平版當otg 跟電腦傳資料都是用mtp 協定。(ios 需要libimobiledevice ,新版已支援到ios 10但Mageia Llinux 要到6 才會更新RPM 成lib64imobiledevice6-1.2.0-5.mga6  )
在linux 下只要libmtp 之類的裝一裝,gnome desktop 在插入USB 行動裝置時就會認的,然後會叫用nautilus 或nemo 之類的檔案管理員。
但是他不是系統的固定掛載,比較像ftp  得用類似
mtp://[usb:001,001]/ 這樣方式去讀取,android 系統的相片一般是在
mtp://[usb:001,001]/Internal%20storage/DCIM/Camera
所以預設一次只有一個程式能管理這裝置。這就無怪gnome-commnader 或krusader 之前都還不支援mtp 。雖然有些人開始補丁krusader了。比較快還是裝上 kio-mtp 。詳情見[1][2][3]

其實是有辦法把他拉出來變成自動半固定掛載,但是還得去改udev 有的沒的 ,不是很容易,所以這邊先跳過設定這一段的詳情。詳情見[4]。先講一下udev 的一些新手會遇到的udev 問題:根據這篇 https://www.freedesktop.org/software/systemd/man/udev.html
系統套件的udev 規則會寫到 /usr/lib/udev/rules.d, 而當地系統管理的udev規則會寫到 大家熟知的/etc/udev/rules.d
問題是後者不會優先執行,兩邊是看命名順序。而udev 規則命名順序弄錯了會跑不出來,所以即使我們都是把客制化的規則寫到/etc/udev/rules.d
還是得去/usr/lib/udev/rules.d  看一下有沒有衝突的地方

參考
[1]How display usb-connected android in krusader?
https://forum.kde.org/viewtopic.php?f=225&t=127711

[2]Bug 325649 - MTP USB devices are not shown in drop down list of disk drives
https://bugs.kde.org/show_bug.cgi?id=325649

[3]Enable Support for Android MTP in KDE
http://www.linux-magazine.com/Online/Blogs/Productivity-Sauce/Enable-Support-for-Android-MTP-in-KDE

[4]MTP
https://wiki.archlinux.org/index.php/MTP

星期六, 7月 02, 2016

關掉 gnome desktop screensaver 的密碼要求

這一年megeia 5常常遇到一個怪異情況,電腦idel 一段時間後被screensaver 鎖住這是正常的,但是打半天密碼根本進不去,害我得硬是切到文字組態,砍掉舊的X 行程重新來過。因為當掉時按打大小寫切換鍵是有效的,但是英文密碼就是輸不進去,所以我懷疑我裝的 hime 中文輸入跟gnome desktop 整合有問題 。這個問題要修不知哪年才得解決。

但是不能讓電腦這樣有事沒事給我罷工,所以只好先把screensaver 預設用密碼鎖住的行為關掉。網上找了一下,有很多gnome舊版的資訊都不能用了,新一點的(3.14 以後)是用(主選單->系統工具->)dconf 去改org.gnome.desktop.screensaver.lock-enabled (把他關掉)

這個選項以前是有整合在桌面GUI 裏供人選擇,但是這幾年gnome 3 改的亂七八糟,不知為何這個選項跟很多選項就被拿掉了,得自己hack。希望megia 6 搭配的 gnome 3.20 會好一些