Tuesday, March 15, 2011

Auto startup of process / program on linux

auto startup of a process / program (including slackware)


seems the reason it wouldn't work is because i needed to set the NO_PASSWORD_CONSOLE option in /etc/login.defs...

everything is working fine now... i set 3 ttys, tty3 being the one that is autologin...

this is what my working setup looks like now:




c1:1235:respawn:/sbin/agetty 38400 tty1 linux
c2:1235:respawn:/sbin/agetty 38400 tty2 linux
c3:235:respawn:/sbin/agetty -n -l /usr/sbin/autologin 38400 tty3 linux


if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty3 ]; then

/etc/securetty (i commented all ttys except tty1):


in the inittab i removed the "1" from the c3 line as i don't want the auto login tty3 to be up when i go to runlevel 1 (single user mode)...

Auto login in ubuntu


Trick is that you have to be root to change the options shown.  If you have a version which will edit the login screen correctly, you can use it and get prompted.  If no, you may need to run the dialog directly as root

Create a patch file

Info here is from:

Another example file:

Create a patch file Tb01 and Tb02 are the two directories
diff -crB Tb01 Tb02 > Tb02.patch

to dry run the patch:
patch --dry-run -p1 -i Tb02.patch

apply the patch, creating Tb02 from Tb01:
patch -p1 -i Tb02.patchpatch -p1 -i Tb02.patch

Revert patches

example of applying a patch:
    * gunzip patch-2.6.13-sometag.gz or bzip2 -d patch-2.6.13-sometag.bz2.
    * file patch-2.6.13-sometag
    * cd /path/to/kernel
    * patch -p1 < /path/to/patch-2.6.13-sometag
Revert Patch
    * change to directory with /path/to/kernel
    * patch -Rp1 < patch-2.6.13-sometag

Monday, March 14, 2011

debugging linux kernel, create an oops

How to create an Oops for debugging purposes

     I found this bit in Beginning Linux programming...To generate an oops create a module.... and in the init function.....

int init_module(void)
     /* deferencing a null pointer */
     *(int*)0 = 1 ;
     return 0;
If your kernel has symbols, this will product a stack backtrace from where you code this.

Friday, March 4, 2011

networking disabled in Ubuntu


service network-manager stop
rm (or edit) /var/lib/NetworkManager/NetworkManager.state

if it shows disabled, change it to enabled, then service start the manager

else rm the thing like it says and reboot if it is sufficiently screwed up.