2014年8月5日 星期二

Install SCIM chewing on Ubuntu 14.04

sudo apt-get install scim scim-chewing
sudo im-config -s scim-bridge

2014年8月4日 星期一

Update/Recover from Ubuntu 14.04 upgrade

1. First of all, the upgrade is simple. Follow the prompt and click next.

2. During the process, it says my xserver-xcore-video-all package has problem and my upgrade is canceled. In order to go on, I deleted that package
sudo apt-get remove xserver-xorg-video-all
3. Things go well until the system reboots

4. Download the latest NVIDIA driver from http://www.nvidia.com/Download/index.aspx and install.
    p.s. The latest one is 340.24 and before this I tried the previously used the old one 331.20 and a random one not even double checked 331.67, both won't work and says "The system is running in low-graphis mode."
    p.s. Please check /var/log/Xorg.0.log and kern.log for detail description. (words regarding nvidia driver problems)

5. Now we can log in but the resolution is very weired and shows only desktop. No unity icon, right botton does not work.
    p.s. I thought it's unity/compiz/lightdm problem so I removed the previous settings by

rm -rf  /.config/*
rm -rf ~/.compiz/*
rm -rf ~/.cache/compizconfig-1/  

but I think the above is unrelated.

6. Step 5 does not solve my problem and there is still not desktop with unity and I checked /var/log/lightdm/lightdm.log and found "Xlib:  extension "GLX" missing on display ":0"."

7. "DISPLAY=:0 glxinfo" shows the same error

8. ldd /usr/bin/glxinfo and found libGL.so links to correct version(340.23) driver gl library.

9. Suddently I recalled that I removed xservice-xorg-video-all in the first place.

10. Trying to install this package and found the PPAs are different for 13.10 and 14.04. So I remove the the original ppa
sudo ppa-purge xorg-edgers
and add it back
sudo apt-add-repository ppa:xorg-edgers
sudo apt-get update
sudo apt-get upgrade 

11. Finally my Ubuntu upgrade finishes.

2014年7月31日 星期四

SOP to reinstall nvidia graphic card driver

From time to time, the display won't work correctly after my system upgrade or software upgrade. The following is the SOP to solve this problem:
a.
   1. don't use Nvidia's graphic card

b.
   1. ctrl + alt + F1 to change to another tty
   2. sudo service lightdm stop to stop X
   3. sudo ./XXXX-nvidia.xxx.run
   4. sudo service lightdm start to activate X


2014年6月9日 星期一

LKD notes

1. types of exceptions:  divided by 0; page fault; system call
2. Why interrupt can not sleep?  Interrupt do not have task_info structure and therefore can not trace through the rbtree to find the next runnable process to run. Though current macro points to the interrupted process, but there is no way to find the interrupt handler that sleeps and to continue execution.
3. When do_IRQ() finished the isr, the entry code will then call ret_from_intr() and it checks is a reshcedule is pending(need_resched is set). If the reschedule is pending and the kernel is returning to user-space(that is, the interrupt interrupted a user process), schedule() is called. If the kernel is returning to kernel-space(that is, the interrupt interrupted the kernel itself), schedule() is called only if the preempt_count is zero. After schedule() returns, or if there is no work pending, the initial registers are restored and the kernel resumes whatever was interrupted. (do_IRQ() corresponds to handle_IRQ() under arch/arm/kernel/irq.c for ARM)
4. Sometimes we see spin_lock_irqsave()/spin_unlock_irqrestore() and mutex_lock()/mutex_unlock() pairs and the first is to provide protection against concurrent access from a possible interrupt handler and the later is to provide protection against concurrent access from another processor.
5. Interrupt handlers run asynchronously with at least the current interrupt line disabled.

2014年4月1日 星期二

Monitor dd progress

When we flash an image to a SD card through dd command,
we won't be able to know the progress by default.
 
If you need type sudo kill -USR1 $(pgrep ^dd) 
and you will see the progress.
 

2014年1月20日 星期一

Steps to mount .img

Ok, you may have a image with multi-partitions(for example, boot and rootfs )and you may need to access the data under rootfs, and, you don't want to flash this image.

The concept is you mount the partition inside the image you want and the following are steps.

1. find partition information
fdisk -l xxx.img
2. mount the partition as block device and have to specify the start address in bytes
 sudo losetup /dev/loop0 xxx.img -o $((Start Sectors*512))
3. mount it
sudo mount -t ext3 /dev/loop0 /mount/point

mount -o loop /path/to/image won't work in this case since the start byte does not contain file system information in this image type