[Ubuntu] GPG error: NO_PUBKEY

Sunday, June 12, 2011
意見
If we added some extra source entries to source.lists, we may meet the "NO_PUBKEY" problem when we ran 'sudo apt-get update'. Detail log stated below.

W: GPG error: http://ppa.launchpad.net natty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D6B6DB186A68F637

This is because we don't have the key of those new-added entries.
The following commands should help.
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com D6B6DB186A68F637

That's it, now you should be able to run "sudo apt-get update" again without problems.

[Ubuntu Natty] Transfer files to Transformer TF101

Thursday, May 26, 2011
4 意見
Currently, the TF101 has been treated as MTP instead of UMS when connects to PC.
And there're two ways I found to transfer files into to its internal storage.

Reference: [Guide] Mount Internal Storage in Ubuntu

By gmtp
$ sudo apt-get install gmtp
By mtpfs
1. $ lsusb (find out vendorId of your device)
Bus 001 Device 007: ID 0b05:xxxx ASUSTek Computer, Inc.
2. add 'SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"' to
/etc/udev/rules.d/95-android.rules

3. $ sudo apt-get install mtpfs
4. $ sudo mkdir /media/TF101
5. $ sudo chown user.user /media/TF101
6. add 'mtpfs /media/TF101 fuse user,noauto,allow_other 0 0' to /etc/fstab
7. uncomment 'user_allow_other' in /etc/fuse.conf

Reboot and have fun.

[Ubuntu Natty] Make active tab in GNOME terminal more prominent

Thursday, May 19, 2011
0 意見
The active tab in newly Ubuntu Natty was hard to distinguish from each others.
Let's try to make it more prominent!

Steps:
1. create ~/.gtkrc-2.0
2. copy&paste the following content into ~/.gtkrc-2.0
style "gnome_terminal_notebook"
{
fg[NORMAL] = "#00ff00"
bg[NORMAL] = shade (1.25, "#3c3b37")
}

widget "*TerminalWindow.*.GtkNotebook*" style "gnome_terminal_notebook"


And remember to logout/login to make new settings take effect.

References: http://askubuntu.com/questions/40332/how-to-make-selected-tab-in-terminal-more-prominent

[Ubuntu Natty] Disable Overlay Scrollbars

0 意見
This article was originally posted at "http://ubuntu4beginners.blogspot.com/2011/04/disable-overlay-scrollbars-in-ubuntu.html"

If you don't like the new overlay scrollbars, try the following steps

$ sudo apt-get remove overlay-scrollbar
$ sudo su
$ echo "export LIBOVERLAY_SCROLLBAR=0" > /etc/X11/Xsession.d/80overlayscrollbars


and reboot. You're all set!

[Ubuntu Maverick] Eclipse Helios SR2 crash while navigating linux kernel source

Monday, April 18, 2011
0 意見
For work purpose, I've installed CDT with newest eclipse-jee helios SR2, but the eclipse always crashed(killed by OS) when it was doing C/C++ indexing. By investigating this, I found there are error dumps resides at the installation directory of eclipse, filename looks like hs_err_pidXXXX.log, where XXXX was the pid killed by OS.

The beginning of the file would be something like the following:

#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fc77d932c8c, pid=17060, tid=140494693254912
#
# JRE version: 6.0_24-b07
# Java VM: Java HotSpot(TM) 64-Bit Server VM (19.1-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V [libjvm.so+0x5d5c8c]

Well, it seems like an buffer overrun bug of JVM, and I think I don't have time to dig in XD.

But, I just switched my VM from sun-java5 to sun-java6 yesterday, and before that I can
use eclipse to trace kernel source without any problem. So, I'm gonna give it a try by changing the VM used by eclipse back to sun-java5.

Here's the steps:

Add the red part in $ECLIPSE_HOME/eclipse.ini

--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
/usr/lib/jvm/java-1.5.0-sun/bin/java

-vmargs
-Dosgi.requiredJavaVersion=1.5

And finally, this solved the crash problem.
My eclipse just works like a charm now.

[Ubuntu Maverick] Install packages from PPA

Wednesday, January 26, 2011
0 意見
Personal maintained packages will update more frequently than the official release in most of the cases. For example, ibus.

Recently, I just installed ibus-pinyin in Maverick, after playing with ibus for a while, I found out that it didn't support Simplified/Traditional Chinese switching. The pinyin result always mixed up SC/TC characters and made me so hard to choose the right one.

Thanks for Google, I found something helpful. The current version in official release was 1.3.7-1ubuntu4, but the latest version of ibus in PPA is 1.3.9, and it supported the SC/TC switching since 1.3.8. Cool!

