Friday, March 16, 2018

systemd-udevd taking 100 percent cpu - solved by blacklisting cx88_alsa audio driver and cx88xx etc TV Card Driver

--------------------------------------------------
Problem
--------------------------------------------------
systemd-udevd taking 100% cpu.
Even failing to power off Ubuntu. (screen shut down, machine power stayed on. Has to long press power button to shuf down Ubuntu1604LTS.)

--------------------------------------------------
Investigating
--------------------------------------------------
Seeing this i2c related kernel error.
"i2c i2c-1: sendbytes: NAK bailout."
It's reported previously. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1675540
This bug still exists and looks like it was identified as part of the Nouveau video driver, experienced now with Ubuntu 16.10.


$dmesg indicated that it's when calling cx88_audio_pci_driver_init
  continuously time out due to i2c error.
      - pci_audio_driver loading hang.....
        [   15.080129] i2c i2c-13: sendbytes: error -110
        [   16.287687] ip_tables: (C) 2000-2006 Netfilter Core Team
        [   16.308070] ip6_tables: (C) 2000-2006 Netfilter Core Team
        [  244.171444] INFO: task systemd-udevd:325 blocked for more than 120 seconds.
        [  244.171451]       Not tainted 4.13.0-32-generic #35~16.04.1-Ubuntu
        [  244.171453] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
        [  244.171456] systemd-udevd   D    0   325    278 0x00000004
        [  244.171460] Call Trace:
        [  244.171470]  __schedule+0x3c2/0x890
        [  244.171474]  schedule+0x36/0x80
        [  244.171477]  schedule_preempt_disabled+0xe/0x10
        [  244.171480]  __mutex_lock.isra.2+0x2ae/0x4e0
        [  244.171487]  ? driver_probe_device+0x450/0x450
        [  244.171490]  __mutex_lock_slowpath+0x13/0x20
        [  244.171492]  ? __mutex_lock_slowpath+0x13/0x20
        [  244.171495]  mutex_lock+0x2f/0x40
        [  244.171497]  __driver_attach+0x5d/0xf0
        [  244.171500]  ? driver_probe_device+0x450/0x450
        [  244.171503]  bus_for_each_dev+0x6c/0xc0
        [  244.171506]  driver_attach+0x1e/0x20
        [  244.171508]  bus_add_driver+0x1f4/0x270
        [  244.171512]  ? 0xffffffffc00a6000
        [  244.171515]  driver_register+0x60/0xe0
        [  244.171517]  ? 0xffffffffc00a6000
        [  244.171522]  __pci_register_driver+0x4c/0x50
        [  244.171528]  cx88_audio_pci_driver_init+0x1e/0x1000 [cx88_alsa]       ..............
        [  244.171532]  do_one_initcall+0x53/0x1b0
        [  244.171536]  ? __vunmap+0x81/0xb0
        [  244.171540]  ? kmem_cache_alloc_trace+0x152/0x1b0
        [  244.171543]  ? kfree+0x162/0x170
        [  244.171548]  do_init_module+0x5f/0x209
        [  244.171551]  load_module+0x1961/0x1d60
        [  244.171556]  ? ima_post_read_file+0x7d/0xa0
        [  244.171561]  SYSC_finit_module+0xe5/0x120
        [  244.171564]  ? SYSC_finit_module+0xe5/0x120
        [  244.171568]  SyS_finit_module+0xe/0x10
        [  244.171572]  entry_SYSCALL_64_fastpath+0x33/0xa3
        [  244.171575] RIP: 0033:0x7ff05dcda4d9
        [  244.171576] RSP: 002b:00007ffe319d70c8 EFLAGS: 00000202 ORIG_RAX: 0000000000000139
        [  244.171579] RAX: ffffffffffffffda RBX: 00005627dc1ac890 RCX: 00007ff05dcda4d9
        [  244.171581] RDX: 0000000000000000 RSI: 00005627dc1b8450 RDI: 0000000000000007
        [  244.171583] RBP: 00005627dc1b8450 R08: 0000000000000000 R09: 0000000000000011
        [  244.171584] R10: 0000000000000007 R11: 0000000000000202 R12: 0000000000000000
        [  244.171586] R13: 00005627dc1cec00 R14: 0000000000020000 R15: 0000000000000000

