Tuesday, 5 June 2012

X11 forwarding rejected:due to bug in particular ssh patch on solaris 9

Applicable to :
Operating system details : Solaris 9 9/05 s9s_u   Generic_118558-11
sshd version Sun_SSH_1.0.1

Problem:
I was getting the following error while trying to open X window using xterm.
Even after enabling X11Forwarding  in /etc/ssh/sshd_config , and restarting sshd daemon the problem was still there.

Solution:
Later i came to know it was due to a bug with a particular ssh patch.



I got the following messages in /var/adm/messages

Jun  4 20:38:17 PSBLD060 sshd[7646]: [ID 800047 auth.error] error: Failed to allocate internet-domain X11 display socket.
Jun  4 20:38:40 PSBLD060 sshd[7647]: [ID 800047 auth.error] error: Failed to allocate internet-domain X11 display socket.
Jun  4 20:38:48 PSBLD060 sshd[7648]: [ID 800047 auth.error] error: Failed to allocate internet-domain X11 display socket.
Jun  4 20:39:13 PSBLD060 sshd[7870]: [ID 800047 auth.error] error: Failed to allocate internet-domain X11 display socket.
Jun  4 20:40:38 PSBLD060 sshd[7873]: [ID 800047 auth.error] error: Failed to allocate internet-domain X11 display socket.
Jun  4 20:44:58 PSBLD060 sshd[7941]: [ID 800047 auth.error] error: Failed to allocate internet-domain X11 display socket.

sshd syslogs the message error: Failed to allocate internet-domain X11 display socket. What it really means is that it failed to allocate any IPv6 listening sockets because you don't have IPv6 enabled, and it refuses to fall back to IPv4.
There is a work around for this issue.
Just add ipv6 loopback interface as follows
# ifconfig   lo0   inet6   plumb  up
# ifconfig -a
lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
ce0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.1.18.169 netmask ffffff00 broadcast 10.1.18.255
        ether 0:14:4f:24:d5:a4
lo0: flags=2000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6> mtu 8252 index 1
        inet6 ::1/128

# /etc/ssh/sshd stop
From ssh session itself we can do this you won't loose the session.
Then run
# /usr/lib/ssh/sshd   -4
Now try to connect using xterm it will work.
great you have done.

Now we will  summarise.
# vi /etc/ssh/sshd_config
X11Forwarding  yes
# ifconfig  lo0  inet6  plumb  up
# /etc/init.d/sshd  stop
# /usr/lib/ssh/sshd  -4
That is it.









Wednesday, 2 May 2012


Requirement:-
------------------
One of the database mount point /u02/oradata needs more space.

Current size of /u02/oradata:200 GB
Free space available on the server:255 GB

Do the following to accomplish the requirement.
---------------------------------------------------------------
1.Setup an LVM volume with the available free space .ie;255 GB.
2.Shut down application and DB , backup the mount point.
3.Mount the lvm volume as /u02/oradata.
4.Restore the backup.
5.Verify the data.
6.Destroy the old /u02/oradata volume and add to LVM and extend the same online.

New volume be  /dev/sda11 ---255 GB
/u02/oradata  be /dev/sda8  ---200 GB

1.Setup LVM with /dev/sda11
--------------------------------------
Change partition id to 8e
# pvcreate   /dev/sda11
# pvdisplay

# vgcreate  vg0  /dev/sda11
# vgscan
# vgdisplay vg0

# lvcreate  -l  PE  vg0  --name  lv0
# lvdisplay  /dev/vg0/lv0
# mkfs.ext3  /dev/vg0/lv0

# mount /dev/vg0/lv0  /bkp_u02_oradata

2.Backup the data
----------------------------
Shutdown DB  then
Backup data from  /u02/oradata  (/dev/sda8) to /bkp_u02_oradata(/dev/vg0/lv0)

# tar -cvpf   /bkp_u02_oradata/u02_oradata.tar    /u02/oradata

