Archive for the ‘Linux’ Category
* slow usb pen drive in linux
Posted on November 16th, 2009 by Alex. Filed under Linux.
I experienced slow USB mass storage devices such as USB pen drives, attached to a USB2.0 port. The writing speed usually did not cross 600KB/sec. To solve the problem I am mounting the pen drive with the async option set.
The manual of mount in NetBSD says about async:
All I/O to the file system should be done asynchronously. In the event of a crash, it is impossible for the system to verify the integrity of data on a file system mounted with this option. You should only use this option if you have an application-specific data recovery mechanism, or are willing to recreate the file system from scratch.
Since I am using pen drives to move data only e.g. for a presentation, it is no big issue to reformat the pen drive in case of a crash. With async set the writing speed increases to around 8MB/sec. To make the change persistent, add async in your fstab:
/dev/sdb1 /media/usb0 auto noauto,noatime,nodiratime,user,rw,exec,suid,async,uid=1000,gid=1000,umask=0072 0 0
Or, if you use usbmount to mount the pen drives automatically add async to the MOUNTOPTIONS in /etc/usbmount/usbmount.conf
It is always a good idea to sync or to umount the drives before you unplug them.
* bluetooth segfaulting in debian
Posted on October 14th, 2009 by Alex. Filed under Linux.
In my Debian box the Bluetooth Applet segfaulted whenever a USB Bluetooth dongle was inserted. The relevant log entry (e.g. dmesg|tail) looked like this:
Oct 6 14:04:41 jitu kernel: [ 90.400199] usb 7-2: new full speed USB device using uhci_hcd and address 3
Oct 6 14:04:41 jitu kernel: [ 90.686465] usb 7-2: New USB device found, idVendor=0a12, idProduct=0001
Oct 6 14:04:41 jitu kernel: [ 90.686473] usb 7-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Oct 6 14:04:41 jitu kernel: [ 90.686646] usb 7-2: configuration #1 chosen from 1 choice
Oct 6 14:04:41 jitu hcid[3085]: HCI dev 0 registered
Oct 6 14:04:41 jitu hcid[3085]: HCI dev 0 up
Oct 6 14:04:41 jitu hcid[3085]: Device hci0 has been added
Oct 6 14:04:41 jitu hcid[3085]: Starting security manager 0
Oct 6 14:04:42 jitu hcid[3085]: Device hci0 has been activated
Oct 6 14:04:42 jitu kernel: [ 91.208984] bluetooth-apple[3333]: segfault at 0 ip b70e2e18 sp bfffbefc error 4 in libc-2.7.so[b706d000+155000]
Here the bluetooth-apple(t), a part of gnome-bluetooth, crashed. Hence no user friendly symbol showed up next to the clock allowing the easy transfer of files to a Bluetooth device. However in the console hcitool scan and sdptool browse worked and displayed the correct data.
The solution was to include the current user into the group netdev. You can check your membership of the groups by typing groups in the console. If netdev is not listed, execute a adduser as root and restart the x-server to update this information.
* bitbake and proxy
Posted on June 20th, 2009 by Alex. Filed under Linux, openmoko.
Currently interns are trying to use bitbake to create an openembedded image for the beagle board. After setting up everything according to the step-by-step instructions, they run into a major problem: the proxy of the Indian Institute of Science.
bitbake uses wget to download the necessary packages. To tell wget that is has to send all requests to the proxy, environment variable are set:
export http_proxy=”http://proxy.example.com:8080″
export ftp_proxy=”http://proxy.example.com:8080″
However if wget is executed by bitbake to download a missing package, the environment variables are gone and wget tries to connect to the HTTP servers directly. A search in the Internet for that particular problem was not successful. A workaround (and not a solution) is to export the variables again, before wget is executed. Changing the recipes might be a never ending task. An easier way is to change the wget executable itself:
- Open a terminal and type
cd /usr/bin/. If the file is not there, you can usewhich wgetto figure out, where it is hidden. mv wget wget.executable(for this you need root permission, getting them by either executingsudo(Ubuntu) or by becoming root withsu).- Open an editor of your choice and type:
#!/bin/bash
echo “Using alternative wget…”
export http_proxy=”http://proxy.example.com:8080″
export ftp_proxy=”http://proxy.example.com:8080″/usr/bin/wget.executable $@
- Save this file as
wgetin/usr/bin/(for that you need to be root again). - Change the permission for this file by entering
chmod +x wgetin the terminal (also as root). - Execute
bitbakeas usual. Theechodirective just prints out a message, so you can check, ifbitbakeis taking the right executable.
I hope, it helps and saves you some time.
* horizontal black bar on second monitor
Posted on June 10th, 2009 by Alex. Filed under Linux.
I am using twinview settings of my Nvidia graphics adapter to control the VGA port of my laptop for a second monitor. A few days ago I saw that a horizontal black bar which was not accessible by the mouse appeared on the second monitor. The lower part of maximized windows was also missing as if the whole screen moved up and the visible area stayed at the same place. I did not know, what I did or changed nor I did not recognize it immediately.
Since the space was around 25 pixels I assumed that the Gnome panel is interfering somehow first. The vertical alignment settings did not go so far to compensate that much width of the black bar. Since I assumed a software problem I started to dig around for a solution and tried to recall, what I actually did. By accident I found the solution: The monitor has a “Reset to factory defaults” setting. After everything was reset, the black bar vanished. So I must somehow changed a setting such as “Auto Adjustment” or so, which messed up the visible area. I heard that some users had a vertical black bar which also vanished after reseting the values.
* thunderbird/icedove and inline pdf attachments
Posted on April 23rd, 2009 by Alex. Filed under Linux.
Recently I experienced problems with PDF attachments in Thunderbird or Icedove as it is called in Debian. The document is inlined, but also sent as attachment. In Thunderbird extracting the attachment is not a problem. However other mail clients do not recognize the PDF as attachment and display lots of garbage in the message text.
It might look like this:
This is a test mail.
%PDF-1.3
%Çì¢
5 0 obj
<>
stream
xœÍ}[sÇ‘f„çM/óðl=]÷ªyZÛ’RçWrSf×áüyýu}q)6ï´päϯ/Älêü}þ³õç?_\*£6çÄù}{zOµß<ýö¤ƒÎœoHo¦ O¿ÁŸ»ße8ÿzsV)þ=ûê¿bzSJžÿº½P;Öå©×{8Ó†F~¾]HeéÐÛ|ŸÅ_úzQÿ\XÀŠâÆX¹y}v k.ý.Òú–!©aÝô&Ín,°Ývüñ7ææö]èïRC[»Hƒ‡§ÒxÜ€òÂóöÂ[x*ã*ÉM›ÝXúÇÖMý…£½
The problem is that the PDF is attached as “text/pdf”. If the message is displayed as source (go to “View” -> “Message Source”) you can check it by yourself. Somewhere in the mail you can find something similar to this:
[...]
————–050800000902000902020904
Content-Type: text/pdf;
name=”PDFdocument.pdf”
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename=”PDFdocument.pdf”JVBERi0xLjMKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURl
Y29kZT4+CnN0cmVhbQp4nM19W3Mdx5FmhOdNL/MX8AhsCD1d96p5WtuSPFprZa/NidgIjR5A
[...]
The last 2 lines above are the actual attachment represented in base64 encoding. The section should read
[...]
————–050800000902000902020904
Content-Type: application/pdf;
name=”PDFdocument.pdf”
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename=”PDFdocument.pdf”JVBERi0xLjMKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURl
Y29kZT4+CnN0cmVhbQp4nM19W3Mdx5FmhOdNL/MX8AhsCD1d96p5WtuSPFprZa/NidgIjR5A
[...]
to work. So somehow the Content-Type setting got messed up. The solution to this problem is quite easy:
- Close Thunderbird/Icedove
- Go to the working directory of the Thunderbird/Icedove installation. On my machine that is
cd ~/.mozilla-thunderbird/98j7l74z.default/. - Move
mimeTypes.rdfto a new file name:mv mimeTypes.rdf mimeTypes.rdf.bak. It will be regenerated the next time Thunderbird/Icedove starts. - Start Thunderbird/Icedove and check, if it works.
* dropping to busybox
Posted on April 9th, 2009 by Alex. Filed under Linux.
Sometimes and unpredictable the root filesystem could not be mounted during boot causing the kernel to drop to busybox saying something like:
mount: Mounting /dev/root on /root failed: no such device
mount: Mounting /root/dev on /dev/.static/dev failed: no such file or directory
mount: Mounting /sys on /root/sys failed: no such file or directory
mount: Mounting /proc on /root/proc failed: no such file or directory
Target filesystem doesn’t have /sbin/init
Repeating the same mount commands at the command line worked flawlessly, but drove the kernel into a kernel panic, when the boot sequence continued. I cannot remember why and I did not investigate that further.
However when I removed all parameters given in the kernel line in grub, the boot sequence completed without any problems. Recently I read somewhere that there is a problem in detecting the kind of filesystem used (ext3, ext4, reiserFS, etc) and there is somewhat a mix up. Telling the kernel, what filesystem is used especially for the root filesystem, helped a lot and so far I did not experience this problem again. Just add rootfstype to the kernel boot option so that your menu.lst in /boot/grub/ looks like this:
title Debian GNU/Linux, kernel 2.6.28.8-6
root (hd0,1)
kernel /vmlinuz-2.6.28.8-6 root=/dev/sda5 ro rootfstype=ext4 resume=/dev/sda3
initrd /initrd.img-2.6.28.8-6title Debian GNU/Linux, kernel 2.6.28.8-6 (single-user mode)
root (hd0,1)
kernel /vmlinuz-2.6.28.8-6 root=/dev/sda5 ro rootfstype=ext4 single
initrd /initrd.img-2.6.28.8-6
You need to replace the value (ext4) by your own filesystem.
* use apt offline
Posted on March 26th, 2009 by Alex. Filed under Linux.
If your Linux box running on Debian or Ubuntu does not have an access to the Internet to install new packages or to update them from the repository, this little step-by-step how-to might help. It is translated from a how-to written in German, but omits the creation of a CD where the newly downloaded packages are written to. USB pen drives and hard disks with huge capacity are very cheap today and the versions of the packages especially in the testing, unstable branches including Ubuntu change very often. A pen drive is faster and rewritable.
This how-to is written for beginners which are unfamiliar with the terminal. Hence the description is long and looks complicated. In some points the explanations might elaborated a little bit too much. Feel free to skip those sections.
OK, let’s start!
How-to
- At first it is important that you know, what shall be updated. Which branch (or also called tree) do you want to switch to (if any)? In Debian there are 3 (actually 4 to be more precise, but I will not consider “experimental” here): stable (currently called Lenny), testing (Squeeze) and unstable (Sid). Ubuntu is issued in a 6 month cycle So there is 8.04 (issued in April (4) 2008; called Hardy Heron), 8.10 (Intrepid Ibex) etc. A list if releases can be found on Wikipedia.
- Debian/Ubuntu maintains a list of all available packages, their descriptions, version numbers, dependencies etc. Synaptic, aptitute, dselect, etc. are front ends which process the list and show it to you in a very nice and manageable way. So, if you want to update the packages, your Linux box needs to know, if a new version of the installed package is available at all. To download current lists, go to “Applications” -> “Accessories” -> “Terminal” and type:
gedit /etc/apt/sources.list &.
This opens the editor and shows the content ofsources.list. It may look like this:# IISc repository
deb http://webrepo.iisc.ernet.in/mirrors/debian lenny main contrib non-free# lenny packages (lenny)
deb http://ftp.de.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.de.debian.org/debian/ lenny main contrib non-free
deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-freeEach line starting with a hash (#) is a comment and ignored. You can see, I am running on Debian and the stable branch is installed. If you are a student of IISc, I strongly recommend to you to use the mirror (http://webrepo.iisc.ernet.in). It is a repository on campus and the download speed is much faster than the servers located in the Internet. A documentation, how to use the repository on campus, can be found in the Wiki (in the section Debian/Ubuntu Mirror Instructions). Maybe also your university or company has a local mirror, which will speed up the downloads.
If I want to upgrade the branch (e. g. lenny to squeeze) I replace all occurrences of lenny with squeeze in
sources.list.Out of the information in the
sources.listI generate the addresses, where the new lists can be found. I give an example for the first line (deb http://webrepo.iisc.ernet.in/mirrors/debian lenny main contrib non-free) only. I colored the different sections. You have to replace it with the information in yoursources.list. If you have a 64bit version, you have to replacebinary-i386bybinary-amd64. To figure out, if you run on a 32bit (i386) or 64bit operating system, type inuname -ain the still opened terminal. If there is a i686 or i386 mentioned in the output, it is 32bit; if it is x86_64 it is 64bit.The first addresses are:
http://webrepo.iisc.ernet.in/mirrors/debian/dists/lenny/main/binary-i386/Release
http://webrepo.iisc.ernet.in/mirrors/debian/dists/lenny/main/binary-i386/Packages.bz2
http://webrepo.iisc.ernet.in/mirrors/debian/dists/lenny/contrib/binary-i386/Release
http://webrepo.iisc.ernet.in/mirrors/debian/dists/lenny/contrib/binary-i386/Packages.bz2
http://webrepo.iisc.ernet.in/mirrors/debian/dists/lenny/non-free/binary-i386/Release
http://webrepo.iisc.ernet.in/mirrors/debian/dists/lenny/non-free/binary-i386/Packages.bz2
After you know the addresses, access a computer connected to the Internet. You can type in the addresses into your browser and download the files
Packages.bz2andReleaseto the pen drive. Since the filename is always the same, you will overwrite them all the times, if you proceed to the next set of addresses. Hence, so for each set you should use another directory on the pen drive. But keep in mind that later on you still need to know, from which address you downloaded the files. So use proper names for the directories. Take the pen drive back to you Linux box that is offline, mount the pen drive and go to the downloaded directories. For each set of files in each directory you need to perform the following steps:- Unpack
Packages.bz2(e. g. with file-roller, Archive-Manager, orbunzip2 Packages.bz2[in the Terminal]) - Rename the files regarding their source according to the following scheme (example for the first set):
TheReleasefile of the first address becomeswebrepo.iisc.ernet.in_mirrors_debian_dists _lenny_main_binary-i386_Releaseand thePackages(fromPackages.bz2) becomeswebrepo.iisc.ernet.in_mirrors_debian_dists_lenny_main_binary-i386_Packages
After renaming all downloaded file, copy them to
/var/lib/apt/lists/and overwrite the files already residing there. For that root privileges are mandatory. Do not perform an update (e.g.apt-get update) after the copy. It will probably overwrite the files again. After this step is complete, you performed anapt-get updatemanually. - Unpack
- OK, now the box is ready to create a list of packages that should be included in the upgrade. Since this box does not have Internet access, you need to store that list into a file. again I will give an example. I would like to perform an upgrade and hence would like to download all updated packages. In addition I would like to install vlc (Video LAN Client) with all its dependencies and apache (the web server) with PHP4 support. Therefore I do an
apt-get -qq --print-uris install vlc > /tmp/apt_list
apt-get -qq --print-uris install apache php4 >> /tmp/apt_list
apt-get -qq --print-uris dist-upgrade >> /tmp/apt_list
as root in the terminal. Notice that the
>sign is replaced by a double>>after the first line. One>will create the file, double>>append the output of apt-get to that file. Without the>, the output will be displayed on the screen. However the output is not in the right format and we need to do an
awk '{gsub("\x27", "", $0); print $1}' < /tmp/apt_list > /tmp/apt_list_new
to get only the addresses of the packages to download (you can openapt_listandapt_list_newin/tmp/with an editor and have a look into it, if you wish):http://webrepo.iisc.ernet.in/mirrors/debian/pool/main/a/apache2/apache2-utils_2.2.9-10+lenny2_i386.deb
http://webrepo.iisc.ernet.in/mirrors/debian/pool/main/a/apache2/apache2.2-common_2.2.9-10+lenny2_i386.deb
http://webrepo.iisc.ernet.in/mirrors/debian/pool/main/a/apache2/apache2-mpm-worker_2.2.9-10+lenny2_i386.deb
http://webrepo.iisc.ernet.in/mirrors/debian/pool/main/a/apache2/apache2_2.2.9-10+lenny2_all.deb
.
.
.Copy
apt_list_newto your pen drive and plug it into a computer with Internet access. - Now we are going to download the new and updated packages. For that we use
wget.In Linux: Open a terminal, mount the pen drive and change to the directory in which
apt_list_newis located. Ensure that you have at least some 100 MB free on the pen drive depending on how much you are going to download.[Update 20/05/2011] If you do an
apt-get dist-upgradeafter a new version was released, you might have to download thousands of new files. Unfortunatelywgetdownloads only one file at a time and it does not have the provision of concurrent downloads. Hence I recommend aria2 instead, which exactly fills the gap. It is a powerful download tool and you might want to have a look into its wiki to get to know what else it can do. There are packages for Debian and Ubuntu in the standard repositories. After installing it, invoke it by executing
aria2c -i apt_list_new -j5 --save-session=out.txt
to start 5 downloads concurrently.
[/Update]In Windows: Download wget for Windows. You need to extract the downloaded zip file and copy its contents to a folder (e.g. C:\wget). After that you open the Command Prompt and go to that directory (e. g. cd c:\wget). Copy
apt_list_newto the same directory wherewgetresides.For both operating systems again:
In the Terminal or Command Prompt (whatever you have) you type
wget -i apt_list_new.
wgetwill download all packages given inapt_list_new. After it is done, copy all files ending with.debto the pen drive (if the box is a Windows machine). - Back at the offline Linux box: Mount the pen drive and copy all
.debto/var/cache/apt/archives/as root. This is the same directory, in which Synaptic, apt-get, aptitude, etc. stores the downloaded packages. - Perform a
apt-get install vlc
apt-get install apache php4
apt-get dist-upgrade
as root in the terminal. It will give a list of packages and its dependencies and somewhere it will say: “Need to download 0B of 234MB from the repository”. After confirming so, you have succeeded. Execute the apt-get command in exactly the same order as you did when the package URLs are printed into a file.
. In this how-to you do not have to upgrade to a more current distribution release, but you can, if you wish to.
It is not that easy, especially when you are new to Linux. But this should not discourage you from at least trying. The steps above have been tested on my Lenny box and might be slightly different on yours. Let me know your difficulties and experiences by leaving a comment.
* virtualbox-ose in debian lenny
Posted on March 24th, 2009 by Alex. Filed under Linux.
With the new kernel 2.6.29 which just came out, the kernel module of Virtualbox (OSE, version 1.6.6-dfsg-3) that is shipped with the Lenny distribution of Debian, does not compile anymore. Apply this patch (right click, “Save As”) with the command
patch -p1 < /usr/src/vbox-ose-1.6.6-dfsg-3_kernel2.6.29.patch
as root (assuming the patch is stored in /usr/src/ and you are currently in /usr/src/modules/virtualbox-ose/) and recompile the module (with m-a or similar).
Sources:
- http://forums.virtualbox.org/viewtopic.php?t=12854# (for Virtualbox version 2.1.0)