Operating System - HP-UX
1825667 Members
3496 Online
109686 Solutions
New Discussion

Re: List of common mistakes

 
SOLVED
Go to solution
Manoj1
Advisor

List of common mistakes

Hi all,

Is there a list on common mistakes to be avoided while performing system admin tasks on HP-UX ?

Thanks,
Manoj
40 REPLIES 40
Dennis Handly
Acclaimed Contributor
Solution

Re: List of common mistakes

Make sure you are in the right directory when removing directory trees.
Make sure you are on the right machine before rebooting.
Be vary cautious when using "chown/chmod -R".
SoorajCleris
Honored Contributor

Re: List of common mistakes

Remember you are root before you do anything!!!

you may be so experienced, still you can make typo. Recheck each command before you run it.

verify thrice , before you use -R

Never do the changes in which you have doubt!!

More important: Never deviate from the process defined by your firm. They will forgive you for manual errors but not for deviating from the process..

Regards,
Sooraj
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity" - Dennis Ritchie
Kapil Jha
Honored Contributor

Re: List of common mistakes

1. take huge care of tar files, just think twice how tar files has been created specially if given by any other people.

>> tar does not ask anything it just replace.

2. never use * with rm commands in any way.

3. don be too fast in doing things take your time.

BR,
Kapil+
I am in this small bowl, I wane see the real world......
P Arumugavel
Respected Contributor

Re: List of common mistakes

Hi,

Using SAM reduces the complexity of most administration tasks. SAM minimizes or eliminates the need for detailed knowledge of many administration commands, thus saving valuable time. Use SAM whenever possible, especially when first mastering a task. Some tasks cannot be done by SAM, in which case you will need to use the HP-UX commands. Sometimes you will need to use commands manually for troubleshooting and specialized tasks However, SAM is the tool of choice for most administration work.

Even elephants do slip...
R.K. #
Honored Contributor

Re: List of common mistakes

Hello..

1. While performing any activity, record everything using "script" command to have details of each and every step/output and/or increase the buffer size of the window depending on the situation. This will help troubleshoot the problem if anything goes wrong in the activity.

2. Sometimes, we as root will be working on a terminal and will use previous command keys (ctrl+k) to immediately execute the last command. But if someone else is also logged in as root, he may be running some other commands. So we would, by mistake run the last command (issued by another user). Bottomline, if you are using "ctrl+k" key for using previous commands, have a look on them before executing.



Regds..
Don't fix what ain't broke
vishnu.khandare
Respected Contributor

Re: List of common mistakes

Hi Manoj,

Yes, all can avoid common mistakes while doing system admin tasks.
1) We should more attention to work while running any command.
2)While rebooting or shutdown the server check the hostname and IP address to verify ur working on correct system.
3)While flushing the mount points also we should assure that we are on correct system before u do that.
4)While taking clone also u should be careful.
5)While remove directory dont use * unless ur confident to do that.
6)While chmod/chown check ur on correct directory where u want to change otherwise u will land in trouble.

Experience is the BEST Teacher, U should learn from ur mistakes, not to repeat it.

Hope ur query resolved.
Don't forget to assign points

Regards
Vishnu Khandare
You should deserve before U desire!!!!
V. Nyga
Honored Contributor

Re: List of common mistakes

Be sure your backup is up-to-date and readable.
UX has no trash can, so what you delete is deleted.

V.
*** Say 'Thanks' with Kudos ***
Jan van den Ende
Honored Contributor

Re: List of common mistakes

-- NEVER -- log in AS root; only su into root, WITH a trace. AND MAKE SURE THAT IS TRUE FOR EVERYONE: block direct login to root as soon as system is not single-user.
Of course I am now writing about systems that have multiple people with kernel-level access.

(even the concept of the need to login as root makes me a little sick. Other OSes have facilities to grant enhanced rights to selected individuals. THAT makes tracing much easier, and responsibilities much clearer).

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Aneesh Mohan
Honored Contributor

Re: List of common mistakes

Hi Manoj,

A few from me here..

(a) Always refer syslog for any error related to system before start looking in to the issue.


(b) Prepare an Action Plan ,Roll back Plan and Identify the Risks involved and Plan to Mitigate the risks before doing any major change.

(c) Always capture the below o/p before reboot the box.

bdf
swapinfo -tam
strings /etc/lvmtab
grep initdefault /etc/inittab

(d) Do changes one at a time during trobleshooting

(e) Update latest patches (double stared ones) ,qualerly and update HW firmwares yearly.

Thanks for initiating a this thread,this is a good experience sharing thread.

With Regards,
Aneesh
sombriks
Advisor

Re: List of common mistakes

name resolution,

sometimes due the nature of your network a misconfigured /etc/nsswitch.conf can give you many timeouts.
Mike Miller_8
Regular Advisor

Re: List of common mistakes

Create an ignite tape and verify that you have a good backup before you make any major change.
butti
Frequent Advisor

Re: List of common mistakes

Hi,

i'm using cfg2html once a month for all server, and archive the output.

So that i could see any changes.

best regards,
butti
S. Ney
Trusted Contributor

Re: List of common mistakes

A few of mine:
If inexperienced read up on the subject. I regularly peruse through the forums and if I see something of use or interest I copy the information into a document or bookmark the page. I spent a lot of time just reading threads here and pdf documents provided by HP as well as using google.

Create a regular user with permission to su to root. Only su when doing tasks that require root access. With SAM and SMH you can give regular users special permissions to use those utilities. (For example look up restricted SAM)

On that note configure and tweak as necessary your sudoers file. Use visudo to edit. Create a root users group and groupadd your user profile to this group.

It's helpful to set your PS1 to know which server you are logged into. We have this set in /etc/profile:
PS1="$LOGNAME"@`hostname`:'$PWD'"> "
export PS1