# umount  /dev/sda8
# mount  /dev/vg0/lv0  /u02/oradata

3.Restore data
-----------------------
# tar -xvpf  /bkp_u02_oradata/u02_oradata.tar   

4.Entry in fstab
---------------------
Copy the current file
# cp /etc/fstab /etc/fstab.02May12
# vi /etc/fstab  and add the following entry.

/dev/vg0/lv0           /u02/oradata           ext3         defaults  0              0

5.Verify the data by starting the DB.


------------------------------------------------------------------------------------------------------------------------------------------------------------------
Add /dev/sda8 to LVM and grow /dev/vg0/lv0 online.

# pvcreate  /dev/sda8
# pvdisplay

# vgextend  vg0  /dev/sda8
# vgdisplay vg0

# lvdisplay  /dev/vg0/lv0
# lvextend  -L+size   vg0   /dev/vg0/lv0
# resize2fs  /dev/vg0/lv0
# lvdisplay  /dev/vg0/lv0

Thursday, 26 April 2012


Some backup utilities in Linux and their usage
----------------------------------------------

dump---suitable for archiving the entire file system
tar,cpio,afio--suitable for archiving specific files or directories.


dump & restore
**************
Dumping file system
-------------------
dump 0uf   /dev/nst0  /home
dump 0uf bkpfile_name /home

0--level full backup
u--update /etc/dumpdates
f--archive file.


Restoration
-----------
cd /directory where to  restore
eg:cd /home

restore rf /dev/nst0
restore rf bkpfile_name

r--Extract the contents of the whole archive in the current directory.
f--archive file.

tar
*********
Backing up
----------
tar cvf /dev/nst0   /home
tar cvf bkpfile_name /home

Restoration
-----------
tar xvf /dev/nst0
tar xvf bkpfile_name


cpio
************
Creating Archive
-----------------
find /home | cpio -o -H tar -F /dev/nst0
find /home | cpio -o -H tar -F bkpfile_name
find /home | cpio -o -H tar > bkpfile_name

Restoring Archive
------------------
cpio -imv -F /dev/nst0
cpio -imv -F bkpfile_name

o--create archive
H--format
F--archive file name
i--restore archive
m--preserve modification time
v--verbose
----------------------------------------------------------------------------------------------------------------------------------
cpio works like tar but it can read input from the "find" command. This is nifty feature. For example you can find out all *.c files and backup with cpio command.# find / -name "*.c" | cpio -o --format=tar > c-file.backup.tar
# find / -iname "*.pl" | cpio -o -H tar > perl-files.tar

You can also specify file name using -F option:# find / -iname "*.pl" | cpio -o -H tar -F perl-files.tar
----------------------------------------------------------------------------------------------------------------------------------
Backup /home dir, to remote system tape drive:
# find /home | cpio -o -H tar -F user@backup.nixcraft.in:/dev/nst0 --rsh-command=/usr/bin/ssh








How to configure timezone in a linux box.

1.Preserve current configuration file if required.
   ***************************************************
# cp  /etc/localtime   /etc/localtime.org

2.Create a link to IST timezone file (/usr/share/zoneinfo/Asia/Calcutta) or copy /usr/share/zoneinfo/Asia/Calcutta  as /etc/localtime.
   ******************************************************************************************************************
# ln  -s   /usr/share/zoneinfo/Asia/Calcutta   /etc/localtime


Test our new configuration.
*******************************
[linuxbox~]$ date
Tue Feb 28 12:07:38 IST 2012

The following note will help you in finding the version of your Operationg system.


Linux
-----
#uname -a
Linux hostname 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:34:33 EDT 2009 i686 i686 i386 GNU/Linux

Example:---------------------
2.6.22-14-generic where,

2 : Kernel version
6 : The major revision of the kernel
22: The minor revision of the kernel
14: Immediate fixing / bug fixing for critical error
generic : Distribution specific string. For example, Redhat appends string such as EL5 to indicate RHEL 5 kernel.