Tried loading old kernel back to 4-Feb. Problem still exist.
        qyang@Ubuntu1604LTS:~$ ll /lib/modules/
        total 24K
        drwxr-xr-x  5 root root 4.0K Jun 20  2017 4.8.0-56-generic/
        drwxr-xr-x 23 root root 4.0K Feb  4 07:36 ../
        drwxr-xr-x  5 root root 4.0K Feb  4 07:40 4.13.0-32-generic/
        drwxr-xr-x  5 root root 4.0K Feb 25 09:50 4.13.0-36-generic/
        drwxr-xr-x  6 root root 4.0K Mar 15 22:19 ./
        drwxr-xr-x  5 root root 4.0K Mar 15 22:48 4.13.0-37-generic/

Check cx88 releated hardware drivers.
        qyang@Ubuntu1604LTS:~$ lsmod |grep cx88
        cx88_alsa              20480  1
        snd_pcm                98304  5 snd_hda_intel,snd_hda_codec,cx88_alsa,snd_hda_core,snd_hda_codec_hdmi
        cx8800                 40960  1
        cx8802                 20480  0
        cx88xx                 90112  3 cx88_alsa,cx8802,cx8800
        videobuf2_dma_sg       16384  1 cx8800
        tveeprom               24576  1 cx88xx
        v4l2_common            16384  3 tuner,cx88xx,cx8800
        videobuf2_v4l2         24576  1 cx8800
        videobuf2_core         40960  4 cx8802,cx88xx,videobuf2_v4l2,cx8800
        videodev              172032  7 tuner,v4l2_common,cx88_alsa,videobuf2_core,cx88xx,videobuf2_v4l2,cx8800
        snd                    81920  22 snd_hda_intel,snd_hwdep,snd_seq,snd_hda_codec,cx88_alsa,snd_timer,snd_rawmidi,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_seq_device,snd_hda_codec_realtek,snd_pcm
        rc_core                36864  4 rc_winfast,ite_cir,cx88xx
        i2c_algo_bit           16384  2 cx88xx,nouveau


--------------------------------------------------
Fix Applied
Ref:
    https://unix.stackexchange.com/questions/28240/disable-detection-of-certain-hardware
--------------------------------------------------
Decided to disable driver load.

      - $touch /etc/modprobe.d/blacklist-cx88-alsa.conf and edit it.
        qyang@Ubuntu1604LTS:~$ cat /etc/modprobe.d/blacklist-cx88_alsa.conf
        blacklist cx88_alsa
        blacklist cx88xx
        blacklist cx8800
        blacklist cx8802
      - Problem solved after reboot.

Saturday, February 24, 2018

installed vlc 2.1.3 via iFunbox for iPad1



ipa file of vlc can be downloaded from http://downloads.videolan.org/videolan/vlc-iOS/2.1.3/

iFunbox can be downloaded from http://www.i-funbox.com/en_download.html


You need to install AppLinks via Cydia in order to see those folders to upload video file directly.

Tuesday, January 2, 2018

Passport photo editing


----

au passport     3.75 x 4.75 cm  3.5-4.0 x 4.5 - 5.0cm
head                3.4 cm(3.2 - 3.6)

----
chinese passport 
head 28-33mm length 21mm-24mm width
2x2 inches

----

original photo:

head 73.75cm
resolution: 28.346  pixels/cm

28.346*73.75/3.4 = 614.858 pixels/cm

head 69.74
resolution: 28.346 pixels/cm
28.346*69.74/3.4 = 581.426 pixesl/cm

----

New Element size:
614.858 pixels/cm      3.75 x 4.75 cm

New Element size:
581.426 pixels/cm      3.75 x 4.75 cm


----

AU Passport 6 elemetes size:
581.426 pixels/cm      4 x 6 inches



Friday, November 24, 2017

Change default boot OS in Ubuntu Grub from Linux to Window


Ref: http://www.linuxandubuntu.com/home/how-to-change-boot-order-set-default-boot-os-in-ubuntu-14-10-15-04-linux-mint-or-other-derivatives

Brief of command line:
1. Find out the entry ID list.
qyang@lubuntu-laptop:~$ grep menuentry /boot/grub/grub.cfg
2. Change the default boot id.
qyang@lubuntu-laptop:~$ sudo vi /etc/default/grub
3. Upgrade grub.cfg via 'update-grub'.
qyang@lubuntu-laptop:~$ sudo update-grub

Details in command line:

