Solved: Error on labeling the disk

You may get below error when you are trying to label a new disk in Solaris.

format> la
 WARNING - This disk may be in use by an application that has
 modified the fdisk table. Ensure that this disk is
 not currently in use before proceeding to use fdisk.

Solution:-

Before you proceed for the solution ensure that this is the correct disk which you want to label.

  • Once you are sure about the correct disk, select the disk from the format menu.
  • Before you try labeling the disk execute "fdisk" while in format menu.
format> fdisk
 No fdisk table exists. The default partition for the disk is:

a 100% "SOLARIS System" partition

Type "y" to accept the default partition, otherwise type "n" to edit the
 partition table.
  • Once you press "y" it will accept the default disk layout.
  • Now you can also change the disk layout format as per your requirement and finally label the disk.

Solved: How to get out of Virtual box console window

You can easily get out of the virtual box machine console window by pressing the “ctrl” button on the right side of the keyboard. i.e. the “ctrl” button which is near the arrow keys.

Solved: How to stop data balance notifications from Idea mobile internet

If you are using Idea Mobile network you would have noticed that  whenever your data connection is stopped you get a notification of how much data balance is left now.
This can be useful to know your data balance. But these notifications gets very irritating specially since the network switches frequently between 2G, 3G and 4G.
In this post we will see how to turn off these notifications.
  • Dial *121# from your mobile.
  • Select the option “Self care” . Generally its option 4.
  • Select “Data Notification” . Option 5 .
  • Select “Stop notification” . Option 2
Finally you will get the message that your data notifications will stop soon. It generally stops in 5 minutes.
Hope this post helps you. Do let me know if you have any query.

Solved: ERROR: current transaction is aborted - Redshift

Problem:-
[Amazon](500310) Invalid operation: current transaction is aborted, commands ignored until end of transaction block;
Solution:-
If you are getting the above error while you are connected to Redshift, ensure that you have checked the “Autocommit” box below the “Password” box in SQL Workbench/J connection window. (refer image below)

Once you check the “Autocommit” box try connecting to the Redshift cluster again.

Solved: docker - error during connect

sagu@sagu-pc MINGW64 ~$ docker image lserror during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.29/images/json: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.sagu@sagu-pc MINGW64 ~
If you are getting above error while running the docker commands in Docker Quickstart Terminal then you can have one of the listed problem.
  • The docker deamon is not running.
  • The docker host machine itself is down.
  • Required configuration file is missing.
First check that the host machine is up and the configuration file is present at its location. Once you are sure both the above things are ok, in that case easiest way to get rid of this issue is to open the Docker Quickstart Terminal by selecting “Run as Administrator” .  It will take some time to start but let it complete and you should be back in business soon.

Solved: How to allow remote root login in Solaris

In this post we will show you how you allow root login to a solaris sevrer from a remote machine.
  • Login to the Solaris Server via console as root user.
  • Modify the /etc/ssh/sshd_config . Look for the PermitRootLogin entry in the file and change it from no to yes .
PermitRootLogin yes
  • Finally refresh the ssh service so that it re-read the configuration changes you made to sshd_config. For Solaris 10 you can refresh ssh service using svcadm.
     svcadm refresh svc:/network/ssh:default
  • For Solaris 7,8 & 9 you can restart ssh service as below.
     /etc/init.d/sshd restart

Solved: How to reset root password in Redhat Linux or CentOS

In this post we will discuss how to reset the root password of a Redhat linux server if you forgot it.
  • Reboot the server
  • While you are at boot menu press “Up or Down” arrow key to prevent system from booting.
  • Select the boot device and press “e” to edit it.
  • Scroll down the program with arrow key, till you see a line starting with “linux16”. That line will have words “rhgb quiet” .(refer Image 1)


Image 1

  • Now change  “rhgb quiet” to init=/bin/bash  as in image 2.


Image 2

  • After making the change press “ctrl x” to boot the system.
  • Screen will now take you to command prompt without asking for password.