Installation steps stated bellow:

1. Go to PPA Website.
2. Search packages you would like to install, ex. ibus
3. We can found the ppa maintained by ibus author, https://launchpad.net/~shawn-p-huang/+archive/ppa
4. In the "Adding this PPA to your system" section, we can find "ppa:shawn-p-huang/ppa"
5. Open your favorite terminal
6. $sudo add-apt-repository ppa:shawn-p-huang/ppa


The script will do all the tedious things for you. (import key, install...etc)

P.S. You can find the new-added site located at "/etc/apt/sources.list.d/"

[Ubuntu Maverick] Reset Gnome top panel to default

Tuesday, January 18, 2011
0 意見
$gconftool --recursive-unset /apps/panel && killall gnome-panel

[Ubuntu Maverick] Change hostname

Thursday, January 13, 2011
0 意見
Keep a memo here in case.

1. $sudo vim /etc/hostname
2. $sudo vim /etc/hosts
3. logout&login
4. $hostname

[Ubuntu Maverick] Configure GDM Login Screen

0 意見
When you broke your login screen UI, you may try the following steps to rescure it.

  1. $sudo ln -s /usr/share/applications/gnome-appearance-properties.desktop /usr/share/gdm/autostart/LoginWindow/
  2. Logout, the GDM "Appearance Setting" will popup
  3. Select the default "Ambiance" and then press the "Customize" button, you can configure login theme/icons here.
  4. After customizing the "Appearance Setting", login
  5. $sudo unlink /usr/share/gdm/autostart/LoginWindow/gnome-appearance-properties.desktop

[Ubuntu Maverick] Enable Wireshark capturing for non-root user

Monday, January 10, 2011
3 意見
When you tried to launch the wireshark capturing, you may encounter a problem: there's no network interfaces available for capturing. This is because the executable(/usr/bin/dumpcap) which is doing the indeed capturing job needs permission of root. Fortunately, I found the solution at wireshark wiki:CapturePrivileges, and I did some modification due to security concern. And I am going to keep a memo here in case someday someone may need this :-)
$sudo useradd -U -M -s /bin/false wireshark
$sudo chgrp wireshark /usr/bin/dumpcap
$sudo chmod 754 /usr/bin/dumpcap
$sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap
$sudo gpasswd -a [username] wireshark

logout & login, and you're done!
p.s.
[1]. useradd: -U means "Create a group with the same name as the user, and add the user to this group."
[2]. useradd: -M means "Do no create the users home directory."
[3]. useradd: -s /bin/false means "Do no give the user a login shell."
[4]. chgrp: Change the group of each FILE to GROUP.

[Ubuntu Maverick] JDK5 Installation/Setup for building Android in x64 architecture

Friday, January 7, 2011
2 意見
Sun-JDK5 is one of those prerequisites that used to build android source successfully.
(According to official setup notes: Java 6 is not supported, because of incompatibilities with @Override.) The default JDK choose by Maverick was icedtea6, which is not recommended for building android, so, we're gonna install JDK5 instead of icedtea.

Unfortunately, JDK5 was abandoned by Ubuntu 10.10/10.04, but fortunately, Janty(9.04) still have JDK5 in its repository. So, let's move on.

Add packages sources to /etc/apt/sources.list:
deb http://archive.ubuntu.com/ubuntu dapper main multiverse
deb http://archive.ubuntu.com/ubuntu dapper-updates main multiverse

and then:
$sudo apt-get update
$sudo apt-get install sun-java5-jdk

after installation finished, use
$java -version
to check the current java version.

If you had JDK6 installed before JDK5, you probably need help from 'update-alternatives'.
First, list all Java installed,
$update-java-alternatives -l
Second, set the JDK5 as system default,
$sudo update-java-alternatives -s java-1.5.0-sun
You are ALL SET!

[Ubuntu Maverick] Get ubuntu/kernel version/code-name

0 意見
Sometimes, when you logged in a remote Ubuntu server, it will be easier to find out suitable packages if you know the version/code-name of it.
In gnome terminal, to get the Ubuntu version, use the following command:
  • $cat /etc/lsb-release
you will get some similar output as following:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"

to get the kernel version, use the following command:
  • $uname -a
then you will get the following output:

Linux 2.6.35-generic #42-Ubuntu SMP Thu Dec 1 00:00:00 UTC 2000 x86_64 GNU/Linux

[Gentoo] X201 Black Screen Solution

