ru Русский

Reticularium

NETWORKS PLACE

Well, I don’t know whether it was a good idea to make init scripts systems have dependencies, it had been perfectly simple and straightforward in FHS. And anyone could place scripts in needed order. Seems unnecessary automation to me, and KISS principle violation.

But what happened happened, and we have to live with it. Once it was a simple task to write a init script: just trivial case $1 in start) ;; stop) and so on. What we have now is a complete mess. If you google “missing LSB tags and overrides”, you’ll get the idea. Every init script needs special LSB headers now, but a lot of software just links some internal script to /etc/init.d during the install process, and there is no LSB headers. So you get a lot of complains from e.g. modern Debians and Ubuntus each time you install some package and even installation failures. Might be bad implementation though (insserv). Anyways, fortunately there is a good workaround (bad workaround that is often recommended being to uninstall insserv).

Just put the code below to an override file /etc/insserv/overrides/your_real_script_name

1
2
3
4
5
6
7
### BEGIN INIT INFO
# Provides:          your_init_script_name
# Default-Start:     2 3 5
# Default-Stop:      0 1 6
# Required-Start:
# Required-Stop:
### END INIT INFO

Note one thing that is not obvious: the name of the override file must be the same as your real script name, but inside the file the header “Provides:” must point to the init script name. Normally it is the same name, but in case you have symlinked a real file to /etc/init.d, and the symlink has a different name, it needs to be done like this, otherwise won’t work.

Taken from the Fedora forum

..........

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#modprobe dm-mod
#vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2
# vgchange -a y VolGroup00
# lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
. . .
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
# mkdir /mnt/VolGroup00/01
# mount /dev/VolGroup00/LogVol01 /mnt/VolGroup00/01

Reference the man pages for lvm, pvdisplay, vgdisplay, lvcreate, lvdisplay, lvextend

..........

As you can see, you need two things: dm-mod kernel module and LVM2 package (apt-get install lvm2 on Debian, emerge lvm2 on Gentoo and so on)

My personal note: LVM provides several useful features but has one huge drawback. If your disk or file system crashes, you won’t be able to access your LVM partitions using any liveCD. At least I don’t know any that would have both dm-mod module and LVM2 package.

This is a really annoying problem we meet pretty often. You can meet it even if you don’t use Bash. For example, you upload an image named “my lovely cat.jpg” to your website and find no image there. Or it has no thumbnail. This may happen because you are using some program for making thumbnails that is being called from, say, PHP via backtick operator (that is, using unix shell) and that program interprets the file name passed to it as three different command line options: my, lovely and cat.jpg.

Read the article

I was doing a simple test of pwgen (handy utility to generate passwords) and since this test was creating a lot of files in a folder I decided to combine it with a test of ls speed vs find speed:

Read the article

For some reason there is no obvious way to enable it (Gnome 2.26.3)

  1. Open GConf editor: Applications -> System Tools -> Configuration Editor
  2. apps -> metacity -> general -> compositing manager (check box there)

That’s all. Enjoy numerous visual effects like shadows, real transparency (underlying windows become visible) etc.

If you (like me) use mplayer to play music, you might want to make it possible to play songs in random order. Here is a simple script for this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash

tempfile=/tmp/randplay-$$
touch $tempfile
trap 'rm -f $tempfile; exit' 0
trap 'rm -f $tempfile; exit' 3
trap 'rm -f $tempfile; exit' 15

songsdir="${1}"
# Remove the finding playlist condition below if you want the list of files to be regenerated each time
# you run the script. This is useful if the content is changing often, but delays the script startup.
# You can also simply remove file m.playlist from the folder if its content changes. 
if [ -f "${songsdir}/m.playlist" ]
then
  echo "Playlist found!"
else
  n=1
  OFS=$IFS
  IFS='
'
  for song in `ls "${songsdir}"`
  do 
    echo "$n ${song}" >> "${songsdir}/m.playlist"
    n=`expr $n + 1`
  done
  IFS=$OFS
fi
songstotal=`cat "${songsdir}/m.playlist" | wc -l`
while true
do
  echo ">>> `cat ${tempfile}|wc -l`"
  sleep 1
  a=$RANDOM
  songsnumber=`expr $a - $a / $songstotal \* $songstotal`
  [ `cat ${tempfile} | grep -c ^${songsnumber}$` -gt 0 ] && echo "Skipping `grep "^$songsnumber" "${songsdir}/m.playlist" | sed "s|^$songsnumber ||"`" && continue
  echo ${songsnumber} >> ${tempfile}
  songname=`grep "^$songsnumber" "${songsdir}/m.playlist" | sed "s|^$songsnumber ||"`
  mplayer -quiet "${songsdir}/${songname}"
  [ $? -ne 0 ] && exit 0
done

The syntax is simple:
<script name> <folder>
Use ESC-ESC or PgUp to skip, Ctrl-C to stop.

There is the command eval available, that does the trick:

Read the article

To make possible managing your system clock on Xen VPS server:


sysctl -w xen.independent_wallclock=1

or:


echo 1 > /proc/sys/xen/independent_wallclock

Vi commands reference, excerpted from the documentation. I’ve been using vi for years, but it’s still a very exciting reading for me (kind of “wow! It’s just that simple!”)

Read the article

[fglrx:firegl_init_module] ERROR firegl_stub_register failed

Looks awful, but it’s simple. It means one of the following:

  1. Another module is already loaded (e.g. radeon.ko)
  2. Module drm.ko is loaded (it always is, if 1)
  3. Under some circumstances CONFIG_AGP=y interferes with AGP support compiled in fglrx (should be more detailed description here)