On the command prompt remount root as read-write.
mount -o remount,rw /
Now execute “passwd” command to change the password of root user.  (refer image)



Tip:
  1. Pick strong password else it will throw error of bad password and may not change the password.
  2. If you are getting error “passwd command not found” ensure that your machine is booted with the disk and not the ISO. Many people working on VMs make this mistake so you are not alone 🙂
  • If you are using SElinux you will have to run this extra relabel step before reboot or else you won’t be able to login with the new password.
touch  /.autorelabel
  • Finally reboot the server
exec /sbin/init
Now you should be able to login with new password.
Hope this post is helpful to you. Do let me know if you have any query.

Solved: How to mount ISO in a linux VM

In this post we will discuss how to mount ISO in Linux VM running inside Virtualbox or VMware.
Virtualbox
You can mount ISO in Linux VM running on Virtualbox by following these steps
  • Select the running machine window.
  • Click on Devices > Optical Devices
  • Choose disk image, browse and select ISO .
  • Now go to the redhat linux server and execute the mount command
 mount /dev/cdrom /mnt
VMware
  • If the linux VM is in VMware. You can select the iso image in vmware console similar to what we did for virtual box.
  • Right click on the machine > “Removable Devices” > “CD/DVD” > Settings. Browse and select the ISO. Check mark on “Connected”.
  • Finally execute the following command in Linux VM.
    mount /dev/sr0 /mnt
  • If you do “df -h” new ISO should be mounted and visible to you as /mnt .
Tip: If you are getting error /mnt busy ensure that /mnt is not already mounted. If /mnt is already mounted either unmount /mnt first and try again or create a new directory and mount the ISO on the new directory.

Solved: Reactivate hardware raid volume after system board replacement- Solaris

Replacing the systemboard/motherboard of a server which has hardware RAID enabled is a major activity. In this post we will discuss about the steps that you should follow.
Caution:- You should be extremely careful while doing this activity and take complete backup of all your data.
1) Collect the explorer and take full backup of all data specially OS.
2) Bring down the server.
3) Replace the motherboard and put back the old disks in server.
4) Change the setting from SP to factory default as many refurbished system board may have old LDOM config in them. It can be done as below:-
LDOM Resetting through the Service Processor.
-> set /HOST/bootmode config="factory-default"

-> stop /SYS

Are you sure you want to stop /SYS (y/n)? y
Wait for machine to power off.
We can then power on the system.
-> start /SYS

Are you sure you want to start /SYS (y/n)? y

Starting /SYS

-> start /SP/console
5) Now upgrade the firmware so that it's same as the firmware of old board. It can be done using sysfwdownload utility. Follow the readme of firmware patch for detailed instructions.
6) If you cannot see the disks in OS which are in hardware RAID it can be because the volume is inactive. It can be activated from ok prompt as follows:-
Go to the OBP prompt.
At the command line, set the auto-boot? and fcode-debug? variables to false and reset the system.
 ok setenv auto-boot? false
 auto-boot? = false
 ok setenv fcode-debug? true
 fcode-debug? = true
 ok reset-all
Find the path to the controller.
 ok show-disks
 a) /pci@0/pci@0/pci@2/LSILogic,sas@0/disk
 b) /pci@0/pci@0/pci@1/pci@0/usb@1,2/storage@1/disk
 q) NO SELECTION
 Enter Selection, q to quit: q
 ok
Note - You are looking for the path to the controller. It generally contains the phrase “LSILogic,sas@0” or the phrase “scsi@0“.
Select the controller.
 ok select /pci@0/pci@0/pci@2/LSILogic,sas@0
Show the volumes, look for any inactive volumes.
 ok show-volumes
Activate the inactive volumes. Repeat the command to activate all inactive volumes. For example, to activate volume number 1 type:
ok 1 activate-volume
Note - There might be more than two inactive RAID volumes, but you cannot activate more than two.
Deselect the controller.
ok unselect-dev
Set the auto-boot? and fcode-debug? variables to true and reset the system.
ok setenv auto-boot? true
 auto-boot? = true
 ok setenv fcode-debug? true
 fcode-debug? = true
 ok reset-all
