Sunday, 12 January 2014

Some notes on installing apps in gentoo x86_64

This post lists all the problems I have encountered during updating gentoo using #--------------update the system weekly----------------------------
# emerge -auDvN  --keep-going world 
#---------------problem in installing evince----------------------------
# emerge -av evince 
configure: error: "PDF support is disabled since poppler-glib library version 0.20.0 or newer not found" solve:
# emerge -av poppler 
#---------------problem in installing net-libs/gupnp-igd-0.2.1----------------------------
* ERROR: net-libs/gupnp-igd-0.2.1::gentoo failed (compile phase):
 *   emake failed
test.c: In function 'main':
test.c:66:3: warning: 'g_type_init' is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:669) [-Wdeprecated-declarations]
test.c:67:3: warning: 'g_thread_init' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Wdeprecated-declarations]
  CCLD     test
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: test.o: undefined reference to symbol 'g_type_init'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: note: 'g_type_init' is defined in DSO /usr/lib64/libgobject-2.0.so.0 so try adding it to the linker command line
/usr/lib64/libgobject-2.0.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[3]: *** [test] Error 1
make[3]: Leaving directory `/var/tmp/portage/net-libs/gupnp-igd-0.2.1/work/gupnp-igd-0.2.1/tests/examples'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/var/tmp/portage/net-libs/gupnp-igd-0.2.1/work/gupnp-igd-0.2.1/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/net-libs/gupnp-igd-0.2.1/work/gupnp-igd-0.2.1'
make: *** [all] Error 2
emake failed
 * ERROR: net-libs/gupnp-igd-0.2.1::gentoo failed (compile phase):
 *   emake failed

Solve:

add the follow line in /etc/portage/package.keywords/net-libs

>=net-libs/gupnp-igd-0.2.2-r1

solved #-------------- install systemd on gentoo and use Grub 2 to boot it -------- there are two important information that one needs to follow: [1]: How to set new manuentry? [2]: How to add a new vmlinuz in folder /boot/ Here are successful example of menuentries in /boot/grub/grub.cfg
one can write these to /boot/grub/grub.cfg


menuentry 'Gentoo write by myself' {
        root=hd0,2
        linux /boot/vmlinuz-3.10.7-gentoo root=/dev/sda2 init=/usr/lib/systemd/systemd
}

menuentry 'Gentoo write by myself UUID' --class gnu-linux --class gnu {
        root=hd0,2
        linux /boot/vmlinuz-3.10.7-gentoo root=UUID=671f9d17-5de7-4fe7-a6bf-f1096f4efe29 init=/usr/lib/systemd/systemd
}

 ------- The problem on the networkmanager after updated to systemd and gnome 3 ----------------- 
The networkmanager in gentoo installed at my laptop and desktop failed to work after updating to systemd and gnome3. To find out the problem, I use:
systemctl status NetworkManager
 
which says:
The overwriting error message was: Could not load plugin 'ifnet': /usr/lib64/NetworkManager/libnm-settings-plugin-ifnet.so: cannot open shared object file: No such file or directory 
To resolve this problem, one needs to delete ifnet in the file /etc/NetworkManager/NetworkManager.conf
[main]
#plugins=ifnet,keyfile
plugins=keyfile
no-auto-default=00:26:6C:09:9F:1C,

[ifnet]
managed=true
auto_refresh=false
There is one thing to be reminded: alternatively, one can use wicd as a temporary resolution. However, I found the wicd is quite unstable in my gentoo system than that in Ubuntu. #------ Important note on updating kernels ----------------- I had one bad experience in updating kernel of my PC. after new kernel is selectecd, the module that has been selected has been gone completely! This means that I have to look for every module selected in the kernel! To avoid this problem happen again, One should backup file /usr/src/linux/.config before any updates on kernels!
Problem:
[ebuild   R    ] app-text/docbook-sgml-utils-0.6.14-r1  USE="jadetex" 0 kB
emake error
emerge =docbook-sgml-dtd-3.1* 
emerge -u docbook-sgml-utils

Problem:
media-sound/cdparanoia-3.10.2-r6
solution:
echo "=media-sound/cdparanoia-3.10.2-r6 -static-libs" >> /etc/portage/package.use/media-sound


Problem:
sci-libs/scotch-6.0.0:0/6 fail to install 
Solution: to enable all the flags.
echo ">=sci-libs/scotch-6.0.0:0/6 mpi doc int64 static-libs threads tools" >> /etc/portage/package.use/sci-libs


Problem:
app-i18n/fcitx-4.2.7  USE="X autostart cairo dbus enchant gtk gtk3 icu introspection nls pango qt4 static-libs table xml -debug -lua -opencc -snooper {-test}" 0 kB
Solution: enabling all the falgs
echo ">=app-i18n/fcitx-4.2.7 lua opencc snooper" >> /etc/portage/package.use/app-il8n



Problem: Displaying Chinese properly without Desktop manager:
1. # emerge -av arphicfonts wqy-bitmapfont  corefonts ttf-bitstream-vera
2. # gedit /etc/locale.gen
en_US ISO-8859-1
en_US.UTF-8 UTF-8
zh_CN GB18030
zh_CN.GBK GBK
zh_CN.GB2312 GB2312
zh_CN.UTF-8 UTF-8

3. locale-gen && env-update && source /etc/profile


Monday, 16 September 2013

automount drivers on gentoo using i3wm

it is very annoying when simple wm doesn't provide any auto mount module, one has to find a way to mount usb drivers and mobile harddisks. it is even harder when there is a ntfs partitions.

In this page, we basically solve two problems:
1. How to let gentoo recognize ntfs partition?
2. How to auto mount usb and mobile hard disks?
For the first question, there are two steps:

step 1:
let kernel support fuse:
enable File Systems->Fuse (file system in userpsace), make it as module



step 2:
install ntfs3g
# emerge -a ntfs3g


For the second question, edit the following in /etc/fstab
/dev/sda1   /boot     ext4    noauto,noatime     1 2
/dev/sda2   /         ext4    noatime            0 1
/dev/sda7   none      swap    sw                 0 0
/dev/sda6   /home     ext4    defaults        0       2

# for sandisk usb driver noauto means it will not be mounted automatically, which is to avoid error if it is not mounted 
/dev/sdc1 /mnt/sandisk auto noauto,users,noatime,umask=0 0 0

# for mobile hard disk 
UUID="333c9d2f-1c2a-482e-83f7-616fa45a478a" /mnt/MobiC ext4 auto,rw,users,exec,nofail 0 0
UUID="D0CC0864CC0846E6"   /mnt/MobiD  ntfs-3g rw,suid,dev,exec,async,auto,users,nofail  0 0 

# for scientific linux
/dev/sda8 /home/chenming/SL ext4 rw,users,exec 0 0
# for Lubuntu
/dev/sda10 /home/chenming/Lubuntu ext4 rw,users,exec 0 0
# for slackware
/dev/sda5 /home/chenming/Slackware ext4 rw,users,exec 0 0
# the local ntfs driver
/dev/sda9 /home/chenming/ntfs      ntfs-3g defaults   0 0

sda2, sda7, sda6 are all for systems, sda8,sda10,sda5,sda9 are local disks. notice the difference between ntfs and ext4.
the two uuid ones are the mobile harddisk. note that both has been added noauto options, it is set to avoid mount on boot. when mobile hard disk is not present, booting the system with automount on will cause error. also by this way one can "partially" auto mount by click icons at nautilus.
the disadivantage for this method is that it can not automount ntfs driver, so at the moment after the device is inserted one has to run the following by root:
# mount  UUID="D0CC0864CC0846E6"
hope we can find better way to make the whole process automatically.
more info:
auto,nofail-- it means it will be automatically mount on boot. however, if it is not present on boot, error will not appear.
useful tools here:
command blkid is very good to find out all of the uuids:
mybox linux # blkid
/dev/sda1: UUID="1ed58cd8-d54c-4191-86b5-2b967298d3c2" TYPE="ext4" 
/dev/sda2: UUID="671f9d17-5de7-4fe7-a6bf-f1096f4efe29" TYPE="ext4" 
/dev/sda5: UUID="c8216a5e-3d03-491e-94a0-c19c25bdeee7" TYPE="ext4" 
/dev/sda6: UUID="90b2869f-0d85-43ea-af05-b2833ded28ff" TYPE="ext4" 
/dev/sda7: UUID="f660c6ea-ac34-4d1f-8945-e800adae05aa" TYPE="swap" 
/dev/sda8: UUID="1e45a116-4e39-4a0f-8c67-48fe0c3c2ec0" TYPE="ext4" PTTYPE="dos" 
/dev/sda9: UUID="075E30C271C193B7" TYPE="ntfs" 
/dev/sda10: UUID="692659d8-84d1-4de4-b530-5d97d302e353" TYPE="ext4" 
/dev/sr0: UUID="2012-02-03-16-05-05-00" LABEL=""SL 6.2 x86_64 DVD"" TYPE="iso9660"

gentoo: install ethernet card driver

after installing gentoo, i found it automatically recognize my ethernet card, but the driver is not properly installed (the module is loaded in default)
mybox Desktop # lspci -k
02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)
        Subsystem: Realtek Semiconductor Co., Ltd. Device 8182
        Kernel driver in use: rtl8192ce
        Kernel modules: rtl8192ce
06:00.0 Ethernet controller: Qualcomm Atheros AR8152 v2.0 Fast Ethernet (rev c1)
        Subsystem: Toshiba America Info Systems Device ff1e
note there is no modules list on the AR8152.
apparently the kernel should provide the driver for Ethernet card, so I should not try to look for drivers. from ubuntu, i found the module is called atl1c. then I tried to find it in the kernel menuconfig:
# cd /etc/usr/linux
# make menuconfig

then i found it at Device Drivers -> Network device support -> Ethernet driver support -> Atheros device (simplely choose all of them)
now remake the kernel module , install and load the module:
# make modules_install
# modeprobe atl1c

enjoy!

change mac address for ubuntu and gentoo

first one has to check the situation of network:
# ifconfig
this gives:
mybox Desktop # ifconfig
enp6s0: flags=4163  mtu 1500
        inet 10.33.21.70  netmask 255.255.252.0  broadcast 10.33.23.255
        inet6 fe80::222:19ff:fe2e:603f  prefixlen 64  scopeid 0x20
        ether 00:22:19:2e:60:3f  txqueuelen 1000  (Ethernet)
        RX packets 13223  bytes 6462275 (6.1 MiB)
        RX errors 0  dropped 18  overruns 0  frame 0
        TX packets 6147  bytes 1062544 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 1  collisions 0

lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 0  (Local Loopback)
        RX packets 600  bytes 48840 (47.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 600  bytes 48840 (47.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp2s0: flags=4099  mtu 1500
        inet6 fe80::e2ca:94ff:fedb:57ac  prefixlen 64  scopeid 0x20
        ether e0:ca:94:db:57:ac  txqueuelen 1000  (Ethernet)
        RX packets 457  bytes 532967 (520.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 257  bytes 42551 (41.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
note that here enp6s0 is wired card and wlp2s0 is wireless, which is different from eth0 and wlan0 in some distributions (e.g., slackware ubuntu debian lubuntu, scientific linux) also note that the name of the mac is called ether rather than HWaddr
therefore, one can do:
ifconfig enp6s0 down
ifconfig enp6s0 hw ether  00:22:19:2E:60:3F
ifconfig enp6s0 up

now you have the new mac address working on your enternet. for other distributions, one may need to change enp6s0 into eth0, and ether into HWaddr. enjoy!

gentoo kernel 3.10.7: How to install camera on toshiba laptop

the really sad part of installing camera driver in linux is that one can not find anything from commands lsmod, lspci (this requires usbtencil). So the way for me to find out what module is required by camera is to run:
lsmod
on a system that drivers are installed. Alternatively, one can use windows and run devmgmt.msc to find out the models.
from the output, the module shows:
videobuf2_vmalloc       2864  1 uvcvideo
videobuf2_core         26953  1 uvcvideo
videodev              105533  2 uvcvideo,videobuf2_core
media                  10308  2 uvcvideo,videodev
so we try to find uvcvideo module in kenel config.
However, different from info given by forums, the new menuconfig can not find anything about uvc video. therefore, I decided to find out from .config file
#
# Media drivers
#
CONFIG_MEDIA_USB_SUPPORT=y

#
# Webcam devices
#
CONFIG_USB_VIDEO_CLASS=m
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
CONFIG_USB_GSPCA=m
This is equivalent to menuconfig Device Drivers->Multimedia support->Cameras/video grabbers support&V4L platform device
then I am able to get the camera by running:
# modprobe uvcvideo
and further run by boot:
# echo "modules=\"uvcvideo\"">>/etc/conf.d/modules
The above mentioned method works very well for my toshiba laptop, but there is some problem on my logitech C160, as this device contains microphones as well. so we need to add that in. first menuconfig:
# make menuconfig
Device Drivers ->
  sound car support ->
    Advanced linux sound architecture ->
      USB sound devices
      [M]  USB Audio/Midi driver
then one needs to do
# make 
# make modules_install
# modprobe snd_usb_audio
# echo "modules=\"snd_usb_audio\"">>/etc/conf.d/modules
now you can select microphone in skype or check the presence of the card by
# cat /proc/asound/cards
some more information: if one can not find the vendor of the product, one can first find out the device id. for example
# lsusb 
Bus 001 Device 004: ID 046d:0824 Logitech, Inc. 
the information "046d:0824" contains vendor and model of the device, if you search on website, it is logitech webcam c160

Sunday, 15 September 2013

auto backup local file in folder using crontab and rsync

it is really fast working at local hard disk. but the disadvantage is that it is not backuped. so a better way would be working at local hard disk that are automatically backed up as schedule.
two problems here.
1. how to make a schedule
2. how to sync with two folders.

slolution to problem 1:

using command

$ crontab

two useful parameters:

$ crontab -e

after executing this, a text editor pops out, which is the place one lodge a schedule, the format is like this (one can use # to comment out unnecessary schedules )


Code:
* * * * * /path/to/the/bash/script

the first star means minutes, it can be 0 to 59 or *. if it is star (*), it means every minute
the second star means hour, it can be 0 to 23 or *. if it is star (*), it means every hour
the third star means day of the month, it can be 0 to 31 or start*. if it is star (*), it means every day
the fourth star means month of the year, it can be 1 to 12. if it is star (*), it means every month
the fifth star means day of the week. if it is star (*), it means every day.

my final script after executing crontab -e is:
0 18 * * * /home/chenming/Hdrive/backup6.4

which means run backup6.4 at 18:00 of each day.

one needs to make sure that backup6.4 is a executable file (chmod +x backup6.4)

some other useful commands:

$ crontab -l

list schedules 

I usually use the following one to test:

schedule:
* * * * * /home/chenming/Hdrive/backup6.4

commands:
#!/bin/bash
echo $(date)>>/home/chenming/test

which writes date and time in one file per minute.




solution to problem 2:

use command rsync. put the following line in /home/chenming/Hdrive/backup6.4

rsync -a --progress --human-readable --states --update /path/to/folder/needs/to/be/synced --delete /path/to/folder/backup/file/stores/
here --progress shows the results (not useful as a schedule, though)
       --stats vobose mode
       --update skip files that are newer on the receiver (this is not useful if one doesn't change anything in receiver)
       --delete delete  extraneous files from dest dirs

Notes for systemd user:

you need to make sure that the service dcron is enabled:
 systemctl status dcron
systemctl is-enabled dcron
To enable it, you can do:
systemctl enable dcron

Tuesday, 10 September 2013

give privilege to normal user to use nm-applet in gentoo

after installed networkmanager, i found as a normal user, one can not make any modifications and connections with prompt "insufficient privileges"

oh... it can not be done at the moment. i get my hand very dirty..

New update on this thread:
one can startx by root, set everything well on networkmanager. then logout and back in again as normal user. as a normal user, one can connect and disconnect availabe hotspots, but can not add new ones.