UNIX Questions and Answers





UNIX Questions and Answers



Most answers refer to Solaris 2.x systems




Hardware Issues



Configuration Issues



NFS Issues



General Issues



Software issues



Networking issues





Security issues





Firewall issues





Performance tuning issues




E10000









How do i view and set the open boot prom settings



From the unix prompt use eeprom. From the ok prompt use devaliases, printenv, nvedit and nvalias.

Back to Contents


How do i stop people logging in ?



If the file /etc/nologin exists then only root can login. Whatever the contents of the file are are displayed to whoever is attempting a login.

Back to Contents



How do i boot over the net via a different interface



From the ok prompt type



show-nets



This will display the possible interfaces. Select an interface then type



nvalias net ^Y



This will set the selected interface to the alias net.

Back to Contents


How do I solve Keyboard Translation
Errors?



The most likely cause of this is an incorrect XKeysymDB file or an
incorrect pointer to it. Try looking in /usr/openwin/lib or
/usr/openwin/lib/X11. The Installation and Administration
manual for the application should have some information about this.



If logged in as root from another system try
/usr/openwin/bin/kbd-mode -a

Back to Contents



Why do I get the error Stale NFS
Handle?



This was probably caused by a directory being deleted while another
system was NFS mounted into it. The best action is to cd
out of the directory and perform a umount. Sometimes
halting and restarting the automount daemon is reqired, for example:



/etc/rc2.d/S74autofs [stop/start]. or


/etc/init.d/nfs.server [stop/start].


If none of these work, then it might have to be a reboot.

Back to Contents



How can I configure new devices without
rebooting?



It is advisable to halt and power off the system whenever you attach new
scsi devices. However, if this is not possible try this:


  1. If possible stop the system with < STOP > < A >, connect the device and
    type go
  2. Type:


    drvconfig


    devlinks


    tapes / disks (depending on the device attached)

Back to Contents



What does the error RPC Program not registered
mean?



Probably the NFS server has got itself a little confused. Check there is
an entry in /etc/dfs/dfstab


Try stopping and restarting the daemon, for example:


/etc/init.d/nfs.server [stop/start]


If this doesn't work, try a reboot.

Back to Contents


How do I tar to a remote system?



Tar to a remote drive:


tar cvfb - 20 filenames | rsh host dd of=/dev/rmt0 obs=20b



Tar from a remote drive:


rsh -n host dd if=/dev/rmt0 bs=20b | tar xvBfb - 20
filenames



Copying directory trees:


cd fromdir; tar cf - . | (cd todir; tar xfBp -)


Copy directory tree to another host:


cd fromdir; tar cf - * | rsh host "cd todir ; tar xf -"


Back to Contents


How do I copy directory structure with cpio?



Use find and cpio


cd fromdir; find . -name -print | cpio -pmd /todir




Back to Contents



How can I increase swap space?



Swapping onto a file system is faster than swapping to a file. If
possible, partition an area of disk as the additional swap area.
Otherwise, create a swap file with the command mkfile (see
man page), for example:


mkfile 100m swappy


Add the swap area with the command swap (see man page) for
example:


swap -a swappy


Back to Contents


Cetting a non sun cdrom to work



The main secret is to get the cdrom to talk in 512 byte sectors. If the cdrom does this then it will work.


Saturn.tlug.org This is a good FAQ to start with or try the Sun CD FAQ. or of course your manafacturs instruction book.


Back to Contents



How do I find out the speed of my machine?



Use the command psrinfo -v

Back to Contents



How do I carry out NFS performance tuning?



Start with the SMCC NFS Server Performance and Tuning Guide


This is a pkgadd of SUNWabhdw and adds the guide to answerbook


SUNWadhdw is on the "Software Supplement for the Solaris 2.6 Operating
Environment" CD.


Use the command /usr/bin/nfsstat to view the NFS statistics


Back to Contents



What hardware diagnostic programs are
there?



Use SunVTS. This is available on the Software Supplement for the Solaris
2.6 Operating Environment CD.


If you have a fibre problem then try STORtools. You will probably need
a fibre loopback cable in order to get the most out of this.

Back to Contents



How do I make a file system bootable after a
restore?



If you have reinstalled the / file system from backup (ie
ufsdump) then you will need to recreate the boot block on
the boot disk. This is done using the installboot command (
read the man page ), for example:

installboot
/usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c?t?d?s?

Back to Contents