7) Once the volume is enabled you should be able to see the LSI disk in probe-scsi-all and also in format once the server is booted.
Note:- This post is created just for your reference. Please try it first in your test server. We are not responsible for any loss caused by following this tutorial.

Solved: How to come out of VMware console

If you want to come out of vmware console window simply press Alt + Ctrl or Ctrl + Alt any of the two sequence will work.
If you want the movement between your host machine and VMware console to be seamless, install VMware tools in the guest VM.  This will ensure that you don’t have to press Ctrl+ Alt  every time.
Check this site to download VMware tools.

Solved: Install and use rsync in Linux and Solaris - Tips and Tricks

rsync is a very useful utility which can be used to take backup or copy data from one filesystem to other. The best part with rysnc is that it considers incremental data while copying and syntax is easy.
rsync is popular with Linux and included in most versions by default. If you don't have rsync in machine you can simply install it by following commands:-
Ubuntu / Debian
sudo ap-get update
sudo apt-get install rsync
RHEL / CentOS
yum install rsync
Solaris
Now rsync is available in Solaris also. Oracle has now started including rsync in Solaris 10 and Solaris 11. You can also download it from My Oracle Support website or from here .
Using rsync
Once you have installed rsync you can use it for copying data from one FS to other. Check the the example here
 rsync -avzp --ignore-existing --exclude="lost+found" --exclude=".snapshot" /source/ /target/
-p option is very important as it as it preserves all permissions including ACLs.
rsync and NFS
If you want you can also sync the filesystem which is on another server.
One way of doing it is to mount the source or target filesystem as NFS.
Let's say we have mounted the the target filesystem as NFS on source server then the syntax will be:-
rsync -avzp --ignore-existing --exclude="lost+found" --exclude=".snapshot" /source/ /targetNFS/
rsync and ssh
Or, if you don't want to use NFS you can do the same with ssh.
  • First exchange ssh keys between the source and destination server so that the servers can ssh to each other.
  • Once you ensure that ssh is working fine between the source and destination server let's move ahead.
  • In the below example we are initiating rsync from target server so we have mentioned the IP of source server.
