The document provides troubleshooting tips for UNIX/Linux systems, including recovering from an unknown root password, fixing bootloaders, software RAID, single user mode, and extending LVM partitions online.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
100%(5)100% found this document useful (5 votes)
983 views
Unix Linux Troubleshooting
The document provides troubleshooting tips for UNIX/Linux systems, including recovering from an unknown root password, fixing bootloaders, software RAID, single user mode, and extending LVM partitions online.
Boot Process #Boot steps: Recover from an unknown root password
BIOS #EFI is successor for e.g. IA64, #1) Start single user mode, then passwd #Extensible Firmware Interface #2) Boot from a Linux CD, su -, mount / partition: mount /dev/hda3 /mnt mbr #Create backup (if is input file, of=output) # Remove the x in the /mnt/etc/passwd file (second field on the root line) dd if=/dev/hda of=/tmp/mbr bs=512 count=1 #3) Run passwd in the Rescue Mode file /tmp/mbr #Check -> x86 boot sector hexdump /tmp/mbr #See inside copied mbr Fix bootloader khexdump /tmp/mbr #Install via: yast2 -i kdeutils-extra, or #Start in Rescue Mode, and at the first prompt: ghex2 /tmp/mbr #Package: rpm -qf $(which ghex2) #Type zast or yast #German keyboard work around #Last 2 Bytes 'magic number': 55 AA #System, Boot Loader Configuration, Reset <Alt-e>, boot loader #GRUB or LILO. #Propose New Configuration, Finish <Alt-f> #GRUB supports TFTP network boot, serial console, shell: #In bootgui: press <Esc>, <C> grub command line, or grub from Linux CLI YaST boot into system #To live with a damaged boot loader help #Show GRUB commands #Start from (any version) CD1 find /boot/vmlinuz #Returns partition with kernel #Start Installation, License Agreement, Language, Boot Installed System find /etc/fstab #Returns / partition (Starts with 0, not 1) #Tip: Hardcode IDE disks in BIOS, not on 'automatic' Rescue Mode #Change setup of a non bootable machine: #Kernel options: #Boot from CD1 (any version, highest SP for driver support) less /usr/src/linux/Documentation/kernel-parameters.txt #Select Rescue System, and login as root vi /boot/grub/device.map #Map GRUB names to Linux names, e.g.: grub #Find the / partition: (hd0) /dev/hda find /etc/fstab grub-md5-crypt #Create encrypted password for menu.lst exit init #PID 1 mount /dev/hda3 /mnt #Mount /partition mount -o bind /proc /mnt/proc #Optional Software RAID #Mirror of /boot: LILO only, not GRUB! mount -o bind /sys /mnt/sys #Optional #Hardware RAID is prefer., if not SATA, e.g. Hi Point or Promise Fast Track. chroot /mnt; mount -a #All commands are executed on the non #Primary partitions are preferred, because setup is in mbr and easy to copy #bootable machine, e.g. passwd to change password of root, or #Erase former partitions; sometimes required for new clean install: mkinitrd #Recreate initrd, See also: dd if=/dev/zero of=/dev/hda count=4 bs=512 grep MODULES /etc/sysconfig/kernel #Use vi /etc/raidtab (raid... cmds) or mdadm as a front end to setup RAID vi $(which mkinitrd) #Checkout the mkinitrd script #Demo Software RAID 1 on an installed system with one disk, e.g.: dd if=/dev/zero of=disk1.img bs=10M count=5 Fix non booting system dd if=/dev/zero of=disk2.img bs=10M count=5 #Start from (any version) CD1 losetup /dev/loop1 disk1.img #Use file1 as a 'disk' #Start Installation, License Agreement, Language, Repair Installed System, losetup /dev/loop2 disk2.img #Use file2 as a 'disk' #Automatic is all from Custom: #Expert Tools: mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/loop1 \ #Check Partition Tables #Install New Boot Loader /dev/loop2 #Check Swap Areas #Start Partition Tool cat /proc/mdstat #Monitor disk status, and fdisk -l #Check File Systems #Repair File System mkreiserfs /dev/md0 #Format 'disk' #Check fstab Entries #Recover Lost Partition mount /dev/md0 /local #Use 'disk' #Check Package Database #Save System Setting to Floppy watch cat /proc/mdstat #Show continuous RAID statistics #Check Minimal Package Selection#Verify Installed Software mdadm --manage --set-faulty /dev/md0 /dev/loop2 #Verify Base Packages mdadm /dev/md0 -r /dev/loop2 #Remove 'disk' #Check Boot Loader Configuration mdadm /dev/md0 -a /dev/loop2 #Hot add 'disk' mdadm --stop /dev/md0 #Stop mirroring YOU #YaST Online Update #What driver to use? #Look for 'Driver Activation Cmd': uname -a #Show kernel version hwinfo --storage-ctrl ll /lib/modules #Show available module versions modinfo ipr ¦ grep ^parm #Show module start options #A new kernel can generate 2 issues: #without reboot: New modules cannot load (older ones are deleted) Single user mode #'Safe mode', init 1, or while booting: #with reboot: Some modules need recompiling, e.g. VMware, nvidia #GRUB boot menu: Press <Esc>to leave the boot GUI, #Prevent e.g. new kernel(s) ('kernel-default') in YOU automatic mode: #<e> to edit menu, select kernel line, <e> to edit kernel line, yast2, Software, Install and Remove, Select package, Actions menu, Taboo #type <space><1><enter>, type <b> for boot. root will be logged in, Yes, or select 'Protected—Do Not Modify' in GUI. #Red Hat: without password #SUSE: with password.
Quick Reference Card 11 UNIX/Linux Course Troubleshooting Your? a host logo
yast versus vi #Yet another Setup Tool
#If both methods are mixed to change /etc files (editable text configuration): SLED10 #Disk usage, all software except 'Latex' #Generally: yast is preferred., except for files in /etc/sysconfig (vi). / #176M (incl. /usr, unix system resources) #If yast claims the file in the header, and vi is still used, then the next yast /boot #7M #session will not overwrite the conf file. YaST will create a separate file and /local #(ReiserFS) 33M #will notify the user. /opt #1.3G /sbin/yast -l #List yast modules /srv #34M /sbin/yast2 ntp-client help #Show yast CLI help /tmp #(ReiserFS) 33M /sbin/yast2 ntp-client add help #Show yast CLI option help /var #212M /sbin/yast2 ntp-client xmlhelp #Show autoyast CLI example XML feed
Supported or not #Check support level modules/packages
modinfo tg3 #Supported: yes modinfo bcm5700 #Not supported #support.novell.com/products/linuxenterpriseserver/supported_packages #L1 #Problem determination only #L2 #Problem resolution, but without engin. #L3 #Problem resolution with engineering
System and Library Tracing #See man strace or man ltrace
strace -o output.txt -tt -T ./executable less output.txt #Look for open, write, ..., <time> on eol
Extend LVM on line #YaST or 2 CLI steps (shrink is off line):
lvextend -L +500M /dev/system/optlv resize_reiserfs -s+500M /dev/system/optlv #SLES9: ext3 cannot extend on line, first umount, SLES10: ext2online /dev/system/optlv #Extend ext3 file system without umount xfs_growfs -d /dev/system/optlv #Extend xfs file system without umount
Extra's #Different category tips
SPident -vvv #Display Support Pack status (SLES/OES) config.sh #Get info tool: novell.com/coolsolutions free #Display usage of mem/swap space cat /etc/passwd #Too much info?: ^cat^ less #Replace cat from former cmd with less #RPM installations via YaST are always checked by signature. #Enable routing: echo 1 > /proc/sys/net/ipv4/ip_forward rpm -q --changelog rpmname #What is changed? What bugs are fixed? rpm -qa --last #What are the release dates? rpm -qf $(which command) #Find package name of command #Search for options, parameters and syntax: yast2 -i kernel-source #Install kernel sources grep -r 'text' /usr/src/linux/Documentation less /usr/src/linux/Documentation/packagename grep -r 'text' /usr/src/linux #'Kernel-source' and 'gcc' are required for VMware #TID 10098503 #Add serial console to Linux machine #Linux for S/390 #IBM Redbook sg244987.pdf