How do I dual host a system?



  1. Install the network card and cable it up. Make sure that any
    jumpersettings are set.
  2. Add the second interface name and IP to the hosts file and Name
    Service.
  3. Edit the file /etc/hostname.interface where
    interface is the type, for example, le1 hme1
  4. Reboot the sysyem or manually set it up with ifconfig
    (see manual page)


    ifconfig hmse1 plumb


    ifconfig hmse1 IP-Address

You may also need to perform an add route (see manual page)


route add net destination gateway metric
Back to Contents



How do I find out what patches are on a
system?



Use the command showrev -p



Use the command patchdiag -l this also lists patches you should install.

You
will need do download a copy from sun. If you have access try
downloading from http://sunsolve.sun.com.sunsolve/patchdiag this is a
tar compressed file.

There is a tar file of patchdiag on this site but i have not set up ftp at the moment of writing this page.

Back to Contents



How much memory does my system have?



Use the command prtconf and grep for the
memory, for example:


prtconf |grep Memory





If you need to know what memory sims are in what slot use the perl script from Micron. A sample script is.


Sample of Memcom Script Remeber to get an official copy.

Back to Contents



How can I play audio CDs and MP3 on my system?



For CD


Download a copy of Workman from Midwinter.com


If you have problems with sound then it might be that you cannot use
the internal sound card and will have to plug speekers int the cd
plater itself.


However this might work



edit /etc/rmmount.conf and add


action cdrom action_workman.so


/usr/local/bin/workman





try this before any other cdrom actions




For MP3 files look to the following site


Opensound


If you wish to read an audio cd under solaris and copy the files to
wav, mpeg, etc then you need the program galette available from Galette


Once you have the files stored as wav files you need to convert them to MP3 using Blade


Back to Contents



What useful Solaris commands are there
for finding out what's going on?



This is a definite RTFM, but start with these:


ps, iostat, nfsstat,
sar, netstat, snoop,
mpstat, rpcinfo, truss,
prtdiag, crash, psrinfo,
prtconf, arp and uptime






try looking at the enclosed perl script to get an idea of wht to look for.


Perl script to look at how the system is performing

Back to Contents



How do I connnect a Zip Drive?



Helpful info from Iomega at


Zip Drives on Sun




basically edit /etc/format.dat and add :-


disk_type = "Zip" \

: ctlr = SCSI\

: ncyl = 2046 : acyl = 2 : pcyl = 2048 : nhead = 2\

: nsect = 40 : rpm : bpt = 20480



partition = "Zip" \

: disk = "Zip" : ctlr = SCSI \

: 2 = 0, 192480 : 2 = 0, 1159168





Jazz Drives on Sun
Back to Contents



Why do I get .nfsxxxx files on NFS mounted
filesystems?



These are temporary files used by the system to guarantee data
reliability over the unreliable nfs mount. These can be left behind by
an application or process that has terminated abnormally.

Back to Contents



How do I stop printing a banner page?



If this is for just one print, use the -o option, for
example:


lp -o nobanner name


Otherwise, edit the file /etc/lp/interfaces/printername and
change the option nobanner to yes.

Back to Contents



How can I find out and set shared memory?



Use the command ipcs to view what is set.


If you wish to change them, edit /etc/systems and reboot
with -r.


Typically, you would edit one or more of msgsys,
semsys, shmsys.





Check out the sun docunemt on shared memory sunworld document on shared memory


Back to Contents


Number of inodes used and free



use the command df -F ufs -o i

Back to Contents


What block size is my file system



use the command mkfs -m /dev/dsk/c?t?d?s?


look at the bsize value (you need to be root to run this)

Back to Contents



How do I find out which clients are NFS mounting
a server?



Use the command dfmounts

Back to Contents



How do I get rid of defunct processes?



These are caused by an application or process crashing, terminating
abnormally, getting confused
etc. Look for the parent process of these and kill or refresh it.

Back to Contents



What version of bind am I running?



try /usr/ccs/bin/what /usr/sbin/in.named |grep named




Solaris 2.6 bind 4.9.4-P1 



Solaris 2.5.1 bind 4.9.3-P1






Back to Contents



How can I change the hostid?



There are several ways to do this, try:


Squirrel
FAQ



Back to Contents




Why am I having problems mounting a floppy?






Back to Contents



How do I configure dtlogin for other window managers?



You need to create an Xresourses file to start the window manager.



cd /usr/dt/config/C/Xresources.d
copy Xresources.ow to a new name of your window manager ie Xresourses.kde.





Now edit your Xresources.kde file. Making the changes for your window manager


I.e.