rsync -avzp --ignore-existing --exclude="lost+found" --exclude=".snapshot" --rsh='ssh -p 22' root@Source_Server_IP_ADDRESS:/source/ /target/
Scheduling rsync in cron
If you want you can schedule the rsync in cron also. In the below example we will schedule to run the cron job at 3:30 daily.
30 3 * * * rsync -avzp --ignore-existing --exclude="lost+found" --exclude=".snapshot" --rsh='ssh -p 22' root@Source_IP:/source/ /target/ >/dev/null 2>&1
Options available in rsync.
-v, --verbose increase verbosity
-q, --quiet suppress non-error messages
--no-motd suppress daemon-mode MOTD (see caveat)
-c, --checksum skip based on checksum, not mod-time & size
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
--no-OPTION turn off an implied OPTION (e.g. --no-D)
-r, --recursive recurse into directories
-R, --relative use relative path names
--no-implied-dirs don̢۪t send implied dirs with --relative
-b, --backup make backups (see --suffix & --backup-dir)
--backup-dir=DIR make backups into hierarchy based in DIR
--suffix=SUFFIX backup suffix (default ~ w/o --backup-dir)
-u, --update skip files that are newer on the receiver
--inplace update destination files in-place
--append append data onto shorter files
--append-verify --append w/old data in file checksum
-d, --dirs transfer directories without recursing
-l, --links copy symlinks as symlinks
-L, --copy-links transform symlink into referent file/dir
--copy-unsafe-links only "unsafe" symlinks are transformed
--safe-links ignore symlinks that point outside the tree
-k, --copy-dirlinks transform symlink to dir into referent dir
-K, --keep-dirlinks treat symlinked dir on receiver as dir
-H, --hard-links preserve hard links
-p, --perms preserve permissions
-E, --executability preserve executability
--chmod=CHMOD affect file and/or directory permissions
-A, --acls preserve ACLs (implies -p)
-X, --xattrs preserve extended attributes
-o, --owner preserve owner (super-user only)
-g, --group preserve group
--devices preserve device files (super-user only)
--specials preserve special files
-D same as --devices --specials
-t, --times preserve modification times
-O, --omit-dir-times omit directories from --times
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
-n, --dry-run perform a trial run with no changes made
-W, --whole-file copy files whole (w/o delta-xfer algorithm)
-x, --one-file-system don̢۪t cross filesystem boundaries
-B, --block-size=SIZE force a fixed checksum block-size
-e, --rsh=COMMAND specify the remote shell to use
--rsync-path=PROGRAM specify the rsync to run on remote machine
--existing skip creating new files on receiver
--ignore-existing skip updating files that exist on receiver
--remove-source-files sender removes synchronized files (non-dir)
--del an alias for --delete-during
--delete delete extraneous files from dest dirs
--delete-before receiver deletes before transfer (default)
--delete-during receiver deletes during xfer, not before
--delete-delay find deletions during, delete after
--delete-after receiver deletes after transfer, not before
--delete-excluded also delete excluded files from dest dirs
--ignore-errors delete even if there are I/O errors
--force force deletion of dirs even if not empty
--max-delete=NUM don̢۪t delete more than NUM files
--max-size=SIZE don̢۪t transfer any file larger than SIZE
--min-size=SIZE don̢۪t transfer any file smaller than SIZE
--partial keep partially transferred files
--partial-dir=DIR put a partially transferred file into DIR
--delay-updates put all updated files into place at end
-m, --prune-empty-dirs prune empty directory chains from file-list
--numeric-ids don̢۪t map uid/gid values by user/group name
--timeout=SECONDS set I/O timeout in seconds
--contimeout=SECONDS set daemon connection timeout in seconds
-I, --ignore-times don̢۪t skip files that match size and time
--size-only skip files that match in size
--modify-window=NUM compare mod-times with reduced accuracy
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
--compare-dest=DIR also compare received files relative to DIR
--copy-dest=DIR ... and include copies of unchanged files
--link-dest=DIR hardlink to files in DIR when unchanged
-z, --compress compress file data during the transfer
--compress-level=NUM explicitly set compression level
--skip-compress=LIST skip compressing files with suffix in LIST
-C, --cvs-exclude auto-ignore files in the same way CVS does
-f, --filter=RULE add a file-filtering RULE
-F same as --filter=̢۪dir-merge /.rsync-filter̢۪
repeated: --filter=̢۪- .rsync-filter̢۪
--exclude=PATTERN exclude files matching PATTERN
--exclude-from=FILE read exclude patterns from FILE
--include=PATTERN don̢۪t exclude files matching PATTERN
--include-from=FILE read include patterns from FILE
--files-from=FILE read list of source-file names from FILE
-0, --from0 all *from/filter files are delimited by 0s
-s, --protect-args no space-splitting; wildcard chars only
--address=ADDRESS bind address for outgoing socket to daemon
--port=PORT specify double-colon alternate port number
--sockopts=OPTIONS specify custom TCP options
--blocking-io use blocking I/O for the remote shell
--stats give some file-transfer stats
-8, --8-bit-output leave high-bit chars unescaped in output
-h, --human-readable output numbers in a human-readable format
--progress show progress during transfer
-P same as --partial --progress
-i, --itemize-changes output a change-summary for all updates
--out-format=FORMAT output updates using the specified FORMAT
--log-file=FILE log what we̢۪re doing to the specified FILE
--log-file-format=FMT log updates using the specified FMT
--password-file=FILE read daemon-access password from FILE
--list-only list the files instead of copying them
--bwlimit=KBPS limit I/O bandwidth; KBytes per second
--write-batch=FILE write a batched update to FILE
--only-write-batch=FILE like --write-batch but w/o updating dest
--read-batch=FILE read a batched update from FILE
--protocol=NUM force an older protocol version to be used
--iconv=CONVERT_SPEC request charset conversion of filenames
--checksum-seed=NUM set block/file checksum seed (advanced)
-4, --ipv4 prefer IPv4
-6, --ipv6 prefer IPv6
--version print version number
(-h) --help show this help (see below for -h comment)