Before doing any work create a maintenance log. I use excel to list out the tasks I am going to do in descending order with additional columns for start and end time. In other words have a plan of action.

Make sure you have some backup method in place before doing any major system work like patches, volume group work, etc.

Be very careful with the rm command. Be very careful with vgexport command as well.

Schedule your maintenance for off hours. Be aware you are creating additional IO with each patch install, lvextend, etc. If possible test the commands and actions on a non-prod server.

Read the patch requirements. Some patches require a system reboot, others do not. A lot of patches have dependencies.

As suggested above create a script so you can review work that was done. For example everytime I had to extend a lvol, add a disk, etc. I'd create a script in /tmp. (script /tmp/scriptname) It was especially helpful to review. Name your script something useful.
Manoj1
Advisor

Re: List of common mistakes

How does below commands work as root user ?
Which one is dangerous and never be used and why ?

cd /home/sun/moon/mercury/

#/home/sun/moon/mercury/> rm -rf ../*

#/home/sun/moon/mercury/> rm -rf ../*.*

#/home/sun/moon/mercury/> rm -rf *

Thanks,
Manoj


Bijeesh
Respected Contributor

Re: List of common mistakes

Hi,
#/home/sun/moon/mercury/> rm -rf ../*
Delete all the file and dirs under moon directory.

#/home/sun/moon/mercury/> rm -rf ../*.*
Delete the files and dirs which have a dot symbol and under moon directory.

#/home/sun/moon/mercury/> rm -rf *

Delete all the files and dirs under mercury directory.
Bijeesh
Respected Contributor

Re: List of common mistakes

>>List of common mistakes<<
1)Like RK mentioned in second part, same type of problem happens while copy paste the commands using mouse on PUTTY session.
The left button selected words get copied in buffer and at any time if you press the left button it pasted on the screen.So be alert while selecting the words/commands using mouse on PUTTY terminal.
2)Read the man page to avoid confusing options with commands.
shrady
Advisor

Re: List of common mistakes

Editing a file without taking backup of it and then realising that u need to revert it back.
Always keep a backup of the file u edit.
If you think "you can", you can; if you think "you can't", think AGAIN
Matti_Kurkela
Honored Contributor

Re: List of common mistakes

#/home/sun/moon/mercury/> rm -rf ../*.*
> Delete the files and dirs which have a dot symbol and under moon directory.

This answer indicates you didn't understand the danger of this command.

Remember that every directory has two special sub-directory entries: "." and "..".

This command will delete /home/sun/moon/*.*, which includes:
/home/sun/moon/.. = /home/sun/
/home/sun/moon/../.. = /home
/home/sun/moon/../../.. = /

And when "rm -rf" deletes a directory, it will also delete all files and sub-directories in it...

In other words, this command will delete *EVERY FILE AND DIRECTORY ON THE SYSTEM*.

MK
MK
Nirmal G
Advisor

Re: List of common mistakes

Hi All,

When changing the root password, kindly make sure the passwd is working/changed properly by taking a separate session before logging out the session.

This practice will be keep us tension free on root passwd issues.

Regards,
Nirmal G
Dennis Handly
Acclaimed Contributor

Re: List of common mistakes

>#/home/sun/moon/mercury/> rm -rf ../*

This is going to fail because is is going to try deleting the current directory mercury.

>MK: Remember that every directory has two special sub-directory entries: "." and "..".
>This command will delete /home/sun/moon/*.*, which includes:
/home/sun/moon/.. = /home/sun/
/home/sun/moon/../.. = /home
/home/sun/moon/../../.. = /

Huh?

>And when "rm -rf" deletes a directory, it will also delete all files and sub-directories in it.

Yes, in it, but not the recursively to all ancestors.
Hakki Aydin Ucar
Honored Contributor

Re: List of common mistakes

I remembered a mistake I did in the past.
I issued the following command in lab server;
# hostname monster

and forgotten it , somebody call me that GUI manager application sayas no more OR valid license and logon with telnet and found my mistake:

# hostname
monster

I corrected it
# hotname

my problem I created solved
Matti_Kurkela
Honored Contributor

Re: List of common mistakes

>>#/home/sun/moon/mercury/> rm -rf ../*

>This is going to fail because is is going to try deleting the current directory mercury.

By Unix conventions, a directory is just a file (although a special type of one).

A file can be deleted while it's still open: if that's done, the file will keep existing (but it will be unreachable using any filename) as long as it's held open. As soon it's closed, it will be deleted for real.

This is true for all files, including directories.

----------

>> #/home/sun/moon/mercury/> rm -rf ../*.*
>> [...will lead to total destruction]

> Huh?
> [...] but not the recursively to all ancestors.

After a bit of thinking, I see you're correct. It will delete ../.. = /home/sun/moon, but not farther than that.

Consider me humbled, and my "rm -rf" paranoia brought back to sensible (but still sensibly paranoid) levels :)

MK
MK
Bijeesh
Respected Contributor

Re: List of common mistakes

Hi,
#/home/sun/moon/mercury/> rm -rf ../*
I agree with MK. It delete current dir (mercury) also.

And,
#/home/sun/moon/mercury/> rm -rf ../*.*
Delete the files and dirs which have a dot symbol and under moon directory.(My prev post)
But it can't delete the hidden files in moon dir(which starts with a dot, like ".abc"
Also rm -rf * cannot delete the dot(.) and double dots(..) which are indicating current dir and parent dir.
Torsten.
Acclaimed Contributor

Re: List of common mistakes

.


The most common mistake seen here in the forums is first doing anything as root even if you are absolutely not sure what you are doing (e.g. disk replacements in complex LVM structures), then ask how to solve the self-created serious problem.

PEBKAC.


Better first ask, read, confirm, then do.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!