Dtlogin*altDtsIncrement: True





Dtlogin*altDtName: KDE Desktop


Dtlogin*altDtKey: /usr/local/kde/bin/startkde


Dtlogin*altDtStart: /usr/local/kde/bin/startkde


Dtlogin*altDtLogo: KDElogo





copy the KDE logo KDElogo.pm to /usr/dt/appconfig/icons/C/KDElogo.pm





Back to Contents



Dual headed sun system



Try looking at infodoc 11669.


OPenwin
openwin -dev /dev/cgsix0 left -dev /dev/cgsix1 right




CDE


edit Xservers with


:0 Local local_uid@console root /usr/openwin/bin/Xsun :0 -dev /dev/cgsix0 -dev /dev/cgsix1 right

How do I configure CDE?





The control panel



In this example I will add the workman cd player to the control panel.


Copy the CDE config file dtwm.fp from /usr/dt to your homedirectory/.dt/types


Create an icon and place it in ~.dt/icons. it should have a .m.pm extension.


ie. Player.m.pm


Edit the dtwm.fp file
and add following. In this case I am adding it between the help and
trash areas. the position hints is 13 so it should appear towards the
right between the help (book) icon and the trash (waste bin) icon.


CONTROL cdplayer

{

TYPE icon

CONTAINER_NAME Top

CONTAINER_TYPE BOX

POSITION_HINTS 13

PUSH_ACTION cdplayer

ICON Player

}


Create a file for what to do when the button is pushed. In the example
it is called cdplayer. The file has a .dt extension IE cdplayer.dt. The
contents of this file are.

ACTION cdplayer

{

LABEL cdplayer

TYPE COMMAND

EXEC_STRING /usr/local/bin/workman

ICON somename

WINDOW_TYPE NO_STDIO

DESCRIPTION starts cdplayer

}




The mouse menu


copy the mouse menu from /usr/dt/config/C/sys.dtwmrc to you home directory ~/.dt/types/dtwmrc.



edit the dtwnrc file adding or removing mouse options. In this case we will create an applications submenu and put the cdplayer in that submenu.



Firstly add the applications menu to the main menu by instering a line like this



"Applications" f.menu apps

in the DtRootMenu section. approx line 38

then hgo to the botton of the file and create the application menu. ie.



Menu apps

{

APPLICATIONS" f.title

"CD Player" f.exec "/usr/local/bin/workman"

}

Back to Contents



How do I stop colour flashing?





Back to Contents


How do i communicate between systems using scokets


There are several ways to do this.  Below is an example of a perl program that sends the string 

"hey now hey now now. Sing this corrosion to me " to port 1250 on a system called mission.

On the mission server there is a program which is called via inetd that picks up this incomming

line and writes it to a file /tmp/outfile. the program is called read-socket.pl





Sample /etc/inetd.conf entry

read-socket stream tcp nowait neville /export/home/neville/read-socket.pl



Sample /etc/services entry

read-socket 1250/tcp



Sample sending program (send-line.pl)

#!/usr/bin/perl

use IO::Socket;

$sock = new IO::Socket::INET (PeerAddr => 'mission',

PeerPort => 1250,

Proto => 'tcp',

);

die "Socket could not be created. Reason $! \n" unless $sock;

print $sock "hey now hey now now. Sing this corrosion to me\n";

close ($sock);



Sample sending program (send-file.pl)

#!/usr/bin/perl

use IO::Socket;

my $FILETOSEND = "/tmp/crappy";

open (INFILE, $FILETOSEND) || die "cannot open file: $FILETOSEND \n";

$sock = new IO::Socket::INET (PeerAddr => 'mission',

PeerPort => 1250,

Proto => 'tcp',

);

die "Socket could not be created. Reason $! \n" unless $sock;

#now do the sending

select ($sock);

while (< INFILE > )

{

print $_;

}

close ($sock);

close ($INFILE);



Sample reading program (read-socket.pl)

#!/usr/bin/perl

open (OUT, ">/tmp/outfile") || die "cannot open output file \n";

print OUT < STDIN >

close (OUT);



Sample reading program as a deamon (not using /etc/system and /etc/services)

#!/usr/bin/perl

use IO::Socket;

$sock = new IO::Socket::INET (PeerPort => 1250,

Proto => 'tcp',

Listen => 10,

Reuse => 1,

);

die "Cannot start deamon on socket Reason $! \n" unless $sock;

while ($this_connection = $server->accept())

{

print $this_connection;

}

close ($sock);




Back to Contents