Solved: How to create hardware RAID in Solaris

If you want to create hardware RAID in Solaris you can use raidctl utility.
  • Let’s create a mirrored RAID volume. Before you start remember that raidctl will destroy all data on the disk so be absolutely sure that you selected right disks.
# raidctl -c c0t0d0 c0t1d0Creating RAID volume c0t0d0 will destroy all data on member disks, proceed (yes/no)? yes...Volume c0t0d0 is created successfully!#
  • Once you have created the RAID it can be in four below states:-
OPTIMAL – Disks in RAID are online and fully synchronized.
SYNC – Disks syncing is in progress.
DEGRADED – Shows that one of the disk in RAID is failed.
FAILED – When one or both disks are lost and you have to recreate the volume.
  • Let’s check the current status of our volume.
# raidctl -l c0t0d0Volume            Size     Stripe     Status    Cache     RAID       Sub                 Size                           Level            Disk----------------------------------------------------------------c0t0d0            136.6G   N/A        SYNC       OFF      RAID1            0.0.0 136.6G              GOOD            0.1.0 136.6G              GOOD
  • In the above output we can see that the sync is going on. While in below output we can see that disks are in sync now and RAID is optimal. Also we can see that it’s RAID 1 which is mirroring.
# raidctl -l c0t0d0Volume            Size     Stripe     Status    Cache     RAID       Sub                 Size                           Level            Disk----------------------------------------------------------------c0t0d0            136.6G   N/A        OPTIMAL   OFF      RAID1            0.0.0 136.6G              GOOD            0.1.0 136.6G              GOOD
If you want to change the system board of a system with hardware RAID, you will have to reactivate the volumes after hardware replacement. Refer to the post,  steps to follow for hardware replacement and reactivate hardware .

Solved: How to use nmcli for adding new IP and managing network in Redhat Linux

In this post we will see how to use nmcli for adding and configuring the IP. To do the same activity with nmuti refer this post.

"nmcli" is a command line interface. Benefit with both nmtui and nmcli is that you don't have to update the network configuration files manually. All the required changes are done by nmtui and nmcli themselves.
Good thing with nmcli is that you don't have to install any extra package like nmtui. nmcli is generally included with NetworkManager.
  • Let's create our new connection.
[root@cloudvedas ~]# nmcli con add type ethernet con-name cldvds-2 ifname enp0s3 ip4 192.168.99.103/24 gw4 192.168.99.1
Connection 'cldvds-2' (33de1c00-4ab4-4777-0a43-c004f0bd47ff) successfully added.
[root@cloudvedas ~]#
In the above example we are using these parameters:-
Connection name:- cldvds-2
Network Interface:- enp0s3
IP/Netmask:- 192.168.99.103/24
Gateway:- 192.168.99.1
  • Check in nmcli if our new connection is present.
[root@cloudvedas ~]# nmcli con show
NAME                 UUID                                 TYPE       DEVICE
System enp0s8    00cb8200-feb0-44b7-a378-3fdc720e0bc7 802-3-ethernet enp0s8
enp0s3           1a03478c-0307-4f23-a7fa-247ad74c37bf 802-3-ethernet --
cldvds-1         303ccf07-e77c-4770-b787-370407f73edc 802-3-ethernet enp0s3
cldvds-2         33de1c00-4ab4-4777-0a43-c004f0bd47ff 802-3-ethernet --
[root@cloudvedas ~]#
We can see the new connection cldvds-2 is created.
  • Activate the new connection
nmcli con up cldvds-2
  • If you are following up from the last post we will first deactivate our old connection cldvds-1 and then activate our new connection cldvds-2 .