-----------------------------

#lsb_release -a
LSB Version:    :core-3.0-ia32:core-3.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch
Distributor ID: RedHatEnterpriseES
Description:    Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Release:        4
Codename:       NahantUpdate8

-----------------------------
#cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 8)

-----------------------------
#rpm -qa | grep release
redhat-release-4ES-9

-----------------------------
get Revision tree @ http://en.wikipedia.org/wiki/Red_Hat_Enterprise_Linux

-----------------------------


Solaris
-------
uname -a
cat /etc/release


By following the below methods we can check whether we have a 32 bit or 64 bit OS as well as hardware
A 64 bit hardware can support both 32 and 64 bit OS.But the reverse is not possible.

[username@hostname bin]$ uname -a
Linux ip-10-136-41-31 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

x86_64 GNU/Linux indicates that you've a 64bit Linux kernel running. If you use see i386/i486/i586/i686 it is a 32 bit kernel.
------------------------------------------------------------------------------------------------------------
[username@hostname bin]$ uname -m
x86_64
------------------------------------------------------------------------------------------------------------
[user@hostname bin]$ getconf   LONG_BIT
64
------------------------------------------------------------------------------------------------------------
[root@server user]# grep flags /proc/cpuinfo
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl cid xtpr
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm pni monitor ds_cpl cid xtpr
CPU Modes:
·        lm flag means Long mode cpu - 64 bit CPU
·        Real mode 16 bit CPU
·        Protected Mode is 32-bit CPU





Recently I have configured hardware mirroring in T3-2 server.The entire putty log is published.After Raid volume creation we should label it by booting into single user mode from the DVD media otherwise installation software will exit saying hardware failure or unformatted hard disk.


{0} ok probe-scsi-all
/pci@400/pci@2/pci@0/pci@e/scsi@0

FCode Version 1.00.54, MPT Version 2.00, Firmware Version 5.00.17.00

Target 9
  Unit 0   Disk   HITACHI  H103030SCSUN300G A2A8    585937500 Blocks, 300 GB
  SASDeviceName 5000cca01535a7a4  SASAddress 5000cca01535a7a5  PhyNum 0
Target a
  Unit 0   Removable Read Only device   TEAC    DV-W28SS-R      1.0C                   
  SATA device  PhyNum 7
Target b
  Unit 0   Disk   HITACHI  H103030SCSUN300G A2A8    585937500 Blocks, 300 GB
  SASDeviceName 5000cca01535be70  SASAddress 5000cca01535be71  PhyNum 1

/pci@400/pci@1/pci@0/pci@b/pci@0/usb@0,2/hub@2/hub@3/storage@2
  Unit 0   Removable Read Only device    AMI     Virtual CDROM   1.00


