Posts filed under 'About computer'
Remote Desktop with FreeNX
ssh is great. But sometimes I just need a desktop. The remote desktop functionality offered by Ubuntu is kind of limited. For example, I just don’t know how I can enable remote desktop easily in the first place if one is not in front of the host already. Moreover, Ubuntu’s remote desktop is limited to LAN. I would love to do something similar to the Linux version of teamviewer.
It turns out that free remote desktop over the Internet is already out there for Linux/Ubuntu users! Better still, it is a piece of cake to install.
Add comment October 31, 2009
Almost kill my Ubuntu
I did an extremely stupid thing today.
It all started when I tried to fix some conflicting issue of OpenCV and ffmpeg. I installed and reinstalled many times. I tried this on my desktop and eventually tried it also on my laptop.
For some reasons, I could not install some required package (libxcb1-dev). It showed that there is a broken package. The only available version is 1.1.93-0ubuntu3 and it requires libxcb1 of the same version. But the installed version of the latter is 1.1.93-0ubuntu3.1. I was tired and just wanted to have some quick fix. Why just uninstalled libxcb1 and reinstalled it with the version ubuntu is happy with? Okay, surely the library is used by a long laundry list. But I was tired, what the hack? Mark, apply…
Of course, I wasn’t paying attention. It is a core library used by Gnome. So my whole desktop was gone. I was really panicking now. Good grief. Getting more troubles trying to solve a few, what an idiot I am…
I am lucky that after I rebooted my laptop, at least apt-get was still “working”. But network seemed to be down. Oh great, how can I get the network up again? I don’t want to reinstall the entire OS just because of this stupid mistake. Not to mention that I have to first backup everything. Fortunately, the network did not really die. Only the configuration for DNS was gone somehow. I setup the DNS server by adding the nameserver address (yours will be different) back to /etc/resolv.conf as described by some post on the web.
sudo echo "nameserver 192.168.2.1" > /etc/resolv.conf
After network is up, I slowly reinstalled all packages and gnome… Now, for my original problem, it turns out that my Software Sources->Updates was set to jaunty-security only. For some reason, I have installed libxcb1 of the version from jaunty-updates. Maybe after I installed Jaunty, I deselected jaunty-updates for some reasons but I don’t really remember how it ended up like this already. This probably a newbie problem but I think Ubuntu should warn us noobs when we try to deselect the default update source. No one will imagine such harmless act will “break” synaptic… Anyway, I learned my lesson today and will try to be less reckless with Ubuntu in the future.
Add comment October 11, 2009
Embedding all fonts in Ubuntu
It took me a while to finally manage to embed all fonts for pdf using Linux commands alone. Most conferences and journals require all fonts to be embedded for manuscript preparation. By default, pdflatex in Ubuntu suppose to embed all fonts. One can also change the setting using updmap. But the problem comes from the eps figures. I tried epstopdf and a2ping but both of them somehow don’t work for my figures. I finally get success with ps2pdf14 as follows
ps2pdf14 -dPDFSETTINGS=/prepress fig.eps
However, the figure generated was not cropped correctly. Luckily, we can run
pdfcrop fig.pdf
The final figure file (fig-crop.pdf) should have all fonts embedded. One can check it with
pdffonts fig-crop.pdf
In my case, I got
name type emb sub uni object ID ------------------------------------ ----------------- --- --- --- --------- KBSFAN+Helvetica Type 1C yes yes no 8 0
Add comment October 3, 2009
Video Chat with Ubuntu
It was a total pain to try to have skype and ubuntu jaunty work happily together. My miscellaneous problems with mic just can never be resolved. The medibuntu package simply doesn’t work for me. I even go as far to uninstall pulseaudio. Unfortunately, even that doesn’t make my skype work. Mic worked for the first self-test and then failed in the second one.
After all these struggles, it seems that meebo is the real solution. It uses tokbox to provide video chat function. The only glitch I encountered was “devices disabled” that my camera and mic couldn’t be activated. It turns out the fix is simple. Simply goto the macromedia site and set mee.tokbox.com to “always allow”.
Add comment July 25, 2009
Install Kile 2.0 in Ubuntu 9.04
Like many others, I am very frustrated with the new Kile and Ubuntu Janty has chosen it as default. It is ridiculously slow and the text doesn’t do dynamic word wrap (YES, it doesn’t!). There is a tool to “auto-wrap” but it screws up comments if you use % often as I do. After several months of frustration, I finally uninstalled it and reinstalled the old one. I am not a Linux expert and it is actually much easier than I thought. I probably would have done it couple months ago if I know it is that easy. Simply remove Kile from Synaptic and then download and run the correct version of debian package from this site.
btw, if you forgot to uninstall Kile 2.1 before reinstall 2.0, you may end up having some weird problems. One possible culprit is simply the configuration file is corrupted. A simplest solution is to copy a clean copy from some one else. The configuration file of Kile is ~/.kde/share/config/kilerc
Another note, after reinstalling 2.0, it is better to search kile in synaptic and apply force version Lock Version from Package->Lock Version Force Version… Otherwise, it will switch back to 2.1 after the next update.
11 comments June 28, 2009
tvtk conflict with compiz
I tried the following simple tvtk example but it kept hang my ubuntu 8.10 machine.
#!/usr/bin/env python from enthought.tvtk.api import tvtk cs=tvtk.ConeSource(resolution=100) mapper=tvtk.PolyDataMapper(input=cs.output) actor=tvtk.Actor(mapper=mapper) #create a renderer: renderer=tvtk.Renderer() # create a render window and hand it the renderer render_window = tvtk.RenderWindow(size=(400,400)) render_window.add_renderer(renderer) #dreate interactor and hand it the render window # this handles mouse interaction with window interactor=tvtk.RenderWindowInteractor(render_window=render_window) renderer.add_actor(actor) interactor.initialize() interactor.start()
It turns out that compiz is the trouble maker. The script will work if I switch back to metacity. This can be done by pressing ALT-F2 and then typing
metacity --replace
Just a side note, the code should be run in ipython with option -wthread.
Add comment March 6, 2009
ffmpeg and OpenCV
As of Oct 11, 2009, I reinstalled OpenCV and ffmpeg again on Ubuntu Jaunty. The previous installation procedure doesn’t seem to work. I can install OpenCV but it doesn’t cooperate happily with ffmpeg.
I came across this wonderful guide and it more or less solves all my problems. Below repeats some of the steps described in the guide.
First, we need some packages for building,
sudo apt-get build-dep python-opencv sudo apt-get install libswscale-dev swig
There is a problem with OpenCV. The structure of ffmpeg has changed but OpenCV isn’t catching up. We have to set soft links for several include files as follows.
sudo mkdir /usr/include/ffmpeg cd /usr/include/ffmpeg sudo ln -s ../libavcodec/avcodec.h avcodec.h sudo ln -s ../libavformat/avformat.h avformat.h sudo ln -s ../libavformat/avio.h avio.h sudo ln -s ../libavutil/avutil.h avutil.h sudo ln -s ../libswscale/swscale.h swscale.h
Now, check out latest OpenCV snapshot.
cd svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/tags/latest_tested_snapshot
Here, I diverge from the guide and go through cmake as suggested in the OpenCV website instead.
cd ~/latest_tested_snapshot/opencv # the directory should contain CMakeLists.txt, INSTALL etc. mkdir release # create the output directory cd release cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON .. make
Here, I diverge from both guides. Instead of running sudo make install, it is safer to run checkinstall. If checkinstall is not installed, install it from synaptic and then run
sudo checkinstall
For Python 2.6, it moves cv.so incorrectly to /usr/local/lib/python2.6/site-packages/. We will need to move cv.so back to /usr/local/lib/python2.6/dist-packages/
It spent me a day to get ffmpeg and OpenCV working together. There are quite a lot of guides on the web but some of them are probably outdated.
I have Ubuntu 8.10 installed and these two installation guides for ffmpeg and OpenCV work for me after a few tweaks.
1. For ffmpeg, one has to add –enable-shared as a config option. That is,
./configure --enable-shared --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
2. I first got error message for using ffmpeg after installation.
ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_gcd
But adding
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
to .bashrc will do the trick.
3. Before installing OpenCV, I have to run
sudo apt-get install libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev
to avoid compilation error.
N.B. For 64 bit Ubuntu, an additional flag –enable-pic is needed to configure x264.
Add comment March 4, 2009
Transferring Ubuntu to New Harddrive
My old harddrive had 60 G for my Ubuntu partition and the free space left was less than 2 G (and it is going fast). I figured it was time for me to find a bigger home for my Linux partition. I followed the Backup and Restore post but it missed out a couple simple and very important steps. So I guess it is good to log these here.
Honestly, I think the backup procedure might work (though unlikely, at least I think one shouldn’t just copy the boot folder to a new harddrive) if I only had nothing but a Linux partition. Anyhow, I think it is good to keep a Windows partition even though I rarely go there.
As mentioned in the backup guide, it is important to restore grub. However, the grub restoration guide there didn’t work for me. Actually, I’m not even sure the restoration steps did help or not since I got exactly the same problem–Grub Error 17: Cannot Mount Selected Partition–before and after applying these steps.
Actually, the problem can be fixed easily as follows.
Use Ubuntu Live CD to get on a working OS, from menu->Places->xxG Media to mount your harddrive. Then type
sudo fdisk -l
to see your actual drive location. Most probable reason of grub error 17 is that you have a wrong device link of your drive (wrong info inherited from my previous harddrive in my case). In my case, I have
Device Boot Start End Blocks Id System
/dev/sda1 * 1 6080 48837568+ 7 HPFS/NTFS
/dev/sda2 6081 60801 439546432+ 5 Extended
/dev/sda5 60045 60801 6080571 82 Linux swap / Solaris
/dev/sda6 6081 60044 433465767 83 Linux
My Linux partition sda6 corresponds to (hd0,5). If you have sdb5 and sdc4, they correspond to (hd1,4) and (hd2,3) and so on.
Edit boot/grub/menu.lst in your Linux partition, your drive mostly should be mounted to /media. If you are not certain, you can go to menu->System->Administration->System Monitor and select File System tab, it should display where your drive mount to. In my case, it is /media/disk. Then, edit grub menu by typing (or any other editor)
sudo vi /media/disk/boot/grub/menu.lst
Search for something like the following and
title Ubuntu 8.10, kernel 2.6.24-21-generic
root (hd0,4)
kernel /boot/vmlinuz-2.6.24-21-generic root=UUID=683edbfa-6d51-49f9-ae55-95f07a644b53 ro quiet splash
initrd /boot/initrd.img-2.6.24-21-generic
quiet
replace (hd0,4) by the correct drive link, which is (hd0,5) in my case.
Actually, that is not complete yet. If you reboot now, you will have another problem saying something like UUID=683edbfa-6d51-49f9-ae55-95f07a644b53 not found.
Instead, before rebooting, type ls -l /dev/disk/by-uuid
there should be a couple file with long names which link to one of your drive. For my case, I have
total 0
lrwxrwxrwx 1 root root 10 2009-02-04 08:04 6b453fda-b857-4ba1-a00b-74aadb2123c6 -> ../../sda5
lrwxrwxrwx 1 root root 10 2009-02-04 08:04 91f2ed9a-de11-4dfb-9ccc-46c0ae3e97cb -> ../../sda6
lrwxrwxrwx 1 root root 10 2009-02-04 08:04 960447000446E2BB -> ../../sda1
so, I should replace the uuid in menu.lst by 91f2ed9a-de11-4dfb-9ccc-46c0ae3e97cb. Everything should work fine with these changes.
2 comments February 4, 2009