Building RPM with Docker images


For an internal project at work I have been thinking about more how to generate RPMs out of our CI. I wanted to have them produced as artifacts of the build so I can test how if they can be installed and properly working with some smoketests.

Since we are using Docker for most of the things in our CI, I have been thinking about more about how to do that with docker images and RPM.

Ideally what I would love to have from RPM is to be able to integrate with Docker so when you build your RPM you are building in a docker images. Basically the %prep section will be spined-up in a special docker images and the rpm output would be back to the host.

The advantages outside of making sure you are building your RPMs in a confined and reproducible enthronement is that you would be able to say from the same rpm build that I want to build the RPMs for centos/fedora/rhel/etc.. in whatever flavours.

I am sure there is some workaround way to do that with chroot and such but it would be nice if this mechanism is built-in inside RPM (be it an abstracted system to do that as chroot/docker or whatever container technology).

Since we are not there yet, I have ended-up just the straightforward way of constructing an image with my build dependences.

It’s a python project which use PBR for generating the version so I have to generate first a tarball in my build directory and get the generated version.

I modify the spec file with that version and start to build the image with the new tarball and new spec file.

I run the image and mount a volume to a local directory on the host and start running the image which run the script in the container.

The script is pretty straightforward, it builds the rpm and copy them to the volume directory as root (since there is no other way) so they can be copied from the host to the artifact output directory.

I could have not copying and uploading to a object storage system (like Swift obviously) but since I needed to be available in the CI I ended-up up with the local file copy system.