{0} ok devalias
screen                   /pci@400/pci@1/pci@0/pci@0/pci@0/display@0
mouse                    /pci@400/pci@1/pci@0/pci@b/pci@0/usb@0,2/hub@2/device@4/mouse@1
igb3                     /virtual-devices@100/channel-devices@200/network@3
igb2                     /virtual-devices@100/channel-devices@200/network@2
igb1                     /virtual-devices@100/channel-devices@200/network@1
igb0                     /virtual-devices@100/channel-devices@200/network@0
primary-cdrom            /virtual-devices@100/channel-devices@200/virtual-disk-server@1
primary-vds0             /virtual-devices@100/channel-devices@200/virtual-disk-server@0
primary-vsw3             /virtual-devices@100/channel-devices@200/virtual-network-switch@3
primary-vsw2             /virtual-devices@100/channel-devices@200/virtual-network-switch@2
primary-vsw1             /virtual-devices@100/channel-devices@200/virtual-network-switch@1
primary-vsw0             /virtual-devices@100/channel-devices@200/virtual-network-switch@0
primary-vcc              /virtual-devices@100/channel-devices@200/virtual-console-concentrator@0
net3                     /pci@500/pci@1/pci@0/pci@5/network@0,1
net2                     /pci@500/pci@1/pci@0/pci@5/network@0
dvd                      /pci@400/pci@2/pci@0/pci@e/scsi@0/disk@p7
disk5                    /pci@400/pci@2/pci@0/pci@e/scsi@0/disk@p5
disk4                    /pci@400/pci@2/pci@0/pci@e/scsi@0/disk@p4
disk3                    /pci@400/pci@2/pci@0/pci@e/scsi@0/disk@p3
disk2                    /pci@400/pci@2/pci@0/pci@e/scsi@0/disk@p2
disk1                    /pci@400/pci@2/pci@0/pci@e/scsi@0/disk@p1
disk0                    /pci@400/pci@2/pci@0/pci@e/scsi@0/disk@p0
disk                        /pci@400/pci@2/pci@0/pci@e/scsi@0/disk@p0
scsi0                       /pci@400/pci@2/pci@0/pci@e/scsi@0
scsi                        /pci@400/pci@2/pci@0/pci@e/scsi@0                             
rcdrom                      /pci@400/pci@1/pci@0/pci@b/pci@0/usb@0,2/hub@2/hub@3/storage@2/disk@0                       
rkeyboard                  /pci@400/pci@1/pci@0/pci@b/pci@0/usb@0,2/hub@2/device@4/keyboard@0
rscreen                    /pci@400/pci@1/pci@0/pci@0/pci@0/display@0:r1280x1024x60
net1                        /pci@400/pci@1/pci@0/pci@4/network@0,1                            
net0                     /pci@400/pci@1/pci@0/pci@4/network@0
net                      /pci@400/pci@1/pci@0/pci@4/network@0
virtual-console          /virtual-devices@100/console@1
name                     aliases



{0} ok select scsi

{0} ok show-children

FCode Version 1.00.54, MPT Version 2.00, Firmware Version 5.00.17.00

Target 9
  Unit 0   Disk   HITACHI  H103030SCSUN300G A2A8    585937500 Blocks, 300 GB
  SASDeviceName 5000cca01535a7a4  SASAddress 5000cca01535a7a5  PhyNum 0
Target a
  Unit 0   Removable Read Only device   TEAC    DV-W28SS-R      1.0C                    
  SATA device  PhyNum 7
Target b
  Unit 0   Disk   HITACHI  H103030SCSUN300G A2A8    585937500 Blocks, 300 GB
  SASDeviceName 5000cca01535be70  SASAddress 5000cca01535be71  PhyNum 1

  {0} ok 9 b create-raid1-volume
Target 9 size is 583983104 Blocks, 298 GB
Target b size is 583983104 Blocks, 298 GB
The volume can be any size from 1 MB to 285148 MB
What size do you want?  [285148 ]
Volume size will be 583983104 Blocks, 298 GB
Enter a volume name:  [0 to 15 characters] raidvol0 0
Volume has been created
{0} ok show-children

FCode Version 1.00.54, MPT Version 2.00, Firmware Version 5.00.17.00

Target a
  Unit 0   Removable Read Only device   TEAC    DV-W28SS-R      1.0C                                                
   SATA device  PhyNum 7
Target 389 Volume 0
  Unit 0   Disk   LSI      Logical Volume   3000    583983104 Blocks, 298 GB
  VolumeDeviceName 3410ff9cf8297976  VolumeWWID 0410ff9cf8297976

{0} ok show-volumes
Volume 0 Target 389  Type RAID1 (Mirroring)
  Name raidvol0  WWID 0410ff9cf8297976
  Optimal  Enabled  Background Init In Progress
  2 Members                                         583983104 Blocks, 298 GB
  Disk 1
    Primary  Optimal
    Target 9      HITACHI  H103030SCSUN300G A2A8
  Disk 0
    Secondary  Optimal
    Target b      HITACHI  H103030SCSUN300G A2A8

{0} ok  reset-all

