Geek Lair

Archive for the ‘Ubuntu’ Category

Ubuntu Lucid: Disable services from starting up during boot time

with one comment

I use MySql only occasionally on my Ubuntu Lucid Lynx (10.04) install. As such, I didn’t want the mysql server starting up automatically during boot process. There must be a better way of disabling a service, but this is what worked for me:

Ubuntu now uses Upstart to startup services during boot time. The config files for the services are in /etc/init and they all have filenames ending in .conf.

The config files have a “start on” section which will have events on which the service should start. Commenting out that section prevents the service from starting automatically.

If you want to disable a service, say mysql, edit its config file – /etc/init/mysql.conf.

Change this:

start on (net-device-up
    and local-filesystems
    and runlevel [2345])
stop on runlevel [016]

to this:

#start on (net-device-up
#    and local-filesystems
#    and runlevel [2345])
stop on runlevel [016]

Reboot.

To see the status of the Upstart jobs run this command:

initctl list

The output should look something like this:

alsa-mixer-save stop/waiting
avahi-daemon start/running, process 1061
mountall-net stop/waiting
nmbd stop/waiting
rc stop/waiting
rsyslog start/running, process 1046
.
.
mysql stop/waiting
.
.

Since the “start on” section was commented out in /etc/init/mysql.conf, the mysql job status will show up as “stop/waiting”

To start the mysql server manually, use the start command:

sudo start mysql

Now if you run the command initctl list, the mysql job will be in running status:

alsa-mixer-save stop/waiting
avahi-daemon start/running, process 1061
mountall-net stop/waiting
nmbd stop/waiting
rc stop/waiting
rsyslog start/running, process 1046
.
.
mysql start/running, process 9462
.
.

To stop the mysql server, use the stop command:

sudo stop mysql

Advertisements

Written by anonir

August 9, 2010 at 23:28

Posted in Linux, Ubuntu

Tagged with , , ,

Ubuntu Lucid: Disable boot splash

with 4 comments

When you boot into Ubuntu Lucid Lynx (10.04), you only get a splash screen. You can’t see the boot messages. To disable the splash and show the boot messages, you need to edit grub.

Note: If you had upgraded from an earlier Ubuntu version, you might still be having the older grub version. See this guide to upgrade to grub2.

Open /etc/default/grub for editing and remove “quiet splash” options from the GRUB_CMDLINE_LINUX_DEFAULT property.

For example, if your grub has this line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Change it to this:

GRUB_CMDLINE_LINUX_DEFAULT=""

Then run this command to update grub2:

sudo update-grub

Written by anonir

August 8, 2010 at 12:26

Posted in Linux, Ubuntu

Tagged with , , ,

Ubuntu Karmic: 5.1 sound on external sound card

with one comment

Most laptops usually come with stereo audio output. I bought an external USB 5.1 channel sound card and was trying to get 5.1 sound out of it. By default in Ubuntu 9.10, pulseaudio is configured to output stereo. It doesn’t automatically switch to 5.1 if a sound card which supports it is connected. Here is how I got 5.1 audio output through my external sound card:

First edit /etc/pulse/daemon.conf and uncomment this line (delete the ; before the line):

default-sample-channels = 6

Restart. Now if your external sound card is plugged in, pulseaudio will enable 5.1 output on it. All you need to do is go to sound preferences (System -> Preferences -> Sound) and select 5.1 profile for the external sound card in the Hardware tab:

5.1 profile in sound preferences

5.1 profile in sound preferences

and select the external sound card as default output device:

Default output device

Default output device

If your external sound card was not connected while Ubuntu starts, pulseaudio defaults to stereo as the integrated sound card in the laptop is stereo. Now if you connect the sound card, 5.1 options are not available. Only stereo is available:

stereo profile in sound preferences

stereo profile in sound preferences

You have to restart pulseaudio for it to enable 5.1 output. Kill pulseaudio with this command:

pulseaudio -k

In my Ubuntu installation, when I kill pulseaudio, it starts again automatically. If it doesn’t do so, start pulseaudio with this command:

pulseaudio -D

Once pulseaudio restarts, it should have enabled 5.1 output.

Written by anonir

February 17, 2010 at 21:51

Posted in Ubuntu

Tagged with , , ,

mplayer plugin for Firefox in Ubuntu Karmic

with one comment

By default, Firefox in Ubuntu uses totem to play video files. If you want to use mplayer instead, do this:

1. Uninstall the totem plugin:

sudo apt-get remove totem-mozilla

2. My Ubuntu installation also had a gecko mediaplayer plugin. Remove it:

sudo apt-get remove gecko-mediaplayer

3. Install mplayer plugin:

sudo apt-get install mozilla-mplayer

Now enjoy mplayer on your Firefox.

Written by anonir

February 5, 2010 at 20:20

Posted in Ubuntu

Tagged with , ,

Gnome Do startup problem

with 3 comments

If you have added Gnome-do to Startup Applications, sometimes after you login in Ubuntu and launch Gnome-do application selector, it doesn’t work. The issue seems to be that Gnome-do depends on some other program which needs to start first before Gnome-do starts. The issue can be fixed by wrapping the gnome-do command in a shell script which adds some delay¬† and adding that script to Startup Applications instead of gnome-do:


!/bin/bash

sleep 10
gnome-do

Save it to your $HOME/bin folder and add it to Startup Applications

Add gnome-do wrapper to startup

Written by anonir

February 5, 2010 at 00:58

Posted in Ubuntu

Tagged with ,

bash and cron

leave a comment »

Setting up cron in Ubuntu is simple enough as described in the Ubuntu wiki. But what they don’t mention is that by default cron uses /bin/sh for its SHELL env variable. That may cause a problem if you try to set up a bash script in cron. To prevent that from happening, you need to define the SHELL variable for your user crontab to point to /bin/bash.

In the console type:

crontab -e

Add the following line at the top:

SHELL=/bin/bash

Your crontab should look something like this:

SHELL=/bin/bash
# m h  dom mon dow   command
*/5 * * * * /usr/local/bin/my_bash_script

Written by anonir

October 13, 2009 at 15:45

Posted in bash, Linux, Ubuntu

Tagged with ,