Stream of Ry

Yet Another Geek In The World

Linux startup process from 30k-feet high

leave a comment>>

Here’s a nice explanation of the (Debian) boot process (from the Debian Administration)

There are a lot of misconceptions voiced here about the sysvinit system. It is complex because it HAS to be. To quote Eistein, “Make things as simple as possible, and no simpler.”

Sysvinit is the best way known to manage all the complexity involved in making any combination of the 10,000+ Debian packages load the various daemons they need, in the order they need, only to the extent they are installed, and have them all work smoothly together. The older BSD init system was simpler, but less capable– the init scripts had to be edited for every package you added that needed to start at boot time, and the order was always a potential source of a problem. That is why most Linux distributions use sysvinit– it has proven its value over many years.

Each package that needs to load at a certain runlevel puts one script in /etc/init.d, usually named with the package name. This allows you to start, stop, restart, reload, etc. it by typing “/etc/init.d/mypackage start” (or stop or reload or whatever). If you write a script, use others as a template, and change what you need to change. Test the script by typing these commands manually (probably at a root shell). If the script works properly here, it should work in runlevels. However, to answer the last plea for help, this script does NOT start anything automatically at ANY runlevel. We still need one more thing for that.

To do that, we create symlinks to these scripts in the various runlevel directories. For example, if we normally run at runlevel 2 (as Debian does by default) and we want mypackage to run as start, then create two links in /etc/rc2.d, one named S99mypackage and one named K99mypackage. S means Start, and K means Kill (stop) the process. When the system goes into runlevel 2, all the start links in /etc/rc2.d will be run one after another. The 99 tells the system WHEN it should be run– they run in numerical order from 01-99 (and in alpha order within those numeric levels, I think). So 99 will be run last, and everything should basically already be up by then, usually a good choice for your personal stuff. But if you want it run before thing1 and after thing2, then pick a more appropriate number. If you want it started first and stopped last, then name the links S01mypackage and K99mypackage. You can also disable the link temporarily by renaming the uppercase S or K to lowercase– only the uppercase letters will be run.

As to “why so many runlevels, if Debian only uses two?”– you can use them any way you want. Runlevel S (or 1) is single-user maintenance mode (which may not even mount your disks). Runlevel 2 (in Debian) is multi-user. Some distributions once used runlevel 3 for networking, or 5 for X windows. Now both (networking and X) seem to be nearly universal, and are not usually put on separate runlevels. But if you want to do that, you can. It’s your system, do what you want. Maybe you have a system needs to be configured differently at home and work, or when the kids are using it. You can set runlevels for these different modes.

If you want the simpler “just run this at boot time” of BSD, just add your script to the /etc/rc.local script which runs after the rest of the boot process is complete. So you CAN have it both ways.

Hope this clears up some of the confusion. I’d say RTFM, but sometimes the manuals are long on detail and short on 30,000 foot-level explanation of the concepts.

Written by rystraum

July 6th, 2010 at 6:10 pm

Apache, MySQL and PHPMyAdmin stuff

leave a comment>>

I finally moved towards native Apache and MySQL installations instead of the usual LAMPP. This way, I can have all the files on my root directory. As usual, this is going to be a dump of all the different workarounds to achieve some functionality.

<All packages (apache2,mysql-server,phpmyadmin) are installed via Synaptic on a Ubuntu 9.10 box>

Apache: Per user htdocs directory
mkdir ~/public_html;
chmod 755 ~/public_html;
sudo a2enmod userdir;
sudo /etc/init.d/apache2 restart;

If you want to change the folder name (not using public_html), you have to change the config file:
/etc/apache2/mods-available/userdir.conf

As always, make a backup of any existing config file first before changing.

MySQL: Resetting the root password to null
sudo /etc/init.d/mysql stop;
sudo mysqld_safe --skip-grant-tables &;
sudo mysql --user=root mysql;

then inside MySQL:
update user set password=PASSWORD("") where User='root';
flush privileges;
exit;

back to terminal:
sudo killall mysqld_safe
sudo /etc/init.d/mysql start

PHPMyAdmin: Allowing null users to log in
Edit /etc/phpmyadmin/config.inc.php and look for ‘AllowNoPassword’ and set it to TRUE.

The following would lead to a public_html folder as web space, a password-less root and enabling the password-less root to log in to phpmyadmin.

It’s probably a security expert’s worst nightmare but it sure is convenient.

Written by rystraum

July 2nd, 2010 at 10:41 am

Posted in Programming,Software

Tagged with , ,

Selling my Nokia E75

3 comments>>

Nokia E75 review from Yugatech

I got the phone through my Mom’s 18-months contract renewal with Smart last January. My phone is the silver black one. It was rarely used, only for taking pictures, surfing the net and the occasional Skype calls.

I’m selling it for the following reasons:

  1. I think it’s overkill for what I use cellphones for
  2. It’s locked to Smart (all my contacts are on Globe / Sun)
  3. 3 phones is too many to carry

I’m selling it for 15,000 Php. With everything it came with except the earphones (because I’m using it and it’s partly broken).

Any takers?

Written by rystraum

June 20th, 2010 at 10:55 am

Posted in for sale

Tagged with ,

For my crazy ones

leave a comment>>

Here’s to the crazy ones,
the misfits, the rebels, the troublemakers,
the round pegs in the square holes
the ones who see things differently.

They’re not fond of rules
and they have no respect for the status quo

You can quote them, disagree with them,
glorify or vilify them
but the only thing you can’t do is ignore them
because they change things, they push the human race forward

And while some may see them as the crazy ones, we see genius.
Because the people who are crazy enough to think that they can change the world are the ones who do.

For UnPLUG, CPU, DilNet, POSNet and Inovent.

From @bri_quebengco through Facebook

Written by rystraum

June 20th, 2010 at 5:10 am

Posted in Advocacy

Tagged with , ,

The Dreamer’s Schema

one comment>>

I’ll make sure we get to accomplish both our dreams.
At least we have something to hold on to..
and not just live everyday without direction.

We have a dream, do you have one too?

Written by rystraum

June 17th, 2010 at 10:35 am

Posted in Personal

Tagged with