Archive for March, 2009
* use apt offline
Posted on March 26th, 2009 by jitu. 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.debhttp://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
.
.
.
Copyapt_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.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 says: “Need to download 0B of 234MB from the repository”. After confirming so, you have succeed. 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 jitu. 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)
* readable font in qt applications
Posted on March 18th, 2009 by jitu. Filed under Linux.
Most probably you will get ugly fonts (especially Courier) in QT applications such as Opera after a clean installation of Debian Lenny.
In the Internet there are many hints and tips, how to activate antialiasing for the font, so that it does not look so ugly anymore:
- http://pigeonsnest.co.uk/stuff/sarge/uglyfonts.html
- http://www.mail-archive.com/debian-user-german@lists.debian.org/msg15779.html
- http://forums.debian.net/viewtopic.php?p=95965&sid=0b241276525fef86ba2ffcf68ee27747
- http://forums.debian.net/viewtopic.php?t=22021
Some of them include manipulation of the font settings or to disable the use of the X core fonts in Opera (type opera:config into the address line, go to User Prefs and disable Enable Core X Fonts. Hint: Type . [that is a fullstop] and a letter for an immediate search within the page.). The results were not satisfying, since Courier which looks like a typewriter font, is replaced by something looking like Arial.
However there might be a very simple solution. It just took me several hours to find it. The X core fonts are missing and hence Opera cannot use them at all. To install the core fonts, execute an apt-get install xfonts-75dpi-transcoded as root. If you need only the fonts in the ISO 10646-1 and ISO 8859-1 encoding, you can also install xfonts-75dpi instead. Also have a look at the 100dpi versions of the packages. After installing, the same section of the screen has visibly improved:
I do not care about antialiasing as long as the font is readable.
Pages:
Categories:
Archives:
- August 2010
- July 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- May 2008
- April 2008
- March 2008
- January 2008
- November 2007
- October 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006