SPARC T3-2, No Keyboard
Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.32.4, 8192 MB memory available, Serial #96146534.
Ethernet address 0:21:28:bb:14:66, Host ID: 85bb1466.


Boot into single user mode from dvd then label the raid1 volume visible to the OS then restart and continue with OS installation as usual.


{0} ok boot dvd -s   => to label the volume.
                     
Boot device: /pci@400/pci@2/pci@0/pci@e/scsi@0/disk@p7  File and args: -s
|/-\|/-\|/-\|/-
SunOS Release 5.10 Version Generic_142909-17 64-bit
Copyright (c) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-Booting to milestone "milestone/single-user:default".
|/Configuring devices.
-\|/-\|/-\WARNING: /pci@400/pci@2/pci@0/pci@e/scsi@0/iport@v0/disk@w38396a4077c6969a,0 (sd1):
        Corrupt label; wrong magic number

/pci@400/pci@2/pci@0/pci@e/scsi@0 (mpt_sas0):
        send_sep act 0: ioc status:8001|/-\|/Using RPC Bootparams for network configuration information.
Attempting to configure interface igb3...
-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/Skipped interface igb3
Attempting to configure interface igb2...
-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/Skipped interface igb2
Attempting to configure interface igb1...
-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/Skipped interface igb1
Attempting to configure interface igb0...
-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/Skipped interface igb0
-\|/USB keyboard
Requesting System Maintenance Mode
SINGLE USER MODE

# format
Searching for disks...WARNING: /pci@400/pci@2/pci@0/pci@e/scsi@0/iport@v0/disk@w38396a4077c6969a,0 (sd1):
        Corrupt label; wrong magic number

WARNING: /pci@400/pci@2/pci@0/pci@e/scsi@0/iport@v0/disk@w38396a4077c6969a,0 (sd1):
        Corrupt label; wrong magic number

done

c2t38396A4077C6969Ad0: configured with capacity of 277.99GB


AVAILABLE DISK SELECTIONS:
       0. c2t38396A4077C6969Ad0 <LSI-LogicalVolume-3000 cyl 65533 alt 2 hd 64 sec 139>
          /pci@400/pci@2/pci@0/pci@e/scsi@0/iport@v0/disk@w38396a4077c6969a,0
Specify disk (enter its number): 0
selecting c2t38396A4077C6969Ad0
[disk formatted]
WARNING: /pci@400/pci@2/pci@0/pci@e/scsi@0/iport@v0/disk@w38396a4077c6969a,0 (sd1):
        Corrupt label; wrong magic number

Disk not labeled.  Label it now? yes 
WARNING: /pci@400/pci@2/pci@0/pci@e/scsi@0/iport@v0/disk@w38396a4077c6969a,0 (sd1):
        Corrupt label; wrong magic number

WARNING: /pci@400/pci@2/pci@0/pci@e/scsi@0/iport@v0/disk@w38396a4077c6969a,0 (sd1):
        Corrupt label; wrong magic number



FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> p


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> p
Current partition table (default):
Total disk cylinders available: 65533 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0                0         (0/0/0)             0
  1       swap    wu       0                0         (0/0/0)             0
  2     backup    wu       0 - 65532      277.99GB    (65533/0/0) 582981568
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6        usr    wm       0 - 65532      277.99GB    (65533/0/0) 582981568
  7 unassigned    wm       0                0         (0/0/0)             0

partition> q q


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> q

# init 0
# syncing file systems... done
Program terminated

SPARC T3-2, No Keyboard
Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.32.4, 130560 MB memory available, Serial #95507068.
Ethernet address 0:21:28:b1:52:7c, Host ID: 85b1527c.



{0} ok boot dvd     => Now install OS as usual

                               


                              
                        

                              


                              
                        

                              


                              
                         

                              

Kubernetes cluster setup on Ubuntu 26.04 using Kubeadm

Step1: Disable swap memory: Kubernetes requires swap to be disabled for the kubelet to function correctly # swapoff -a # sudo sed -i '/...