Here is my scripts, in SPECS/project.spec and SOURCES/* there is the spec and sources/patches as a standard rpm, the only thing is to make sure to use a %define _version VERSION and use that macro for Version in your spec file.

The main which get run from the CI

The DockerFile which try to be optimised a bit for Docker caching :

and the script that gets run inside the container :

It probably would not fit straight to your environement but at least that may get you the idea.

Howto use backtrack4 from hard disk with Grub2

If you want to boot backtrack4 from time to time on your Linux desktop/laptop but don’t want to carry it on a USB drive (or CDROM) on you then this guide may help.

I am using Debian unstable on my laptop but I am sure you can adapt it to anything you want. I am using another partition (/dev/sda6) as my backtrack partition but it’s possible to copy the full thing in / as well on your main partition.

Download backtrack4 from backtrack website :

  • mount the iso image locally :

sudo mount -o loop bt4-final.iso /mnt

  • copy the content of the iso to the root of the chosen partition (mounted in /media/part6 for me) :

cd /mnt;sudo rsync –progress -avu * /media/part6/

  • Configure grub :

sudo su –
cat < /etc/grub.d/50_Backtrack
exec tail -n +3 $0
menuentry “Backtrack” {
linux (hd0,6)/boot/vmlinuz BOOT=casper boot=casper nopersistent rw quiet vga=0x317
initrd (hd0,6)/boot/initrd.gz
chmod +x /etc/grub.d/50_Backtrack

  • Update grub

sudo update-grub

And you should be able to boot the Backtrack menu, make sure this point to the right partition for me it’s (hd0,6) because my backtrack copied CD is on /dev/sda6 but your mileage may differ.

XMPP notification for irssi running in a screen on a remote host

Like a lot of people I have my irssi on a server in a screen. This has
been working great so far but my only concerns are the notifications
on the desktop when something happening.

Over the time I have found some different solution with mitigated
results for me :

– Use fanotify script with the libnotify-bin and SSH like mentioned here.

– Setup your irssi (or other) as irc proxy bouncer and connect with
your desktop client (like xchat) to get notification.

The fanotify is kind of very hacky on a laptop with intermittent
connection and having a cron doing a ssh every minutes or so is not
ideal, not talking about no passphrase ssh key or having to snoop the
SSH_AGENT variable to connect without password.

The via proxy method is not my thing and I don’t feel like having
xchat open all the time just for it and I anyway usually forget to
launch it.

My solution is to have a plugin for irssi notify me via XMPP if there
is a direct message addressed to me. I usually get my pidgin or gmail
alway open and if i don’t since it goes to a gmail account I got gmail
sending me an email about it.

You can find all the information about the install and configuration
here :

Vmware vmplayer and kernel 2.6.32

So you have a shiny new linux-2.6.32 kernel installed but your VMPlayer does not work anymore since the vmnet module does not compile by throwing this error :

CC [M] /tmp/vmware-root/modules/vmnet-only/vnetEvent.o
CC [M] /tmp/vmware-root/modules/vmnet-only/vnetUserListener.o
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c: In function ‘VNetUserListenerEventHandler’:
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:240: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:240: error: (Each undeclared identifier is reported only once
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:240: error: for each function it appears in.)
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c: In function ‘VNetUserListenerRead’:
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:282: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:282: error: implicit declaration of function ‘signal_pending’
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:282: error: implicit declaration of function ‘schedule’
make[2]: *** [/tmp/vmware-root/modules/vmnet-only/vnetUserListener.o] Error 1
make[1]: *** [_module_/tmp/vmware-root/modules/vmnet-only] Error 2
make[1]: Leaving directory `/opt/temp/linux-2.6.32′
make: *** [vmnet.ko] Error 2

Just do the following to fix it :

make sure first you have installed the latest vmplayer (VMware-Player-3.0.0-203739.i386.bundle) at this time for me.

  • cd /tmp
  • tar xf /usr/lib/vmware/modules/source/vmnet.tar
  • cd vmnet-only
  • vim vnetUserListener.c
  • go to line 37 (after the last include)
  • add this line #include “compat_sched.h”
  • exit your editor
  • cd /tmp
  • sudo tar cf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only
  • restart vmplayer

When recompiling the kernel module it should get it built properly and working it seems…..

Toshiba Regza 32AV615DB blank screen HDMI Linux

I have this nice Toshiba TV which is connected to a small Linux box which act as a media player. I have been some issue lately the things works fine under the 1920×1800 resolution most of the time. But once in a while I get a blank screen and the nvidia driver telling me this :

(II) Dec 03 17:00:19 NVIDIA(0): “nvidia-auto-select”
(II) Dec 03 17:00:19 NVIDIA(0): Virtual screen size determined to be 640 x 480
(WW) Dec 03 17:00:19 NVIDIA(0): Unable to get display device CRT-0’s EDID; cannot compute DPI
(WW) Dec 03 17:00:19 NVIDIA(0): from CRT-0’s EDID.
(==) Dec 03 17:00:19 NVIDIA(0): DPI set to (75, 75); computed from built-in default
(==) Dec 03 17:00:19 NVIDIA(0): Enabling 32-bit ARGB GLX visuals.
(–) Depth 24 pixmap format is 32 bpp

Spend a long time trying to debug the thing by the software but it seems that the TV has some kind of trouble and if I switch it to another HDMI connection it does detect fine which I do at about every week… not a biggie but still annoying.

Nokia N95 bluetooth teethering with T-Mobile under Linux and Delll Latitude D630

Spent a bit of time to configure my Nokia mobile to teethering wih my Linux and T-Mobile. Here is some steps that may help the others :

  • If you don’t have that blue bluetooth led switched on on your Dell Latitude D630 Laptop you have to enable it. I haven’t find any way to do that via the Linux Kernel module but with Windows under Vmware Player (3.0) enabling Bluetooth and installing the driver (manually not via the setup.exe) enabled bluetooth.
  • Switched on bluetooth on the Phone and attached to the laptop via gnome bluetooth applet thingy.
  • Get my phone device number from hcitool scan.
  • And did this (as root) :

cat </etc/bluetooth/rfcomm.conf
# RFCOMM configuration file.

rfcomm0 {
# Automatically bind the device at startup
bind yes;

# Bluetooth address of the device

# RFCOMM channel for the connection
channel 4;

# Description of the connection
comment “Nokia N95”;

/etc/init.d/bluetooth restart

cat </etc/ppp/chat-tmobile
SAY ‘Calling t-mobile…\n’
“” ‘ATZ’
OK ‘ATE0V1&D2&C1S0=0+IFC=2,2’
SAY ‘Modem reset.\n’
SAY ‘Setting APN…’
OK ‘AT+cgdcont=1,”IP”,””‘
SAY ‘APN set\n’
SAY ‘Dialling…\n’
OK ‘ATDT*99#’

cat </etc/ppp/peers/t-mobile
idle 7200
user “user”
password “pass”
ipcp-restart 10
lcp-echo-interval 65535
lcp-echo-failure 10
lcp-max-configure 10
connect “/usr/sbin/chat -v -f /etc/ppp/chat-tmobile”

Under Debian distros you can enable the connection with the command ‘pon t-mobile’ or you for the others can do via the manual way with the command ‘pppd call t-mobile’.