Friday, October 29, 2010
0 意見
According to my experiments, while using kernel version between 2.6.32-gentoo-r10 and 2.6.35-gentoo-r9, my Thinkpad X201 always got a black screen, but by applying the following patch, I can boot into framebuffer console with KMS(Kernel ModSetting) on.
  1. Under $KERNEL_ROOT/drivers/gpu/drm/i915/intel_display.c
  2. 858 intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
    859 int target, int refclk, intel_clock_t *best_clock)
    860 {
    861 struct drm_device *dev = crtc->dev;
    862 struct drm_i915_private *dev_priv = dev->dev_private;
    863 intel_clock_t clock;
    864 int max_n;
    865 bool found;
    866 /* approximately equals target * 0.00585 */
    867 int err_most = (target >> 8) + (target >> 9)
    868 // patch for KMS black screen
    869 err_most += 50;
    870 found = false;

But now, this bug/issue seems to be fixed in kernel version 2.6.36, I just emerge the gentoo-sources-2.6.36 without applying above patch, and it works.

Keywords: ThinkPad, X201, Gentoo, Black Screen, KMS

[Gentoo] iBus broke Konsole "Ctrl+Shift+C/V"

Tuesday, August 24, 2010
0 意見
Situation:

After I upgrade my iBus to v1.3.7,the hotkey "Ctrl+Shift+C"(Copy) and "Ctrl+Shift+C"(Paste) in Konsole was broken. For example, I selected something in Konsole and pressed "Ctrl+Shift+C", and then switched the input focus to Chromium search bar and pressed "Ctrl+V", NOTHING pasted!

Enviroment:

gentoo-sources: 2.6.32-gentoo-r10 x86_64
kdebase-meta: 4.4.4
qt-core: 4.6.3
ibus: 1.3.7

Solution:

After trying few old version of ibus, I found the v1.3.4 works. I guess there might be something wrong with the "key-snooper" function, because ibus releases that came without "key-snooper" function enabled could work in my Gentoo box; however, I didn't spend much time on debugging this.
The following are just steps for a temporarily workaround:

  1. Download ibus-1.3.4.tar.gz from Google iBus Project.
  2. $ sudo cp ibus-1.3.4.tar.gz /usr/portage/distfiles
  3. $ cd /usr/portage/app-i18n/ibus/
  4. $ sudo cp ibus-1.3.7.ebuild ibus-1.3.4.ebuild
  5. $ sudo ebuild ibus-1.3.4.ebuild digest
  6. $ sudo ebuild ibus-1.3.4.ebuild merge

By using ebuild to install packages, we can still benefit from portage management (unmerge, gentoolkit…etc).

P.S.:

In the past, I usually put xx-input under /etc/X11/xinitrc/xinitrc.d/, but now I moved those variables settings to ~/.xprofile as suggestion during ibus installation.

export XMODIFIERS="@im=ibus"
export GTK_IM_MODULE="ibus"
export QT_IM_MODULE="xim"
ibus-daemon -d -x

Keywords: ibus, Gentoo, Copy&Paste Broken

[Gentoo] Trackpoint under Xorg-1.8

Friday, June 11, 2010
0 意見
環境:ThinkPad X201

Xorg1.8中多了udev support,原本透過HAL來config(/etc/hal/fdi/policy/)的Keyboard & mouse等
現在搬到/etc/X11/xorg.conf.d。(Ubuntu: /usr/share/X11/xorg.conf.d/)

為了讓Trackpoint可以動,在/etc/X11/xorg.conf.d新增20-trackpoint.conf,內容如下:

Section "InputClass"
Identifier "thinkpad_trackpoint_wheel_emu"
MatchIsPointer "on"
MatchProduct "TrackPoint"
Driver "evdev"
Option "EmulateWheelButton" "2"
Option "EmulateWheel" "on"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
Option "ZAxisMapping" "4 5 6 7"
Option "Emulate3Buttons" "on"
EndSection

重新啟動X Server就搞定了。

[Android] Transparent Activity

Wednesday, October 14, 2009
0 意見
I learned this from my friend Ares. :-)

1. res/values/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TransparentTheme" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@null</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>

[Vim] Indent+Formatting

Thursday, May 7, 2009
0 意見
Indent

[Git] Gitconfig

Tuesday, May 5, 2009
0 意見
Configure global variables in git:

git config --global user.name 'MYNAME'
git config --global user.email 'oo@xx.abc'
git config --global color.status auto
git config --global color.branch auto
git config --global core.editor 'vim'


Or, create ~/.gitconfig, and paste the following content into it.


[user]
    email = aaa.bbb@gmail.com
    name = aaa.bbb
[color]
    ui = auto
    diff = auto
    status = auto
    branch = auto
    log = auto