How do i find out what resources a running process is using


Use the proc commands below and others. 

/usr/proc/bin/pmap -x $PID (see what memory is used)

/usr/proc/bin/pldd $PID (see what shared libraries are used)

/usr/proc/bin/pwdx $PID (see what the working directory is)



Download a copy of memtool from Sun. ftp://playground.sun.com/pub/memtool


Back to Contents


How can i program in curses?



If you plan to use curses to do an interface try looking at this site. It might make life easier for you


SCRMGR curses interface


Back to Contents


Get system hardware configuration



Run the command /usr/platform/arch-type/sbin/prtdiag -V


Back to Contents


Run jobs in background during times of light system loading



Try this site
Idalize program

Back to Contents


System stats in html format



Get a copy of DHTMLR (Do HTML Report) forom the belew site.


this is a shell script that gets system info and builds web pages.
DHTMLR program from the Sunsolve site Belgium

Back to Contents



Graphical FTP front ends for X



There are quite a few graphical front ends for ftp available. Below are
a couple of them. Also try looking at the KDE and GNOME sites.


GNU licenses Graphical ftp


llnl xdir

Back to Contents



Security issues and Solaris



Um yes well probably quite a few bits to add here. lets try


Back to Contents


Info on old sun hardware



This is a 7 part document



Back to Contents


Microsoft Internet Explorer and Outlook express for Solaris



Download it from


Internet Explorer


Back to Contents


How to prevent stack overflow



add noexec_user_stack to the file /etc/system

Back to Contents



How to tell if you are in 32 or 64 bit mode



use the command isainfo -v

Back to Contents



Disable CDROM popup under CDE



comment out the stdvolcheck stuff from


/usr/dt/config/sessionetc

Back to Contents



Stop FTP users from logging in



Set their shell in /etc/passwd to /bin/false. Then edit /etc/shells and add a line /bin/false.

Back to Contents



Check for disk errors



Use the commands


iostat -e or iostst -E or netstat -k

Back to Contents



Firewall information



Probably a lot to say here lets start with



Back to Contents



Performance tuning information



Probably a lot to say here lets start with



Back to Contents



Xerox NeWSprinter20 Toner



As far as i can tell this is the toner Xerox XP 15/20

Back to Contents



Connecting a Sun Monitor to a PC



You will need to get a fixed frequency card. Look at this site.




Monitor world




Back to Contents




Connecting a PC Monitor to a Sun



You will need to get a 13W3 to VGA connector.


Some monitors (Notably Sony based ones) will just work. Plug it it and reboot.


If not you will need to set up your monitor configurations at the NVRAM.


To set the NVRAM you need the following info.




Back to Contents



Pinouts for Scsi, Video, Audio, Parallel, serial, etc



A good site to start looking at is:


Pinouts.com




Back to Contents



What is my screen resolution, etc



Under the X11 environment run the command xdpyinfo. If not running X
then you will need to look at one of the frame buffer config commands.


Unfortunatly these are framebuffer specific but try

System/Framebuffer	Command



Sparc4, Sparcx5 tcx tcxconfig

x86 kdmconfig

Ultra creator ffbconfig

Ultra PGX/M64 m64config

sparc ZX/TZX leoconfig

sparc SX cg14config


If you do not have the OS running but are at the OK pronpt try using nvedit.




Back to Contents



Upper to lower case traanslation using tr


#!/bin/sh

#translate filenames in uppercase to lowercase



for FILE in `ls`

do

NEWNAME=`echo $FILE |tr [A-Z] [a-z]`

mv $FILE $NEWNAME

done






Back to Contents


How to create solaris pkg'd



read this good article.


creating solaris packages


Back to Contents



Mb/Mhz rpm rule of thumb



A vague rule of thumb when looking at disk arrays is MB transfered is 10% of Mhz





for every 1000 rpm of disk you will get about 9 I/O's second therefore a 10,000rpm disk will have 90 I/O second


If these are in a stripe configuration of 5 working disks the the throughput


could be 400 I/O second


At the time of writing a fully populated D1000 could yeald up to 3000 I/O second


Back to Contents



Online & Offline processors and what running on a processor



useful commnads are mpstat, psrinfo, psrset, pbind


Back to Contents



Rename an e10000 domain



Take a look at this page to show how to remane a domain. The main thing
to remember is to rename the domain on the ssp as well as the domain
itself.
Renaming an E1000 Domain


Back to Contents






1




Powered by ScribeFire.

comment 0 comments:

Popular Posts

Linux Gazette