Making a shared data folder in Linux

February 15, 2008 on 11:35 am | In Linux | No Comments

I wanted to set the file permissions properly on our shared music folder (accessed by Samba/scp/directly on the computer by different users). Basically, I want anyone in the ‘data’ group able to read and write everything.

First, I created the data group.
sudo groupadd data

Then I edited /etc/group and made all the relevant users members of that group
data:x:1002:user1,user2

Then I set the ownership and permissions on the directory using the following script. One note is that the last line sets the ’setgid’ permission on the directories (chmod g+s ...) which makes the permissions ’sticky’.

#!/bin/bash

DIR=/data/music

echo "Changing Group ownership to 'data'"
chgrp -R data $DIR
echo "Changing permissions of files to ug=rw,a=r"
chmod -R 664 $DIR
echo "Changing permissions of directories to a+rx, g+rwx, g+s"
find $DIR -type d -exec chmod a+rx,g+rwx,g+s '{}' \;

Now set the umask so that the group gets write permission by default. In /etc/profile:
umask 002

Finally, set the same permissions in Samba too. In /etc/samba/smb.conf:

[data]
path = /data
available = yes
browsable = yes
public = yes
writable = yes
create mask = 664
directory mask = 775

Now files and directories are created group-writable.

drwxrwsr-x 2 user1 data 4096 2008-02-15 11:29 temp
-rw-rw-r-- 1 user1 data    0 2008-02-15 11:29 test

Update:

When you copy files via scp, the umask is not set properly because the bash doesn’t read startup files in this situation.

In order to get scp to set the umask properly, you need to add umask 002 to /etc/default/ssh (in Debian/Ubuntu, on Redhat-derived systems try /etc/sysconfig/sshd).

This will set the 002 umask for all users. If you want something more fine-grained you’ll need a more complex solution.

How to fix VLC crash on startup in Gutsy

February 14, 2008 on 7:51 pm | In Linux | No Comments

IN Ubuntu Gutsy, when I tried to run the VLC it would crash (segfault) complaining of  “double free or corruption” in g_slice_alloc().

The problem is actually in the underlying WxGTK library that VLC uses for the user interface. It was a bug that didn’t cause any problems until some non-standard memory allocation function was fixed in glib and exposed the mis-use of this function in some applications. It also affects WxGlade and even the Gimp apparently.

Anyway, it’s dead easy to fix. Put the following in your environment:

G_SLICE=always-malloc

i.e.

Add
G_SLICE=always-malloc
to /etc/environment or

export G_SLICE=always-malloc
to ~/.bash_profile and/or ~/.gnomerc.

More old virtual machines

February 12, 2008 on 9:10 pm | In Linux | 2 Comments

After my adventures with RedHat 7.2 in VMWare, I decided to make a redistributable VM that was more or less compatible. The main reason is that VMWare Player is not available out-of-the-box on Ubuntu Gutsy (that’s what you get for messing with proprietary freebies!). Instead, I’ve been playing with the open source rather excellent VirtualBox virtualization software.

Actually, the first thing I did was convert my RH7.2 VMWare image into a VirtualBox image. Through the magic of qemu-img I first converted it to a raw disk image: (In fact, you can use a VMWare .vmdk file directly in VirtualBox, but you won’t get some of the fancier features like snapshots.)
qemu-img convert redhat72.vmdk redhat72.bin

Then I used a VirtualBox tool to convert the raw image into the “vdi” VirtualBox format (you might need a lot of disk space for this step):

vboxmanage convertdd redhat72.bin redhat72.vdi

That image worked fine in VirtualBox (noticably slower than VMWare though, even with the vboxdrv kernel module loaded.) When it first loaded, the RedHat hardware utility kudzu discovered the changes in virtual hardware and set everything up with no problems.

I also created a CentOS 2 virtual machine for VirtualBox. CentOS 2 is a clone of RedHat Advanced Server 2.1, built from source with the RedHat trademarks removed and therefore it is permissible to redistribute it. This OS is very similar in vintage to RedHat 7.2, and most statically compiled programs will work on both platforms (which is what I need it for)

