github and debian

Note to Self

If you use github.com to host your projects these are two things to remember: * if you want a download url that is different from http://github.com/$user/$proj/tarball/master you can create a tag in your repo, push it to github and enjoy and new link in the download tab. Then you can download your project as http://github.com/$user/$proj/tarball/0.1 where 0.1 is the tag. Just for future ref : http://github.com/guides/push-tags-to-github

  • If you want to create a debian package from a github project you should use the excellent service provided by Gunnar Wolf. For example, this is the redirect for my project ocaml-buddy : http://githubredir.debian.net/githubredir.cgi?author=abate&project=ocaml-buddy .Then your watch file will look like:
version=3
http://githubredir.debian.net/github/abate/ocaml-buddy (.*).tar.gz

Many other things to remember, I’m sure, but I forgot them all :)


debtree with a local repository

Date Tags debian

debtree is a fantastic tool to create colorful graphs of package dependencies. One small shortcoming is that the user cannot provide a Packages.gz file directly to be used as repository. Since debtree is based on the excellent apt_pkg library, it is actually not that difficult to convince apt to look in a different location. To change debtree (and apt-get_ default behaviour you just need to create a new apt-get repository and then set the environment variable APT_CONFIG appropriately.

So … imagine you create a repository as :

mkdir -p /tmp/apt/{archives,lists}/partial
cp $yourPackagesfile /tmp/apt/lists
cp $yourstatusfile /tmp/apt/

now you need to create a new apt.conf file that looks like :

APT::Get::List-Cleanup "false";
Dir::Cache /tmp/apt;
Dir::State /tmp/apt;
Dir::State::status /tmp/apt/status;
Dir::Etc::SourceList /tmp/apt/sources.list;

Here I assume that the arch of the Packages list is the same as your host arch. Otherwise you must specify and additional apt parameter like :

APT::Architecture "i386";

Now you’re ready to play with your new repo :

APT_CONFIG=apt.conf apt-get update
APT_CONFIG=apt.conf debtree dpkg

done.

UPDATE

let’s put everything in a bash script ready to use :

$cat debtree.sh 
#!/bin/bash

TMPAPT=$HOME/fakeapt

function init() {
  mkdir -p $TMPAPT/{archives,lists}/partial
  cp $1 $TMPAPT/lists/Packages
  touch $TMPAPT/status

cat > $TMPAPT/apt.conf <<EOF
APT::Architecture "$2";
APT::Get::List-Cleanup "false";
Dir::Cache $TMPAPT;
Dir::State $TMPAPT;
Dir::State::status $TMPAPT/status;
Dir::Etc::SourceList $TMPAPT/sources.list;
EOF

cat > $TMPAPT/sources.list <<EOF
deb file:$TMPAPT/lists/ ./
EOF

  APT_CONFIG=$TMPAPT/apt.conf apt-get update
}

function debtree() {
  APT_CONFIG=$TMPAPT/apt.conf /usr/bin/debtree $@
}

case "$1" in
  init)
    init $3 $2
  ;;
  *)
    debtree $@
  ;;
esac

To use it, first, we need to initialize the fake apt repo, then we can just just debtree normally.

$./debtree.sh init amd64 unstable.packages 
Ign file: ./ Release.gpg
Ign file: ./ Translation-en_US
Ign file: ./ Release
Ign file: ./ Packages
Ign file: ./ Packages
Reading package lists... Done
abate@dev.au:~$./debtree.sh bash
Reading package lists... Done
Building dependency tree... Done
digraph "bash" {
    rankdir=LR;
    node [shape=box];
    "bash" -> "base-files" [color=blue,label="(>= 2.1.12)"];
    "base-files" -> "base-passwd" [color=blue,label="(>= 2.0.3.4)"];
    "base-files" -> "awk" [color=purple,style=bold];
    "awk" -> "Pr_awk" [label="-3-",dir=back,arrowtail=inv,color=green];
    "Pr_awk" [label="...",style=rounded];
    "awk" [shape=octagon];
    "bash" -> "debianutils" [color=blue,label="(>= 2.15)"];
    "debianutils" -> "sensible-utils" [color=blue];
    "bash" -> "dash" [color=purple,style=bold,label="(>= 0.5.5.1-2.2)"];
    "dash" -> "debianutils" [color=blue,label="(>= 2.15)"];
    "dash" -> "dpkg" [color=blue,label="(>= 1.15.0)"];
    "bash" -> "libncurses5" [color=purple,style=bold,label="(>= 5.6+20071006-3)"];
    "libncurses5" -> "libgpm2";
    "bash" -> "bash-completion" [label="(>= 20060301-0)"];
    "bash-completion" -> "bash" [color=blue,label="(>= 3.1dfsg-9)"];
    "bash" [style="setlinewidth(2)"]
    "dpkg" [shape=diamond];
}
I: The following dependencies have been excluded from the graph (skipped):
I: libc6
// Excluded dependencies:
// libc6