[root@cloudvedas network-scripts]# nmcli con down cldvds-1 ; nmcli con up cldvds-2
  • Let's check if our ip got plumbed using command "ip addr"

Yes we can see the new IP up and running
  • As I said earlier "nmcli" will automatically update the config file. You can find the file in the directory "/etc/sysconfig/network-scripts" . Cross check the contents of the file
cd /etc/sysconfig/network-scripts
cat ifcfg-cldvds-2
You can also modify the connection properties. Let's say you want to add DNS server to the connection we created.
[root@cloudvedas ~]# nmcli con mod cldvds-2 ipv4.dns "192.168.99.254"
If you want to assign IP using DHCP you can create a new dhcp connection
[root@cloudvedas ~]# nmcli con add type ethernet con-name dhcp-1 ifname enp0s3
You can activate the new dhcp connection.(Be careful because if you are connected with the same interface which you are changing, you will lose the connection.)
nmcli con down cldvds-2 ; nmcli con up dhcp-1
Bonus:-
If you want to add an IPv6 IP to the interface you can do it with ip6 and gw6 options.
[root@cloudvedas ~]# nmcli con add type ethernet con-name cldvds-ip6 ifname enp0s3 ip4 192.168.99.104/24 gw4 192.168.99.1 ip6 fe80::cafe gw6 2001:db8::1
Connection 'cldvds-ip6' (83fb7f17-fc2f-424c-b446-33c929abcb56) successfully added.
Activate the connection
[root@cloudvedas ~]# nmcli con down cldvds-2 ; nmcli con up cldvds-ip6
If you no longer need a connection you can delete it after deactivating it.
[root@cloudvedas ~]# nmcli con down cldvds-ip6
[root@cloudvedas ~]# nmcli con delete cldvds-ip6
Hope this post is helpful to you. Do let me know if you have any query.

Solved: How to change hostname using nmtui or nmcli in redhat linux

In our last post we have seen how to change hostname manually or with hostnamectl .
In this post we will discuss how to change hostname with nmtui and nmcli tools.
nmtui
Let’s first try with nmtui tool
  • If you don’t have the nmtui tool installed, you can install it using yum
yum install NetworkManager-tui
  • Invoke the nmtui interface from the command line by executing as root user
nmtui
  • In the menu select “Set system hostname” .
  • Write the new hostname which you want to keep.  We want to change it to “prodvedas”.

  • To make it effective restart the “hostnamed” service
systemctl restart systemd-hostnamed
  • Now if you login with new session or do “su -” in same session you should see new hostname.
nmcli
Let’s try changing the hostname with nmcli tool in Redhat Linux.
  • To check the current hostname
nmcli general hostname
  • If you want to change the hostname
nmcli general hostname prodvedas
  • To make it effective restart hostnamed service
systemctl restart systemd-hostnamed
  • Now if you login with new session or do “su -” in same session you should see new hostname.
Hostname changed by any of the above method will be persistent across reboot.
If you are trying to change hostname of AWS EC2 linux instance the process will be slightly different. Refer this post to change AWS EC2 instance hostname.

Solved: Three options to convert ova to ovf files

Sometime you may have to open OVA files, which are actually just zip of OVF files.
You can extract or convert OVA to OVF file in three ways as mentioned below
Option 1
Tar Command
If you have access to Linux or Unix box you can use tar command to extract the file.
tar -xvf cloudvedas-OpenStackHOL.ova
Option 2
In Windows you can use a tool like like 7-Zip or winrar to extract the file.
Option 3
Vmware ovftool
Download Vmware OVF tool 
Once you have downloaded and installed the tool go to the command prompt and change the directory to where you have installed the ovf tool. You should see an exe called “ovftool.exe”.
Execute the command:-
ovftool.exe "E:\Software\Openstack\cloudvedas-OpenStackHOL.ova" "E:\Software\Openstack\cloudvedas-OpenStackHOL.ovf"

Check out our post on Most useful Tar command examples .