As per my VMWare image, I have installed subversion (3.4.2 from source, works with svn+ssh:// protocol but probably not for https://); GCC v3.4.6; Boost v3.4.1; and GSL v1.9. The source directories are in /root/temp/installation.tar.bz2. I also updated the OS using yum to get the final version of all the packages. I don’t think that CentOS 2 is still being updated though, so this is really not a safe OS to have on your network.

After installing I ran vboxmanage modifyvdi centos2.vdi compact which doesn’t do anything at all on it’s own. Apparently it only shrinks zeroed sectors, so first you need to run
dd if=/dev/zero of=filler
then
rm filler
then the modifydvi command again. This got it down to 2GB.

Anyway, if you’re looking for a virtual machine that’s 100% compatible with RedHat AS 2.1 and 95% compatible with RedHat Linux 7.x, you can download the VDI image for VirtualBox here. The root password is ‘centos2′ and the file weighs in at 560MB.

Undistract v0.2

December 17, 2007 on 8:25 pm | In Code, Linux | No Comments

I have posted a version 0.2 of my attention monitoring software “Undistract”. This release features the following changes:


  • Uses libnotify instead of xosd, which looks a lot better in GNOME
    at least and should work fine cross-desktop.

  • The most drastic action is now to minimize the distracting window
    rather than change virtual desktops, which was quite specific to my
    desktop usage. I have tried to manage the focus with this change too,
    so that the user doesn’t inadvertently send key presses to a different
    window.

  • Uses GTK event loop which makes monitoring a lot more efficient.

  • More sophisticated usage of libwnck to determine which windows are
    active at whether they belong to a distracting application.

  • Simplified some of the code and tried to de-jargonize the config file.

You can download it at http://code.ultrahigh.org/undistract

Wengophone: What’s My SIP Address?

December 14, 2007 on 5:14 pm | In Linux, Voice Over IP | No Comments

I’ve been using the ever-so-useable WengoPhone VOIP software, and I wanted to see if there was a public SIP address that i could provide to people on other SIP networks. Well, it took me a while to figure out, but there is. Just enter sip:username@voip.wengo.fr into any SIP phone and you’ll be cooking on gas. I tested this from Ekiga running on another computer and Wengo received the call just like normal.

BTW my Wengo username is ‘werkshy’.

Quickfix: libroot-python-dev for Ubuntu Gutsy

December 4, 2007 on 10:45 am | In Linux, ROOT | 1 Comment

Since my last post on building ROOT packages for Ubuntu the resourceful Christian Holm Christensen has got the unofficial Debian/Ubuntu ROOT repository back online. One problem is that due to a dh_python bug in Ubuntu, the libroot-python-dev package (required for PyROOT) is broken for Gutsy (and probably Feisty too), since it depends on python < 2.5. I've hacked the 'control' file to remove that broken dependency and repacked the .deb file to make a package that is installable and doesn't break apt.

Download it here:
libroot-python-dev_5.17.05-3-quickfix_i386.deb

Steps to create this:

  • Get the libroot-python-dev package from the repository
    wget http://mirror.phy.bnl.gov/debian-root/...
    ubuntu/pool/main/r/root-system/libroot-python-dev_5.17.05-3_i386.deb
  • Unpack the .deb
    ar -x libroot-python-dev_5.17.05-3_i386.deb
  • Unpack the control data:
    tar -zxf control.tar.gz
  • Edit the file ‘control’ to fix the dependencies and bump the version number
  • Repack control data:
    tar -zxf control.tar.gz control md5sums postinst prerm
  • Repack the .deb
    ar -r libroot-python-dev_5.17.05-3-quickfix_i386.deb debian-binary control.tar.gz data.tar.gz

I hope to help fix the underlying issue soon but right I’ve got a ton of thesis-related work to plough through so this band-aid will have to do for now.

Update 2007-12-11:
I spent a morning last week tracking down this ROOT Python bug. Turns out there was a file not being deleted during the ‘clean’ stage of the debian package creation which led to a dependency confusion with python versions. New source packages have been uploaded which fix this issue:
deb-src http://mirror.phy.bnl.gov/debian-root unstable main contrib

Binary packages should be up shortly.

Making Pretty ROOT Color Palettes

August 20, 2007 on 12:05 pm | In Physics, ROOT | 8 Comments

My friend and colleague (I like him even more since he told me about this!) Segev gave me this information, which he had gleaned from some old posts on ROOTtalk and a lot of experimentation. It’s a technique for setting the color palette of ROOT plots so that, for example, Graph2D with the “COLZ” option doesn’t look like total crap. I have no idea why something like this isn’t used as the default palette in ROOT.

In short, here’s before and after screenshots of the plot.

Default PaletteBefore
New PaletteAfter

Continue reading Making Pretty ROOT Color Palettes…

Building ROOT Packages on Ubuntu Feisty

August 17, 2007 on 12:01 pm | In Linux, Physics, ROOT | 3 Comments

I read with satisfaction the fact that Cern’s ROOT physics and data analysis framework has finally been integrated into Debian. I assumed that this would lead to easier installation on Ubuntu and in the future, hopefully, ROOT in the Ubuntu repositories. For a brief and happy period there was a third party repository with up-to-date and semi-official ROOT packages.

My hopes were dashed with the news that the Brookhaven machine hosting the repository lost a hard disk and the Ubuntu repository was down. I frequently need access to ROOT packages, so I just recently built .debs from the lastest stable release (5.16.00). Here’s a guide as to how to make it work:

Continue reading Building ROOT Packages on Ubuntu Feisty…

Creating a RedHat 7.2 VMWare Image

August 6, 2007 on 6:51 pm | In Linux | 11 Comments

Update: I have created a CentOS 2 virtual machine image for
VirtualBox which is available for download

I’ve created a VMWare image of a RedHat 7.2 operating system. I need one for compiling and testing programs since a cluster that I sometimes use runs this aging OS, and programs that I compile on my Ubuntu laptop or the Fedora Core 6 server at the lab don’t work properly on that system.

I would love to redistribute the base image for other people who might require it but unfortunately Red Hat’s trademark protection policy prevents this. I don’t have time to go through the image and remove all the trademark-covered files, so here’s a quick guide to getting a useful system in a short time. By useful, I mean with Subversion, GSL and Boost libraries.
Continue reading Creating a RedHat 7.2 VMWare Image…

Scaling ROOT PostScript Files

May 25, 2007 on 12:33 pm | In Linux, ROOT | No Comments

I encountered some trouble today printing PostScript files from ROOT at smaller sizes. This is most useful to me because my lab notebook, heretically, is smaller than ‘letter’ size, which I find more convenient for carrying than the huge squared notebooks which seem to be the norm around here. I was looking for a quick way of printing PostScript at 80% scale.
Continue reading Scaling ROOT PostScript Files…

« Previous PageNext Page »

Powered by WordPress with theme based on Pool by Borja Fernandez.
Feeds: Entries and comments. Valid XHTML and CSS. ^Top^
Page required 25 queries and took 0.212 seconds.