intel, lenovo x301 and kernel mode settings

After the latest Xorg upgrade I started experiencing multiple problems concerning the suspend/resume cycle on my laptop. Today I took sometimes off to debug the situation. It seems that the culprit is the activation of the KMS on the XOrg package that landed in unstable in December. The change log witness this change:

xserver-xorg-video-intel (2:2.9.1-2) unstable; urgency=low

  * Upload to unstable.

 -- Julien Cristau <jcristau@debian.org>  Thu, 07 Jan 2010 20:53:45 +0000

xserver-xorg-video-intel (2:2.9.1-1+exp1) experimental; urgency=low

  [ Julien Cristau ]
  * Enable kernel mode setting by default on linux (closes: #555906).

  [ Brice Goglin ]
  * Build against xserver 1.7.

 -- Brice Goglin <bgoglin@debian.org>  Wed, 02 Dec 2009 15:50:17 +0100

now while this is the right thing to do according to bug #555906 , I’m pretty sure this is the cause of my problems.

The ubuntu wiki has a detailed page about KMS, how to enable it and bugs reports. For a start I disabled the KMS adding the following lines to /etc/initramfs-tools/modules :

intel_agp
drm
i915 modeset=0

And regenerate your initramfs (mind that this regenerate the initramfs for the running kernel):

update-initramfs -k `uname -r` -u

With this change I’ve got to the point where I can suspend/resume and switch back to a console if there is a problem. I’ve tested this with the kernel 2.6.31 and 2.6.32-trunk . The funny thing is that it seems the problem is quite random. The first suspend (hw or soft suspend gives the same result) is often ok. the second one usually fails. The logs of the X server do not tell me anything useful as much as the dmesg . To put a cherry on the cake, the iwlgn driver (intel again !) of my wireless card sometimes does not wake up properly (no useful messages again) forcing me to rmmod it and modprobe it back to spin it back to like. Grrr.

So I haven’t actually solved the problem, but maybe somebody will get a bit further reading this enty.

At least now I’ve the ability to switch back to a console and restart gdm.

In other news, since I screwed my grub on friday and I had to fix it somehow with an external boot loader, this is the easiest way I’ve found to create a rescue system on a usb key : http://wiki.debian.org/DebianLive/Howto/USB (using the rescue live CD image).

Easiest as in : “dd the image on the key and be happy”

Update

This is the page of the intel driver : http://www.x.org/wiki/IntelGraphicsDriver Gentoo page (always a good resource) : http://en.gentoo-wiki.com/wiki/Intel_GMA


fakeaptitude

In the same spirit of this blog post http://chistera.yi.org/~adeodato/blog/106_fakeapt.html , this is a simple bash function to simulate an aptitude run on a given status and packages list. We assume yes for all question so to make aptitude not interactive and we assume the flag -f in order to alway try to fix broken universe before trying to satisfy the request.

fakeaptitude() {
    aptitude -s \
        -o APT::Get::List-Cleanup="false" \
        -o Dir::Cache=$aptroot \
        -o Dir::State=$aptroot \
        -o Dir::State::status=$aptroot/status \
        -o Dir::Etc::SourceList=$aptroot/sources.list \
        -o APT::Architecture=amd64 \
        -o Aptitude::CmdLine::Fix-Broken="true" \
        -o Aptitude::CmdLine::Assume-Yes="true" \
        $@
}

initapt() {
  list=$1
  mkdir -p $aptroot/{archives,lists}/partial
  cp status.$list $aptroot/status
  if [ ! -f $list.packages.gz ]; then
    gzip $list.packages
  fi
  cp $list.packages.gz $aptroot/lists/Packages.gz
cat<<EOF > $aptroot/sources.list
deb file:$aptroot/lists/ ./
EOF
fakeaptitude update
}

skype on amd64 (debian unstable)

Date Tags debian

to install skype on a debian unstable machine :

  • get the skype package here http://www.skype.com/go/getskype-linux-ubuntu
  • dpkg -i —force-architecture skype-debian_2.0.0.72-1_i386.deb

now we need to fix a bunch of dependencies: apt-get -f install apt-get install libqt4-core libqt4-gui ia32-libs-gtk get the 32 bit version of libuuid from here : http://packages.debian.org/sid/i386/libuuid1/download copy the library in /usr/lib32

run skype.

blahhhhhh . It used to be easier… Sometimes I really despise myself for using this closed source software.

  • https://wiki.ubuntu.com/SkypeEthics
  • https://help.ubuntu.com/community/Skype