jump to navigation

/var/lib/dpkg/status and invalid character in revision June 27, 2011

Posted by maxmil in : Debian , add a comment

This error appears often in my system related to the names of virtualbox packages.

The current release of virtualbox packages no longer have this problem however the old packages are not removed from the status file.

The only solution seems to be to modify the status file by hand and remove the packages.

Another solution is to use this script written by Julien Valroff that clears purged packages from your status file.

Thankyou Julien.

Using apt with an http proxy June 7, 2011

Posted by maxmil in : Debian , add a comment

First export http_proxy environmental variable.

sudo export http_proxy=http://uname:pass@proxy:port

apt / aptitude will now use that proxy.

Find out which process is listening on a given port May 9, 2011

Posted by maxmil in : Debian , add a comment

In GNU land, for port 123 this goes like
lsof -i :123

Or on Windows

netstat -aon | findstr 123 (get the process id)
tasklist | findstr processId

Setting up developer permissions on apache February 26, 2010

Posted by maxmil in : Apache,Debian , add a comment

I’m administrating a small server that hosts various web sites on an apache. Each web site has a group of developers who update their sites via ssh or sftp.

I needed to set up their permissions so that only the developers of each site and the apache user (www-data) could modify their sites files.

Each site is in a different sub directory of /var/www.

Initially, for each site, i created a group, put the developers of the site and the apache user in this group and gave the owner and group read and write permission on all the files.

This worked fine until a developer added files to the site since the new files were created with the developers principal group which meant the other developers could not edit the file.

Since each developer can be working on more than one site i could not just change the developers group.

However chmod g+s came to my rescue. This forces the all files created in each site to have the same group as the top level directory of the site.

Great.

However i still had a problem. The default umask for the developers that connected to the server was 022 which meant that even though the new files they created had the correct group the group only had read access to the files :(

With ssh connections changing the default umask was easy. I could do it in /etc/profile for the whole system or in ~/.profile for each user.

However when they connected via sftp this had no effect.

I think that the correct way to set up the default umask is using pam but after trying all sorts of configurations i couldn’t get it to work.

In the end the solution was to modify the line in /etc/ssh/sshd_config that started the stfp server.

#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp /opt/sftp-server-wrapper.sh

and create a wrapper script /opt/sftp-server-wrapper.sh

umask 0002
exec /usr/lib/openssh/sftp-server

Don’t forget to add execution permissions to the wrapper script, otherwise sftp just fails silently!

This works but if anyone out there has a cleaner solution i would be very happy to hear it!

Using spaces in fstab August 6, 2009

Posted by maxmil in : Debian , add a comment

I frequently have to mount windows file systems that have spaces in their names.

If you put something like//path/to/windows/file system /local/mount/pointin ftstab it complains with

line XX in /etc/fstab is bad

The solution is to use the escape code \040 instead of the space//path/to/windows/file\040system /local/mount/point

Extract audio from avi using mplayer March 17, 2009

Posted by maxmil in : audio,Debian , add a comment

mplayer -vo null -ao pcm:file=audiofile.wav videofile.avi

Convert otf to ttf March 4, 2009

Posted by maxmil in : Debian,Utils , 1 comment so far

Using fontforge (available in main debian repository) create the script otf2ttf.sh:

#!/usr/bin/fontforge
# Quick and dirty hack: converts a font to truetype (.ttf)
Print("Opening "+$1);
Open($1);
Print("Saving "+$1:r+".ttf");
Generate($1:r+".ttf");
Quit(0);

Now pass as parameter to fontforge

fontforge -script otf2ttf.sh fontName.otf

To process a directory of fonts:

for i in *.otf; do fontforge -script otf2ttf.sh $i; done

This info was found here

Command line copying with xsel February 11, 2009

Posted by maxmil in : Debian,XWindows , add a comment

Useful for copying stuff from the command line directly into the clipboard (context menu > copy, equivalent to Ctrl+C) in order to be pasted in other XWindow apps.

Example

$ cat some-file | xsel -b

There is a similar command xclip that does more or less the same stuff except i don’t think it only copies to the primary clipboard (ie updates the selected text that can be pasted with the middle mouse button).

Both can be installed on Debian with apt-get xsel xclip.

Installing JDK 6 Update 10 on debian Lenny November 17, 2008

Posted by maxmil in : Debian,Java , 3 comments

At the time of writing both the JRE and JDK 6 Update 10 have been released for over a month but are not available on the non-free branch of the official debian testing repositories. I imagine that this is because Lenny is about to go stable and the maintainers are not accepting new versions, only bug fixes.

This is a shame because Update 10 includes a major revamping of client side Java with new look and feels and much improved applets.

Being impatient i wanted to try this out.

Normally to install sun binaries as debian packages i use java-package which nicely prepares a .deb file that i can use dpkg to install. The advantage of this technique is that the new package integrates nicely with the overall system allowing you to use update-alternatives etc.

However, trying this, i found that java-package has not been updated to handle Update 10 either. The problem seems to be that it only works with versions 6 Update X where X is one single digit.

More info can be found here http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=504778

For my architecture the solution was to add this to /usr/share/java-package/sun-j2sdk.sh
"jdk-6u10-linux-i586.bin") # SUPPORTED
j2se_version=1.6.0+update10${revision}
j2se_expected_min_size=130
found=true
;;

just after
"jdk-6u"[0-9]"-linux-i586.bin") # SUPPORTED
j2se_version=1.6.0+update${archive_name:6:1}${revision}
j2se_expected_min_size=130
found=true
;;

My architecture is i586, modify this according to yours.

Then, as usuall to prepare, install and set as default.
$ fakeroot make-jpkg jdk-6u10-linux-i586.bin
$ sudo dpkg -i sun-j2sdk1.6_1.6.0+update10_i386.deb
$ sudo update-alternatives java --config

I then wanted to try the new draggable applet feature. So i went to http://java.sun.com/developer/technicalArticles/javase/6u10_applets/ but the demo didn’t work and whats more the page told me that i didn’t have update 10 installed.

However my browser definitely is running the update 10 plugin, as verified on this site.

Could it be because i’m running iceweasel and not firefox?

Getting hibernate and suspend to work from gnome power applet November 8, 2008

Posted by maxmil in : Debian , add a comment

After tweaking HAL this already worked for me on the command line using pm-hibernate and pm-suspend as root.

However to work from the gnome power applet you need it to work for your user. This was achieved by adding the user to the group powerdev