Tampilkan postingan dengan label Arch Linux. Tampilkan semua postingan
Tampilkan postingan dengan label Arch Linux. Tampilkan semua postingan

Maret 30, 2016

Arch Linux, Mplayer, and Chromium Sound Problem

This post is just a reminder whenever one day I get the same problem: no sound in browser (in this case: Chromium) while the sound is normal using mplayer (or any other command line player). Some configurations:

$HOME/.asoundrc
# Use PulseAudio by default
pcm.!default {
  type pulse
  fallback "sysdefault"
  hint {
    show on
    description "Default ALSA Output (currently PulseAudio Sound Server)"
  }
}
ctl.!default {
  type pulse
  fallback "sysdefault"
}
/etc/mplayer/mplayer.conf
ao=pulse
/etc/pulse/default.pa
.ifexists module-udev-detect.so
load-module module-udev-detect tsched=0
.else
load-module module-detect
.endif
Restart pulseaudio:
pulseaudio -k
pulseaudio --start
Restart browser. There you go. Enjoy the sound!

Februari 20, 2016

Multiple Go versions in Linux

Currently, there are trends on software development that tend to release their SDK on regular basis. Rust for example, also Go with 6 month release cycle. This predictable release is good and I personally like it since I can predict on features availability and use them for my software development project. The downside of this approach is there are many versions availablle that install them using OS package manager is proved to be pain in the ass.

Some of developers then create tools to manage multiple versions of the SDK, see GVM (Go Version Manager) and multirust (for Rust) for example. They are good of course but I probably choose not to use them since probably someday they won't be developed (see the latest commit if you want). My approach is simpler but only for Linux with Bash. If you use Windows, you may adopt my approach using SET to setup env variables and put them in batch file (.BAT). Explanation follows.

Directory Setup

I put all of my Go related software inside /opt/software/go-dev-tools. Here's the structure:


Directory Contents

I put Go SDK inside go, all Go related tools inside go-tools, liteide for LiteIDE, and tmp for temporary pkg dir whenever I want to compile and put Go tools inside go-tools.

Inside go-version (go1.2.2, go1.3.3, etc), I extract all of downloaded SDK from Go download page.

Environment Variables

In my $HOME/env dir, I created go directory to manage environment variables for my Go version. They usually have the same env variables, except for version pre 1.5, 1.5 (for vendor experimentation) and  1.6.

Pre 1.5 and > 1.6

$ cat ~/env/go/go1.2.2
GODEVTOOLS_HOME=/opt/software/go-dev-tools

GO_HOME=$GODEVTOOLS_HOME/go/go1.2.2
LITEIDE_HOME=$GODEVTOOLS_HOME/liteide
GOTOOLS=$GODEVTOOLS_HOME/go-tools

export GOROOT=$GO_HOME
export GOOS=linux
export GOARCH=amd64
export GOHOSTOS=linux
export GOHOSTARCH=amd64
export GOBIN=$GOROOT/bin

export PATH=$PATH:$GO_HOME/bin:$LITEIDE_HOME/bin:$GOTOOLS

alias go=colorgo$

1.5

$ cat ~/env/go/go1.5.3
GODEVTOOLS_HOME=/opt/software/go-dev-tools

GO_HOME=$GODEVTOOLS_HOME/go/go1.5.3
LITEIDE_HOME=$GODEVTOOLS_HOME/liteide
GOTOOLS=$GODEVTOOLS_HOME/go-tools

export GOROOT=$GO_HOME
export GOOS=linux
export GOARCH=amd64
export GOHOSTOS=linux
export GOHOSTARCH=amd64
export GOBIN=$GOROOT/bin

export PATH=$PATH:$GO_HOME/bin:$LITEIDE_HOME/bin:$GOTOOLS

alias go=colorgo

export GO15VENDOREXPERIMENT=1
$

Usage 
Open new shell - terminal, and source environment variables:

$ source env/go/go1.2.2
11:25:22-bpdp@archer:~$ go version
go version go1.2.2 linux/amd64
11:25:25-bpdp@archer:~$

Open another new shell - terminal, and source env vars:

$ source env/go/go1.6.0
11:25:59-bpdp@archer:~$ go version
go version go1.6 linux/amd64
11:26:01-bpdp@archer:~$

and so on.

Go Tools

When you see something interesting for your Go project, just go to /opt/software/go-dev-tools/tmp and the Go get them and copy the files inside /opt/software/go-dev-tools/go-tools:

$ cd /opt/software/go-dev-tools/tmp/
$ export GOPATH=`pwd`
$ go get github.com/smartystreets/goconvey
$ mv ../go/go1.6/bin/goconvey ../go-tools/
$ which goconvey
/opt/software/go-dev-tools/go-tools/goconvey
$

I don't know whether my approach is the best, but it proves to be comfortable for me. As always, YMMV. Happy hacking!












Desember 04, 2015

Swift in Arch Linux

Following its open source release, Swift can be downloaded at http://www.swift.org. I am lucky enough to see that there is Linux version available for download. The binary version was developed in Ubuntu, so I tried to grab the binary release and then have them installed to no luck. It was some problems with some libraries: libpanel (from ncurses5), libedit.so.2 and libicuuc. Being a bleeding edge distro does mean that I may not be able to run binary files from older libs in my Arch box. That was the case with Swift, it was compiled under Ubuntuwith older libs.

