Stop/start script problem on Solaris-10

I have Big brother script, which start/stop Big Brother processes. Something got change on server and now I am not able to start/stop it. There is no change in script, as I compared it from other server. This service is being managed by bb user (group is also bb).

root@tsazdq04:/# /etc/init.d/bbmon restart
/etc/profile[47]: /dev/null: cannot create
/usr/local/bb/runbb.sh: /dev/null: cannot create
root@tsazdq04:/# ls -l /etc/profile /dev/null /usr/local/bb/runbb.sh
-rw-r--r--   1 root     root         188 Oct 25 19:50 /dev/null
-rw-r--r--   1 root     other        741 Feb 12  2012 /etc/profile
-rwxr-xr-x   1 bb       bb          7870 Aug  1  2002 /usr/local/bb/runbb.sh
root@tsazdq04:/#
root@tsazdq04:/# cat /etc/passwd | grep -i bb
bb:x:1984:1984:Big Brother:/usr/local/bb:/bin/ksh
root@tsazdq04:/# ls -ld /usr/local/bb
drwxrwxrwx   6 bb       bb            20 Jul 15  2009 /usr/local/bb
root@tsazdq04:/# ls -l /usr/local/bb
total 17003
-rw-r--r--   1 bb       bb       8545902 Oct 25 17:23 BBOUT
drwxrwx---   2 bb       bb            30 Nov 21  2002 bin
drwxr-xr-x   2 bb       bb            43 Jul 22 20:54 etc
drwxr-x---   6 bb       bb            24 May  1 14:58 ext
-rw-r-----   1 bb       bb          2362 Jan 30  2001 LICENSE
-rw-r-----   1 bb       bb         14743 Sep 12  2001 README
-rw-r-----   1 bb       bb          9934 Sep 12  2001 README.INSTALL
-rwxr-xr-x   1 bb       bb          7870 Aug  1  2002 runbb.sh
drwxr-x---   2 bb       bb             7 Oct 25 17:23 tmp
root@tsazdq04:/#

Any idea where where should I dig to fix it ?

/dev/null should not be a regular file. Look at

ls -l /dev/null

output on your working server. Then remove /dev/null on this server and use mknod to recreate /dev/null as a character special file with the same major and minor device numbers as /dev/null on your working server. (The rm and mknod will need to be done with appropriate privileges.)

PS The file mode is also wrong. /dev/null should be mode 666 not 644.

1 Like

Below is from working server, you are right

/# ls -l /dev/null
lrwxrwxrwx   1 root     other         27 Jun 30  2009 /dev/null -> ../devices/pseudo/mm@0:null

How should I recreate it with mknod option ?

Look at

ls -l /devices/pseudo/mm@0:null

That should show a character device. If it is the same on both systems, then you would just need to cd /dev and recreate the symbolic link instead of the current file called /dev/null .

1 Like

It worked.
Thanks Don and Scrutinizer

I'm glad we were able to help�

Note, however, that someone or something running with root's privileges, removed and recreated /dev/null to create this problem in the first place. All of the sysadmins for this system need to be told what happened and how you fixed it so they will know what to do if it happens again. And, all of you need to check /dev/null frequently to see if it happens again. If it does happen again, you'll need to track down the program that did it and fix it so it doesn't keep happening. (Note that lots of user programs will also stop working correctly if /dev/null is not a readable and writeable empty file.)

Yes Don. I tried to find in history, who did that, but couldn't found. Already sent mail to team, what was happened and how did I fixed it.