Posts Tagged ‘linux’

How to keep APT from reinstalling custom packages (Ubuntu)

Tuesday, March 31st, 2009

A few weeks ago, I finally got around to upgrading my Ubuntu desktop to Hardy Heron. Like many others, I found that the cursor in gnome-terminal had inexplicably started blinking again, and there was no longer a preference to disable it. Fortunately, finding a fix was easy. Applying the patch and rebuilding the .deb package was even easier. But after installing the patched package, the update-notifier immediately informed me that there was one update available: gnome-terminal. It seems that APT prefers packages in the repository over locally installed packages.

I ignored this for a while, and just dealt with the “updates available” icon always being in the notification area. I tried searching google several times, and eventually came across this forum post, which led to this article containing the answer I was looking for.

I could probably just pin gnome-terminal, but I want to make sure I get any future updates for it. I decided the easiest way to fix this annoyance was by appending a short string (+noblink) to the version.

First, fetch the source and update the version:

$ apt-get source gnome-terminal
$ cd gnome-terminal-2.22.1
$ debchange -v 2.22.1-0ubuntu2+noblink

At this point, the default editor will open the debian/changelog file so you can describe the change. Enter a short comment, like “disable the blinkin cursor”, save the file and exit the editor.

Next, patch the source. Jay Cornwall’s patch is not currently on-line, but it’s a simple fix: just edit src/terminal-screen.c and change this line

terminal_widget_set_cursor_blinks (screen->priv->term, blink);

to this

terminal_widget_set_cursor_blinks (screen->priv->term, FALSE);

Finally, build and install the package:

$ debuild -rfakeroot binary
$ sudo dpkg -i ../gnome-terminal*.deb

Starting a New X Server

Sunday, February 22nd, 2009

This is one of those posts that is mostly for me, so the next time I need to do this I don’t have to spend 30 minutes googling obscure config file formats. (Incidentally, I had to google and muck with styles for at least 30 minutes to figure out how to keep wordpress from mangling my code snippets.)

I sometimes find it useful to start an extra X server to run a particular application. Full-screen games are a good example. Ordinarily, a full-screen game grabs the display and there is no way to switch back to the desktop without exiting the game completely. When run in its own X server though, it is easy to switch between servers. The following shell script shows how to do this:

#!/bin/bash

display=:1
authfile=$HOME/.Xauthority

if ! xauth list "$display" | grep "$display " >/dev/null 2>&1; then
    xauth add $display . `mcookie`
    removelist="$display"
fi

xinit /usr/bin/xterm -- $display -auth $authfile -nolisten tcp

if [ -n "$removelist" ] ; then
    xauth remove $removelist
fi

This script will start a new X server on the next available virtual terminal (normally vt8) using display :1 and launch an xterm. Toggle between the servers using ctrl-alt-F7 and ctrl-alt-F8. When the xterm exits, so does the X server.

If you try to run this code on a Debian-based system, though, you will get the following error:

X: user not authorized to run the X server, aborting.
xinit:  Server error.

I found this out the hard way when I started using ubuntu. This is because Debian uses a wrapper to start the X server, which enforces tighter security constraints by default. To get this to work, you will need to edit the /etc/X11/Xwrapper.config file, and change this line:

allowed_users=console

to this:

allowed_users=anybody

Check the man page for Xwrapper.config for more options; there aren’t very many. Personally, I don’t consider this a security risk for a single-user home system.


Copyright © 2017 jlogday.com. All Rights Reserved.
No computers were harmed in the 0.732 seconds it took to produce this page.

Designed/Developed by Lloyd Armbrust & hot, fresh, coffee.