Here's what I did to make Swift able to run without recompiling in Arch Linux:
  1. Whenever Swift complain about no libs available, go to rpmfind.net and then find one. Here's an example: http://www.rpmfind.net/linux/RPM/mageia/cauldron/x86_64/media/core/release/lib64ncurses5-5.9-24.mga6.x86_64.html. Get the rpm, rpmextract.sh rpmfile, the put all of the files inside, let's say $HOME/lib/swift
  2. Exception for libedit, just make a symlink from /usr/lib/libedit.so to libedit.so.2 (this should be done inside $HOME/lib/swift.
  3. Create a file, mine is $HOME/env/swift:
export PATH=$PATH:/opt/software/swift/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib/swift
 That's all. Now, just "source ~/env/swift" to use Swift.




Mei 03, 2015

I was once the maintainer of ArangoDB package in AUR. While the package was fine (I think), I am quite tired of having it compiled myself. It's just I am getting older, I guess. Then I prefer binary version after leaving maintainer role. Now I can use it using RPM file of OpenSuSE Factory version - available from ArangoDB download page. Some tweaks are needed anyway. I will give you some tweaks that I successfully use to make it works. In this post, I put all of installation files under /home/bpdp/software/arangodb (a.k.a $ARANGO_HOME).

  • cd $ARANGO_HOME
  • Install rpmextract package: # pacman -S rpmextract
  • Extract RPM file: $ rmpextract.sh path/to/arangodb-2.5.3-12.1.i586.rpm
  • Move conf files into etc: $ mv etc/arangodb/*.conf etc/
  • Delete init.d dir (we don't need that): $ rm -rf etc/int.d
  • All database will reside in db, so: $ mkdir db
  • Here's the dir structure:

$ ls
total 48
drwxr-xr-x  9 bpdp bpdp  4096 May  4 10:31 .
drwxr-xr-x 91 bpdp bpdp  4096 May  4 10:16 ..
drwxr-xr-x  2 bpdp bpdp  4096 May  4 10:12 bin
drwxr-xr-x  2 bpdp bpdp  4096 May  4 10:19 db
drwxr-xr-x  2 bpdp bpdp  4096 May  4 10:30 etc
drwxr-xr-x  4 bpdp bpdp  4096 May  4 10:12 lib
drwxr-xr-x  2 bpdp bpdp  4096 May  4 10:12 sbin
drwxr-xr-x  5 bpdp bpdp  4096 May  4 10:12 share
drwxr-xr-x  4 bpdp bpdp  4096 May  4 10:12 var
$

  • Create all needed dirs: cluster and mri (ruby): $ mkdir -p share/arangodb/mr/client/modules; mkdir -p shar/arangodb/mr/common/modules.
  • $ mkdir -p var/log/arangodb/cluster; mkdir -p lib/arangodb/cluster
  • Edit etc/*.conf to reflect all of those dir location.
  • Delete unneeded dirs/files: $ rm -rf lib/systemd/; rm -rf etc/init.d/; rm -rf sbin/rcarango.
  • Set PATH and MANPATH. You may put this inside $HOME/.bashrc:

export ARANGO_HOME=$HOME/software/arangodb
export PATH=$PATH:$ARANGO_HOME/bin:$ARANGO_HOME/sbin
export MANPATH=$MANPATH:$ARANGO_HOME/share/man
Installation finish. You should source .bashrc or open another terminal and then you may active the server daemon and / or arango shell:

  • Activate arango daemon: $ arangod -c ~/software/arangodb/etc/arangod.conf
  • Enter arango shell: $ arangosh -c ~/software/arangodb/etc/arangosh.conf
That's all I guess, you may now use ArangoDB. 


Uf wiederluege! Na shledanou! Auf Wiedersehen! Bye Bye! Adiau! ¡Hasta luego! Au revoir!
Arrivederci! להתראות! Tot ziens! Adjö! Εις το επανιδείν! さようなら До свидания!

April 26, 2015

Atom for 32bit Arch Linux (or other Linux 32bit distros)

Actually, there's a package in AUR (https://aur.archlinux.org/packages/atom-editor/) but I am too lazy to compile it myself, so here it goes.

Atom is available in binary releases for 64bit only for Linux. Luckily, WebUpd8 team provides binary packages for 64bit and 32bit Ubuntu. Get the package here: https://launchpad.net/~webupd8team/+archive/ubuntu/atom/+packages. For this article, I downloaded 32bit binary for Vivid. We will convert this file using deb2targz utility. You should get it first. If you are in Arch Linux, get from AUR (yaourt -S deb2targz), if you are not from Arch fame (:p) get it here: http://www.miketaylor.org.uk/tech/deb/deb2targz. The .deb file that was just downloaded:

-rw-r-----   1 bpdp bpdp 49547144 Apr 26 17:16 atom_0.194.0-1-webupd8-1_i386.deb

Put it somewhere wherever you like. Once you get deb2targz working, follow these steps:
  1. Convert .deb to tar.xz: $ deb2targz atom_0.194.0-1-webupd8-1_i386.deb
  2. Extract .xz file: $ tar -zvf atom_0.194.0-1-webupd8-1_i386.tar.xz. You will have two dirs: usr and opt. In opt dir, extract file atom/atom-linux32.tar.xz: $  tar -xvf atom-linux32.tar.xz.
  3. Put those two dirs inside whatever dir you like, mine is /home/bpdp/software/atom. We call this $ATOM_DIR (not necessarily exist, just for this article only).
  4. This .deb package search atom binary at /tmp/atom-build/atom, which is surely doesn't exist. To make it works, we should edit usr/bin/atom file. Find the line which says [ -x "$ATOM_PATH" ] || ATOM_PATH="/tmp/atom-build/atom" and change it to [ -x "$ATOM_PATH" ] || ATOM_PATH="/home/bpdp/software/atom/opt/atom/atom" (well of course you should put your own location of atom binary (mine is /home/bpdp/software/atom/opt/atom/atom).
  5. Now you should be able to run atom from $ATOM_DIR/usr/bin: $ ./atom. If you want, you may also put that dir in your PATH env variable: export PATH=$PATH:/home/bpdp/software/atom/usr/bin inside $HOME/.bashrc.

April 08, 2013

Wifi Configuration for Lenovo G480 on Arch Linux

This tip probably trivial, but if you have problems in wifi connection to WAP (Wireless Access Point) using Lenovo G480 laptop, then probably this tip should make your laptop sane. Note that wifi configuration has been successfully identified at install time and modules perfectly loaded without user intervention using brcmsmac and its dependencies. The problem is on the result of this driver. In my laptop, I found that wifi connection is very unstable.

I went to Arch Linux wiki and AUR (as always), then checked the https://wiki.archlinux.org/index.php/Broadcom_wireless page, then I realized that this unstable connection problem came from the driver. So I tried broadcom-wl driver from AUR. Just do this:

# yaourt -S broadcom-wl

and wifi connection work very stable after the next reboot without configuration. This package put a configuration file at /etc/modprobe.d/broadcom-wl.conf. It consists of:

$ cat /etc/modprobe.d/broadcom-wl.conf 
blacklist b43
blacklist bcma
blacklist ssb
$

Note: If you don't use Arch Linux, grab the driver and compile it for your own distribution: http://www.broadcom.com/support/802.11/linux_sta.php

Maret 11, 2013

Instalasi Arch Linux 2013.03.01 - Lebih Tidak Ramah dari Sebelumnya

Saat tadi menginstall Arch Linux menggunakan image tanggal 1 Maret 2013 (Arch 2013.03.01), saya cukup terkejut dengan "kemajuan" dari distro ini. Dulu pertama saya install distro ini (saya lupa tahunnya, sudah lama), masih relatif ramah dengan menu mode teks. Jika dulu ada menu dan antarmuka teks yang menuntun ke instalasi sistem Arch, saat saya mencoba kemarin, semua menu ini hilang. Semua digantikan dengan instruksi minimal dari Wiki dalam bentuk file install.txt di $ROOT_HOME/ (/root). Surprise!

Petunjuk instalasi minimal dan pada beberapa hal kurang jelas. Sangat disarankan untuk ada komputer lain yg terkoneksi ke Internet. Selain itu, bersiaplah menghadapi kekacauan. Instalasi disini saya laksanakan di Lenovo G480 dengan image iso Arch Linux dual (32 bit dan x86_64) 2013.03.01 dengan koneksi TelkomSpeedy. Langkah-langkah ini saya ambil dari petunjuk instalasi, tetapi dengan beberapa penjelasan yang lebih jelas supaya tidak terjadi kesalahan.

  • Download image .iso dari https://www.archlinux.org/download/ - saya menggunakan image dual 2013.03.01 - besarnya sekitar 500an MB.
  • Burn image tersebut kedalam CD/DVD
  • Disable UEFI dari setting BIOS (dilakukan sebelum masuk ke OS, di Lenovo G48 dilakukan dengan menekan F2)
  • Konfigurasikan di setup BIOS untuk booting dari DVD/CD.
  • Setelah booting, anda akan dihadapkan pada prompt superuser setelah otomatis login. 
  • Atur partisi lebih dulu: "# cfdisk /dev/sda", setelah itu buat partisi-partisi yang anda inginkan. Untuk kasus saya, hanya saya buat 495 GB dalam 1 partisi (/dev/sda1) serta 5 GB untuk swap.
  • Buat filesystem di partisi /dev/sda1: "# mkfs.ext4 /dev/sda1"
  • Mount partisi baru tersebut. Partisi tersebut akan kita gunakan untuk base system dari Arch Linux:  "mount /dev/sda2 /mnt".
  • Ethernet card tidak terdeteksi, tetapi WLAN0 langsung terdeteksi dan aktif, jadi tinggal kita setup saja. Pada posisi ini, kita masih berada pada mode booting CD. Pada file /etc/wpa_supplicant/wpa_supplicant.conf - isikan berikut ini (lainnya di buat sebagai baris komentar, depan diletakkan #)
network={
ssid="nama ESSID"
psk="password"
priority=1
}
  • Aktifkan WLAN0:
wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf &
  • Karena DHCP sudah aktif, biasanya sudah akan bisa terkoneksi. Jika belum, matikan service DHCP:  "# systemctl stop dhcpcd.service". Setelah itu aktifkan DHCP menggunakan: "# dhcpcd wlan0".
  • Bootstrap base system: "# pacstrap /mnt base base-devel"
  • Install GRUB2: "# arch-root /mnt  -S base base-devel"
  • Install syslinux: "# arch-root /mnt -S syslinux"
  • Buat fstab (saya tambahkan untuk UUID / -U):
# genfstab -p -U  /mnt >> /mnt/etc/fstab

  • # arch-chroot /mnt
  • pacman -S elinks vim mc wpa_supplicant net-tools
  • Ikuti "Installation Guide", pada bagian "Configure the booloader: refer back to the appropriate article from the bootloader installation section", konfigurasi GRUB2 dengan cara menjalankan perintah2 berikut ini: (1) gtub-mkconfig (2) grub-install.
  • Set password untuk root: # passwd
  • Tekan Ctrl-D untuk keluar dari chroot.
  • umount /mnt
  • reboot
Berikutnya, anda tinggal mengikuti berbagai dokumentasi di wiki Arch Linux untuk instalasi software-software tambahan.





Agustus 23, 2012

Arch Linux Package for ArangoDB

Finally I can finish ArangoDB package PKGBUILD for Arch Linux. The people at triAGENS are helpful. Have to say thank you for their help, especially @steemann, @loremsqlsum, and @fceller. The package can be installed just by using yaourt -S arangodb.

The package PKGBUILD can be downloaded from https://aur.archlinux.org/packages.php?ID=62227



Enjoy!

Agustus 21, 2012

Change Python Interpreter Temporary (python3 -> python2)

I came across this difficulty when I try to install ArangoDB. It comes with V8 Javascript engine from Google bundled in. Installing V8 requires Python 2, not Python 3 which is the default in my Arch Linux box.

[bpdp@bpdp-arch V8]$ ls `which python`
lrwxrwxrwx 1 root root 7 Apr 24 06:48 /usr/bin/python -> python3
[bpdp@bpdp-arch V8]$

Luckily, V8 uses "#/usr/bin/env python", not "#/usr/bin/python". To change this behaviour, all I have to do is just ask "env" to use my python2 interpreter. Here's how:

1. Create symlink to python2 under the name "python"
I put the symlink into my "$HOME/bin" directory.
$ cd ~/bin
$ ln -s /usr/bin/python2 python

2. Put into PATH

$ export PATH=~/bin:$PATH

"~/bin" should preced $PATH because env use the first setting.

[bpdp@bpdp-arch arangodb]$ which python
/home/bpdp/bin/python
[bpdp@bpdp-arch arangodb]$ env python
Python 2.7.3 (default, Apr 24 2012, 00:06:13) 
[GCC 4.7.0 20120414 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

There you go!

Agustus 16, 2012

NodeJS Installation Without OS Package Management

I use Arch Linux for all my OS activities. Arch Linux has NodeJS package and can be easily installed using pacman -S nodejs but you may see that NodeJS has fast release cycle that my Arch Linux package is sometimes left behind and also sometimes I want to use a specific version (for example, Ace - and editor part of Cloud9 IDE - can not work with NodeJS 0.8.x, it needs 0.6.x). Under this scheme, it can be difficult to deal with OS package management. That said, I need to use my own way to resolve this.

So, here is the way to solve the problem. Download the binary version of NodeJS or directly go to http://nodejs.org/dist/ and get the one you need. Extract into specific directory then setup some environment variables into .bashrc so that it will be read automatically whenever I login, or put that into a file and source it whenever I need it. That's all. The details will follow if you are really helpless.

1. Download the binary version. Here I use version 0.8.7:

[bpdp@bpdp-arch nodejs]$ ls -la
total 4320
drwxr-xr-x  2 bpdp users    4096 Aug 17 06:08 .
drwxr-xr-x 22 bpdp users    4096 Aug 16 16:17 ..
-rw-r--r--  1 bpdp users 4401729 Aug 16 06:19 node-v0.8.7-linux-x86.tar.gz
[bpdp@bpdp-arch nodejs]$ 

2. Extract into the directory of your own choice:

[bpdp@bpdp-arch software]$ tar -xzvf ~/master/nodejs/node-v0.8.7-linux-x86.tar.gz
[bpdp@bpdp-arch software]$ ln -s node-v0.8.7-linux-x86 nodejs
[bpdp@bpdp-arch software]$ ls -la
....
....
drwxr-xr-x   6 bpdp users  4096 Aug 16 06:18 node-v0.8.7-linux-x86
lrwxrwxrwx   1 bpdp users    21 Aug 17 06:37 nodejs -> node-v0.8.7-linux-x86
....
....
[bpdp@bpdp-arch software]$ 

3. Set some environment variables

[bpdp@bpdp-arch environment]$ cat nodejs 
NODEJS_HOME=/home/bpdp/software/nodejs

PATH=$PATH:$NODEJS_HOME/bin
MANPATH=$MANPATH:$NODEJS_HOME/share/man
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NODEJS_HOME/lib
C_INCLUDE_PATH=$C_INCLUDE_PATH:$NODEJS_HOME/include
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:$NODEJS_HOME/include

export PATH
export MANPATH
export LD_LIBRARY_PATH
export C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH
[bpdp@bpdp-arch environment]$ 

4. Source it whenever you need it:

$ source ~/environment/nodejs

Note: I put the env var into a file: $HOME/environment/nodejs

5. Surely you may also put that into your $HOME/.bashrc for automatic activation.

That's all. Happy coding!

September 01, 2010

Masalah upgrade Ruby di Arch Linux

Untuk rekan-rekan yang menggunakan Arch Linux, proses update dan upgrade Ruby dari versi 1.9.1 (atau 1.8.7 juga ya?) ke versi berikutnya (1.9.2) mungkin bisa melihat ada masalah. Mulai dari instalasi yang gagal karena menumpuki file-file lama di /usr/share/ri dan /usr/lib/ruby, sampai dengan gem yang jika dijalankan malah memunculkan error.

Saya belum melihat ke bug yang di-report, tapi langsung saya mencoba otak atik. Untuk instalasi saja sebenarnya bisa selesai dengan menyertakan --force:

# pacman -S --force ruby

Sayangnya, ini akan menimbulkan kekacauan saat menjalankan 'gem'. Jika mengalami masalah ini, silahkan uninstall ruby, hapus direktori /usr/lib/ruby dan /usr/share/ri. Setelah itu, baru install ruby yang baru.

Catatan: Upgrade ke 1.9.2 perlu dilakukan jika kita ingin menggunakan Rails 3.0.

Selamat mencoba.

Mei 25, 2010

Konfigurasi EV-DO Smart di Chakra (Phoix) / Arch Linux

Chakra (http://www.chakra-project.org) merupakan (saat ini) distrolet yang dikembangkan dari Arch Linux (http://www.archlinux.org). Chakra mempermudah anda jika ingin langsung mempunyai desktop yang fully functional dengan menggunakan desktop environment KDE. Tulisan ini akan menjelaskan cara menggunakan USB Modem EVDO ZTE AC 2726 dengan provider Smart. Tulisan ini berdasarkan pada pengalaman mas Muhammad Iqbal di http://masiqbal.net/modem-smart-evdo-zte-ac2726-di-linux.php (terima kasih mas!) dan manual dari usb_modeswitch yang bisa diperoleh di http://www.draisberghof.de/usb_modeswitch/

OS yang saya gunakan adalah Chakra versi terakhir (Phoix). Meskipun menggunakan Chakra, tulisan yang ada disini bisa diterapkan juga untuk Arch Linux. Chakra dan Arch yang akan anda gunakan sudah harus mempunyai Yaourt karena instalasi nantinya akan menggunakan Yaourt. Jika belum mempunyai, anda bisa menggunakan Pacman untuk menginstall Yaourt.

Pada saat modem USB dicolokkan, Chakra sudah langsung mengenali. Berikut adalah snapshot dari lsusb:

[root@chakra etc]# lsusb 
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 003: ID 19d2:fff5 ONDA Communication S.p.A. 
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module]
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 04f2:b016 Chicony Electronics Co., Ltd VGA 30fps UVC Webcam
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
[root@chakra etc]# 

Device yang dikenali disitu adalah "Bus 005 Device 003: ID 19d2:fff5 ONDA Communication S.p.A.". Meskipun sudah dikenali, perlu digunakan usb_modeswitch untuk mengubah dari mode storage ke mode Modem. Berikut adalah langkah-langkan instalasi paket supaya modem bisa digunakan.

Langkah pertama adalah instalasi usb_modeswitch menggunakan Yaourt:

[root@chakra ~]# yaourt -Ss usb_modeswitch
aur/usb_modeswitch 1.1.2-1 (83)
  Activating switchable USB devices on Linux.
aur/usb_modeswitch-fixed 1.1.1-3 (Out of Date) (13)
  Activating switchable USB devices on Linux.
aur/usb_modeswitch-updated 1.1.1-1 (2)
  Activating switchable USB devices on Linux.
[root@chakra ~]# yaourt -S usb_modeswitch
==> WARNING: Building package as root is dangerous.
 Please run yaourt as a non-privileged user.

==> Downloading usb_modeswitch PKGBUILD from AUR...
--2010-05-26 09:43:18--  http://aur.archlinux.org/packages/usb_modeswitch/usb_modeswitch.tar.gz
Resolving aur.archlinux.org... 208.92.232.29
Connecting to aur.archlinux.org|208.92.232.29|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 693 [application/x-tgz]
Saving to: “usb_modeswitch.tar.gz”

100%[=============================================================>] 693         --.-K/s   in 0s      

2010-05-26 09:43:24 (54.7 MB/s) - “usb_modeswitch.tar.gz” saved [693/693]

bsdtar: Removing leading '/' from member names
x PKGBUILD

Comment by: cyberpatrol on Wed, 24 Mar 2010 22:23:14 +0000
Please, update this package. Version 1.1.1 is out and the version 1.1.0 is not available for downloading anymore.

Comment by: helios on Fri, 26 Mar 2010 13:46:40 +0000
I will update it as soon as I get back from holiday.

Comment by: gborzi on Tue, 20 Apr 2010 22:29:21 +0000
Version 1.1.2 is available, it requires tcl to work. Also udev doesn't seem able to find the tcl script which is installed by default as
/lib/udev/usb_modeswitch/usb_modeswitch.tcl
installing it as /lib/udev/usb_modeswitch it is found and works. This is the PKGBUILD I've used to make the package
pkgname=usb_modeswitch
pkgver=1.1.2
pkgrel=1
_pkgdata=20100418
pkgdesc="Activating switchable USB devices on Linux."
arch=('i686' 'x86_64')
url="http://www.draisberghof.de/usb_modeswitch/"
license=('GPL')
depends=('libusb' 'tcl')
makedepends=('gcc' 'make' 'wget')
backup=('/etc/$pkgname.conf')
source=("http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-${pkgver}.tar.bz2"
"http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-data-${_pkgdata}.tar.bz2")
md5sums=('071cb300d00938bfe20025c654303d92' '659c9633513fa2f84465244a50c351b3')
build() {
cd $srcdir
# fetching
wget -Nc http://www.draisberghof.de/usb_modeswitch/usb_modeswitch.setup || return 1
# extracting
cd $srcdir/usb-modeswitch-$pkgver/
mkdir -p $pkgdir/lib/udev/usb_modeswitch || return 1
mkdir -p $pkgdir/etc || return 1
mkdir -p $pkgdir/usr/share/man/man1 || return 1
# deleting the precompiled binary
make clean || return 1
# recompiling
make || return 1
# installing
make DESTDIR=${pkgdir} install || return 1
# adjusting the tcl script location
mv ${pkgdir}/lib/udev/usb_modeswitch/usb_modeswitch.tcl ${pkgdir}/lib/udev/usb_modeswitch.tcl || return 1
rmdir ${pkgdir}/lib/udev/usb_modeswitch || return 1
mv ${pkgdir}/lib/udev/usb_modeswitch.tcl ${pkgdir}/lib/udev/usb_modeswitch || return 1
# installing data
cd $srcdir/usb-modeswitch-data-${_pkgdata} || return 1
make DESTDIR=$pkgdir install || return 1
# installing config
cp $srcdir/usb_modeswitch.setup $pkgdir/etc/ || return 1
}

Comment by: helios on Sun, 25 Apr 2010 12:35:48 +0000
thanks and updated


      First Submitted: Thu, 26 Jun 2008 17:00:39 +0000
usb_modeswitch 1.1.2-1 : Activating switchable USB devices on Linux.
( Unsupported package: Potentally dangerous ! )
==>  Edit PKGBUILD ? [Y/n] ("A" to abort)
==>   ----------------------------------------------
==>n


==> usb_modeswitch dependencies:
 - libusb (already installed)
 - tcl (package found)
 - gcc (package found)
 - make (package found)
 - wget (already installed)
==>  Continue the building of usb_modeswitch ? [Y/n]
==>   ----------------------------------------------
==>Y


==> Install or build missing dependencies for usb_modeswitch:
resolving dependencies...
looking for inter-conflicts...

Targets (7): libmpc-0.8.2-1  ppl-0.10.2-3  cloog-ppl-0.15.9-1  libelf-0.8.13-1  gcc-4.5.0-2  
             make-3.81-5  tcl-8.5.8-1  

Total Download Size:    19.83 MB
Total Installed Size:   79.74 MB

Proceed with installation? [Y/n] 
:: Retrieving packages from core...
 libmpc-0.8.2-1-i686...    68.0K   31.8K/s 00:00:02 [############################################] 100%
 ppl-0.10.2-3-i686.p...     2.4M   15.0K/s 00:02:47 [############################################] 100%
 cloog-ppl-0.15.9-1-...   119.5K   16.0K/s 00:00:07 [############################################] 100%
 libelf-0.8.13-1-i686      84.6K   23.9K/s 00:00:04 [############################################] 100%
 gcc-4.5.0-2-i686.pk...    14.7M   15.5K/s 00:16:12 [############################################] 100%
 make-3.81-5-i686.pk...   322.7K   18.5K/s 00:00:17 [############################################] 100%
:: Retrieving packages from extra...
 tcl-8.5.8-1-i686           2.1M   16.1K/s 00:02:17 [############################################] 100%
checking package integrity...
(7/7) checking for file conflicts                   [############################################] 100%
(1/7) installing libmpc                             [############################################] 100%
(2/7) installing ppl                                [############################################] 100%
(3/7) installing cloog-ppl                          [############################################] 100%
(4/7) installing libelf                             [############################################] 100%
(5/7) installing gcc                                [############################################] 100%
(6/7) installing make                               [############################################] 100%
(7/7) installing tcl                                [############################################] 100%
==> Building and installing package

==> usb_modeswitch dependencies:
 - libusb (already installed)
 - tcl (already installed)
 - gcc (already installed)
 - make (already installed)
 - wget (already installed)
==> Making package: usb_modeswitch 1.1.2-1 i686 (Wed May 26 10:06:36 WIT 2010)
==> Checking Runtime Dependencies...
==> Checking Buildtime Dependencies...
==> Retrieving Sources...
  -> Downloading usb-modeswitch-1.1.2.tar.bz2...
--2010-05-26 10:06:36--  http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-1.1.2.tar.bz2
Resolving www.draisberghof.de... 194.0.247.207
Connecting to www.draisberghof.de|194.0.247.207|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 35001 (34K) [application/x-bzip]
Saving to: “usb-modeswitch-1.1.2.tar.bz2.part”

100%[=============================================================>] 35,001      25.0K/s   in 1.4s    

2010-05-26 10:06:44 (25.0 KB/s) - “usb-modeswitch-1.1.2.tar.bz2.part” saved [35001/35001]

  -> Downloading usb-modeswitch-data-20100418.tar.bz2...
--2010-05-26 10:06:44--  http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-data-20100418.tar.bz2
Resolving www.draisberghof.de... 194.0.247.207
Connecting to www.draisberghof.de|194.0.247.207|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13967 (14K) [application/x-bzip]
Saving to: “usb-modeswitch-data-20100418.tar.bz2.part”

100%[=============================================================>] 13,967      16.2K/s   in 0.8s    

2010-05-26 10:06:52 (16.2 KB/s) - “usb-modeswitch-data-20100418.tar.bz2.part” saved [13967/13967]

==> Validating source files with md5sums...
    usb-modeswitch-1.1.2.tar.bz2 ... Passed
    usb-modeswitch-data-20100418.tar.bz2 ... Passed
==> Extracting Sources...
  -> Extracting usb-modeswitch-1.1.2.tar.bz2 with bsdtar
  -> Extracting usb-modeswitch-data-20100418.tar.bz2 with bsdtar
==> Starting build()...
--2010-05-26 10:06:52--  http://www.draisberghof.de/usb_modeswitch/usb_modeswitch.setup
Resolving www.draisberghof.de... 194.0.247.207
Connecting to www.draisberghof.de|194.0.247.207|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 38634 (38K) [text/plain]
Saving to: “usb_modeswitch.setup”

100%[=============================================================>] 38,634      12.6K/s   in 3.0s    

2010-05-26 10:07:01 (12.6 KB/s) - “usb_modeswitch.setup” saved [38634/38634]

/bin/rm -f usb_modeswitch
gcc -o usb_modeswitch usb_modeswitch.c -march=i686 -mtune=generic -O2 -pipe -Wall -l usb
usb_modeswitch.c: In function ‘search_devices’:
usb_modeswitch.c:1120:8: warning: ‘listcopy’ may be used uninitialized in this function
install -d /tmp/yaourt-tmp-root/aur-usb_modeswitch/usb_modeswitch/pkg/usr/sbin
install --mode=755 usb_modeswitch /tmp/yaourt-tmp-root/aur-usb_modeswitch/usb_modeswitch/pkg/usr/sbin/usb_modeswitch
install --mode=755 usb_modeswitch.tcl /tmp/yaourt-tmp-root/aur-usb_modeswitch/usb_modeswitch/pkg/lib/udev/usb_modeswitch
install --mode=644 usb_modeswitch.conf /tmp/yaourt-tmp-root/aur-usb_modeswitch/usb_modeswitch/pkg/etc/usb_modeswitch.conf
install --mode=644 usb_modeswitch.1 /tmp/yaourt-tmp-root/aur-usb_modeswitch/usb_modeswitch/pkg/usr/share/man/man1/usb_modeswitch.1
install -d /tmp/yaourt-tmp-root/aur-usb_modeswitch/usb_modeswitch/pkg/etc/usb_modeswitch.d
install --mode=644 -t /tmp/yaourt-tmp-root/aur-usb_modeswitch/usb_modeswitch/pkg/etc/usb_modeswitch.d ./usb_modeswitch.d/*
install -d /tmp/yaourt-tmp-root/aur-usb_modeswitch/usb_modeswitch/pkg/lib/udev/rules.d
install --mode=644 40-usb_modeswitch.rules /tmp/yaourt-tmp-root/aur-usb_modeswitch/usb_modeswitch/pkg/lib/udev/rules.d
if [ -f /tmp/yaourt-tmp-root/aur-usb_modeswitch/usb_modeswitch/pkg/etc/issue ]; then \
                if [ -n `which udevadm 2>/dev/null` ]; then \
                        UDEVADM=`which udevadm`; \
                        UDEVADM_VER=`$UDEVADM -V 2>/dev/null`; \
                        if [ -z $UDEVADM_VER ]; then \
                                UDEVADM_VER=`$UDEVADM --version 2>/dev/null`; \
                        fi; \
                        if [ $UDEVADM_VER -gt 127 ]; then \
                                $UDEVADM control --reload-rules; \
                        else \
                                $UDEVADM control --reload_rules; \
                        fi \
                elif [ `which udevcontrol 2>/dev/null` ]; then \
                `which udevcontrol` reload_rules; \
                fi \
        fi
==> Tidying install...
  -> Purging other files...
  -> Compressing man and info pages...
  -> Stripping debugging symbols from binaries and libraries...
==> Creating package...
  -> Generating .PKGINFO file...
  -> Compressing package...
==> Finished making: usb_modeswitch 1.1.2-1 i686 (Wed May 26 10:07:03 WIT 2010)

==>  Continue installing usb_modeswitch? [Y/n]
==>  [v]iew package contents [c]heck package with namcap
==>   ----------------------------------------------
==>Y

loading package data...
checking dependencies...
(1/1) installing usb_modeswitch                     [############################################] 100%
If you like this package, please install aurvote
and vote for its inclusion/keeping in [community]

[root@chakra ~]# 

Snapshots di atas adalah yang saya ambil dari screen pada saat instalasi. Perintah yang diketikkan sebenarnya hanya satu, yaitu "yaourt -S usb_modeswitch" dan setelah itu menjawab untuk meneruskan instalasi.

Konfigurasi /etc/usb_modeswitch_setup

File ini berisi setup untuk hardware yang kita gunakan. Yang perlu dilakukan hanya menghilangkan komentar ";" di depan konfigurasi hardware yang kita gunakan. Dalam hal ini, karena menggunakan ZTE 2726, kita akan mengedit bagian tersebut menjadi sebagai berikut:

DefaultVendor=  0x19d2
DefaultProduct= 0xfff5

TargetVendor=   0x19d2
TargetProduct=  0xfff1

# only for reference and 0.x versions
# MessageEndpoint=0x05

MessageContent="5553424312345678c00000008000069f030000000000000000000000000000"

Setelah selesai, jalankan usb_modeswitch berikut ini:

[root@chakra etc]# usb_modeswitch 

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 Found devices in default mode or class (1)
Accessing device 002 on bus 005 ...
Using endpoints 0x0a (out) and 0x89 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached

SCSI inquiry data (for identification)
-------------------------
  Vendor String: ZTE     
   Model String: USB Storage FFF1
Revision String: 2.31
-------------------------

USB description data (for identification)
-------------------------
Manufacturer: ZTE, Incorporated
     Product: USB Storage
  Serial No.: 000000000002
-------------------------
Setting up communication with interface 0 ...
Using endpoint 0x0a for message sending ...
Trying to send message 1 to endpoint 0x0a ...
 OK, message successfully sent
-> Run lsusb to note any changes. Bye.

[root@chakra etc]# 

Setelah itu, lihat hasilnya menggunakan lsusb, jika berhasil, pada baris kedua akan berubah menjadi fff1 bukan fff5 seperti di awal tulisan ini:

[root@chakra etc]# lsusb 
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 003: ID 19d2:fff1 ONDA Communication S.p.A. 
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module]
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 04f2:b016 Chicony Electronics Co., Ltd VGA 30fps UVC Webcam
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
[root@chakra etc]# 

Untuk mengaktifkan, tinggal kita gunakan wvdial:

[root@chakra etc]# pacman-color -S wvdial
resolving dependencies...
looking for inter-conflicts...

Targets (3): xplc-0.3.13-2  wvstreams-4.6.1-2  wvdial-1.61-2  

Total Download Size:    1.25 MB
Total Installed Size:   8.27 MB

Proceed with installation? [Y/n] 
:: Retrieving packages from extra...
 xplc-0.3.13-2-i686        43.5K   25.1K/s 00:00:02 [############################################] 100%
 wvstreams-4.6.1-2-i...  1152.1K   16.4K/s 00:01:10 [############################################] 100%
 wvdial-1.61-2-i686        85.9K   32.3K/s 00:00:03 [############################################] 100%
checking package integrity...
(3/3) checking for file conflicts                   [############################################] 100%
(1/3) installing xplc                               [############################################] 100%
(2/3) installing wvstreams                          [############################################] 100%
(3/3) installing wvdial                             [############################################] 100%
[root@chakra etc]# 

Jalankan wvdialconf untuk membuat konfigurasi wvdial berikut ini:

[root@chakra ~]# wvdialconf 
Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

Modem Port Scan<*1>: S0   S1   S2   S3   
WvModem<*1>: Cannot get information for serial port.
ttyUSB0<*1>: ATQ0 V1 E1 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB0<*1>: Modem Identifier: ATI -- Manufacturer: QUALCOMM INCORPORATED
ttyUSB0<*1>: Speed 9600: AT -- OK
ttyUSB0<*1>: Max speed is 9600; that should be safe.
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
WvModem<*1>: Cannot get information for serial port.
ttyUSB1<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB1<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB1<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
WvModem<*1>: Cannot get information for serial port.
ttyUSB2<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB2<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB2<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
WvModem<*1>: Cannot get information for serial port.
ttyUSB3<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB3<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB3<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
WvModem<*1>: Cannot get information for serial port.
ttyUSB4<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB4<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB4<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.

Found a modem on /dev/ttyUSB0.
/etc/wvdial.conf: Can't open '/etc/wvdial.conf' for reading: No such file or directory
/etc/wvdial.conf: ...starting with blank configuration.
Modem configuration written to /etc/wvdial.conf.
ttyUSB0: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
[root@chakra ~]# 

Hasilnya adalah sebagai berikut:

[root@chakra ~]# cat /etc/wvdial.conf 

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
; Phone = 
ISDN = 0
; Username = 
Init1 = ATZ
; Password = 
Modem = /dev/ttyUSB0
Baud = 9600
[root@chakra ~]# 

Ubah sesuai dengan konfigurasi Smart:

[root@chakra ~]# cat /etc/wvdial.conf 

[Dialer Smart]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Phone = #777
ISDN = 0
Username = smart
Init1 = ATZ
Password = smart
Modem = /dev/ttyUSB0
Baud = 9600
FlowControl = CRTSCTS
Carrier Check = No
New PPPD = yes
[root@chakra ~]# 

Untuk mengaktifkan koneksi ke Internet, yang perlu dilakukan hanya memanggil wvdial berikut ini:

[root@chakra ~]# wvdial Smart
--> WvDial: Internet dialer version 1.61
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected.  Waiting for prompt.
~[7f]}#@!}!}!} }9}"}&} } } } }#}%B#}%}%}&} }/[0f]9}'}"}(}"dq~
--> PPP negotiation detected.
--> Starting pppd at Wed May 26 10:53:55 2010
--> Pid of pppd: 6231
--> Using interface ppp0
--> pppd: H~� Pt� 
--> pppd: H~� Pt� 
--> pppd: H~� Pt� 
--> pppd: H~� Pt� 
--> pppd: H~� Pt� 
--> local  IP address 10.12.26.89
--> pppd: H~� Pt� 
--> remote IP address 10.20.4.138
--> pppd: H~� Pt� 
--> primary   DNS address 10.17.3.244
--> pppd: H~� Pt� 
--> secondary DNS address 10.17.3.252
--> pppd: H~� Pt� 

Selesai. Lain waktu, saat booting komputer dan masuk ke Linux, dari terminal aktifkan wvdial dengan perintah "wvdial Smart" sebelum mulai menggunakan.

Selamat mencoba!