qyang@lubuntu-laptop:~$ grep menuentry /boot/grub/grub.cfg
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-73-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-73-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-73-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-73-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-69-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-69-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-69-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-69-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-56-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-56-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-56-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-56-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-51-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-51-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-51-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-51-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-37-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-37-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-37-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-37-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-33-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-33-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-33-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-33-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-32-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-32-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-32-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-32-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-31-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-31-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-31-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-31-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-30-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-30-generic-advanced-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Ubuntu, with Linux 3.19.0-30-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-30-generic-recovery-8acc81f2-51d4-44ec-94ac-ab13858d5855' {
menuentry 'Memory test (memtest86+)' {
menuentry 'Memory test (memtest86+, serial console 115200)' {
menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-7E980FF3980FA8AB' {
menuentry 'Windows 7 (loader) (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-48D0359CD0359164' {
menuentry 'Windows Recovery Environment (loader) (on /dev/sda3)' --class windows --class os $menuentry_id_option 'osprober-chain-4A765B93765B7F1F' {




qyang@lubuntu-laptop:~$ sudo update-grub
[sudo] password for qyang:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.19.0-73-generic
Found initrd image: /boot/initrd.img-3.19.0-73-generic
Found linux image: /boot/vmlinuz-3.19.0-69-generic
Found initrd image: /boot/initrd.img-3.19.0-69-generic
Found linux image: /boot/vmlinuz-3.19.0-56-generic
Found initrd image: /boot/initrd.img-3.19.0-56-generic
Found linux image: /boot/vmlinuz-3.19.0-51-generic
Found initrd image: /boot/initrd.img-3.19.0-51-generic
Found linux image: /boot/vmlinuz-3.19.0-37-generic
Found initrd image: /boot/initrd.img-3.19.0-37-generic
Found linux image: /boot/vmlinuz-3.19.0-33-generic
Found initrd image: /boot/initrd.img-3.19.0-33-generic
Found linux image: /boot/vmlinuz-3.19.0-32-generic
Found initrd image: /boot/initrd.img-3.19.0-32-generic
Found linux image: /boot/vmlinuz-3.19.0-31-generic
Found initrd image: /boot/initrd.img-3.19.0-31-generic
Found linux image: /boot/vmlinuz-3.19.0-30-generic
Found initrd image: /boot/initrd.img-3.19.0-30-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
Found Windows 7 (loader) on /dev/sda2
Found Windows Recovery Environment (loader) on /dev/sda4
done




qyang@lubuntu-laptop:~$ sudo fdisk -l
[sudo] password for qyang:

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1cb42612

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048   3074047   3072000   1.5G 27 Hidden NTFS WinRE
/dev/sda2         3074048 207874047 204800000  97.7G  7 HPFS/NTFS/exFAT
/dev/sda3       207874048 952238079 744364032   355G  5 Extended
/dev/sda4       952238080 976773119  24535040  11.7G 17 Hidden HPFS/NTFS
/dev/sda5       207876096 576516095 368640000 175.8G  7 HPFS/NTFS/exFAT
/dev/sda6       584908800 952238079 367329280 175.2G 83 Linux
/dev/sda7       576518144 584906751   8388608     4G 82 Linux swap / Solaris

Partition table entries are not in disk order.

Friday, August 11, 2017

Batch renaming multiple files in Linux


[1] https://stackoverflow.com/questions/208181/how-to-rename-with-prefix-suffix

using 'rename'
rename 's/(.*)$/new.$1/' original.filename
shell script
for filename in *.jpg; do mv "$filename" "prefix_$filename"; done;
brace expansion
mv {,new.}original.filename


Convert multiple image files into one pdf file using Linux command line.

[1] https://www.imagemagick.org/script/index.php


Convert multiple images into one pdf file under Linux command line.

#apt-get install imagemagick
$convert file1.jpg file2.jpg merge.pdf

Tuesday, June 6, 2017

Set JAVA_HOME in Ubuntu


Ref from 'askubuntu.com'


Three files you could edit, '/etc/environment' is the one prefered in web post:
/etc/environment
/etc/profile
~/.bashrc

But I chose adding file: /etc/profile.d/dnm-build-envsetting.sh

- Reboot pc, and all environments variables settings remains.
        qyang@lgm-pc:~$ cat /etc/environment
        PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
        qyang@lgm-pc:~$ cat /etc/profile.d/dnm-build-envsetting.sh
        # Some environmental variables required for DmM builder to work for android build.
        # 2017-JUN-09
        JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
        ANDROID_HOME=/home/qyang/sandbox/android-sdk-linux
        QTDIR=/home/qyang/sandbox/qt-everywhere-opensource-4.8.7
        export JAVA_HOME
        export ANDROID_HOME
        export QTDIR


My old settings:
yang@lgm-pc:~/testsetupscript$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
qyang@lgm-pc:~/testsetupscript$ cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

JAVA_HOME=/usr/local/java/jdk1.8.0_25
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH