Tuesday, 16 February 2021

SAMBA:- How to fix CIFS Error Mount: wrong fs type, bad option, bad superblock

Test Case:- We have tried to mount the samba share from the Linux samba-client box.


 [root@san-client ~]# findsmb

                                *=DMB

                                +=LMB

IP ADDR         NETBIOS NAME     WORKGROUP/OS/VERSION

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

192.168.1.113   ANSIBLE-CONTROL [       SAMBA         ]

[root@san-client ~]#


[root@san-client ~]# smbclient -L //192.168.1.113

Enter SAMBA\root's password:

Anonymous login successful

        Sharename       Type      Comment

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

        print$          Disk      Printer Drivers

        noc             Disk      Printer Drivers

        IPC$            IPC       IPC Service (Samba 4.10.16)

Reconnecting with SMB1 for workgroup listing.

Anonymous login successful

        Server               Comment

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

        Workgroup            Master

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

        SAMBA


[root@san-client ~]# mount -t cifs //192.168.1.113/noc /mnt -o user=sai1

mount: wrong fs type, bad option, bad superblock on //192.168.1.113/noc,

       missing codepage or helper program, or other error

       (for several filesystems (e.g. nfs, cifs) you might

       need a /sbin/mount.<type> helper program)

       In some cases useful info is found in syslog - try

       dmesg | tail or so.

[root@san-client ~]#


Solution:-

[root@san-client ~]# rpm -qa |grep cifs

[root@san-client ~]#


[root@san-client ~]# yum install cifs-utils

.....

.....

  Installing : cifs-utils-6.2-10.el7.x86_64                                                                                          1/1

  Verifying  : cifs-utils-6.2-10.el7.x86_64                                                                                          1/1


Installed:

  cifs-utils.x86_64 0:6.2-10.el7


Complete!

[root@san-client ~]#mount -t cifs //192.168.1.113/noc /mnt -o user=sai1

Password for sai1@//192.168.1.113/noc:


[root@san-client ~]# cd /mnt

[root@san-client mnt]#ls -l

total 0

-rwxr-xr-x 1 root root 0 Feb 15 22:06 abc1

-rwxr-xr-x 1 root root 0 Feb 15 22:06 abc2

drwxr-xr-x 2 root root 0 Feb 15 22:07 sam1

drwxr-xr-x 2 root root 0 Feb 15 22:07 sam2

drwxr-xr-x 2 root root 0 Feb 15 22:07 sam3

drwxr-xr-x 2 root root 0 Feb 15 22:07 sam4

drwxr-xr-x 2 root root 0 Feb 15 22:07 sam5

[root@san-client ~]#




Thursday, 11 February 2021

resize2fs: Bad magic number in super-block while trying to open lvm

 Note: While extending the LVM I got below errors

Case:-

 OS: CentOS 7.9

Error:-

resize2fs 1.42.9 (28-Dec-2013)

resize2fs: Bad magic number in super-block while trying to open /dev/mapper/zgroup-stf1

Couldn't find valid filesystem superblock.


FYI,








Now, I want to extend the LVM(mta1) +100MB.













As per the Centos 7 default filesystem is xfs.

xfs file system support only extend not reduce. So if you want to resize the filesystem use xfs_growfs rather than resize2fs.

xfs_growfs /dev/mapper/zgroup-stf1 

Note: 

For ext4 filesystem use, we can use the resize2fs

resize2fs /dev/mapper/zgroup-stf1 














Tuesday, 9 February 2021

osboxes VM:-(CentOS7) - Cannot find a valid baseurl for repo: base/7/x86_64

 I have observed this error on CentOS7 VM.  I have tried a couple of things and finally, I have fixed them with the below steps. 


FYI,








#yum update //i got below error








Then I will execute the below commands,

[root@osboxes]# ONBOOT=no

[root@osboxes]# dhclient

[root@osboxes]# yum update













I hope it will help you.

Friday, 9 October 2020

Logrotate with compress and delaycompress options.

Step1:-

[root@sankar ~]#  cat /etc/logrotate.d/sankar_myapp

/var/hvmail/log/myapp_event-processor/logfile.log {
    su root root
    rotate 7
    hourly
    compress
    delaycompress
}
[root@sankar ~]# 


Step2:- Dry run (-d) option

[root@sankar ~]# logrotate -d /etc/logrotate.d/sankar_myapp
...
....


Step3:- 
with the exception of the most recent one, should be compressed.


[root@sankar ~]# cd /var/hvmail/log/myapp_event-processor/ 

[root@sankar  myapp_event-processor]# ls -ltrh
total 28M
-rw-rwxr-x 1  root          root   23K Oct  9 09:03 logfile.log.2.gz
-rw-rwxr-x 1 root           root      421K Oct  9 10:06 logfile.log.1
-rw-rwxr-x 1 root           root      427K Oct  9 10:59 logfile.log


Tuesday, 14 July 2020

Shell script - how to Disable/Lock a list of users in Linux

Shell Script Examples

Linux Users:-  abc,  xyz, sankar, sai

Script:-
root@sankar:~#  for i in abc xyz sankar sai; do echo "Locking user $i" && passwd -l "$i" ; done

Locking user abc
Locking password for user abc.
passwd: Success
Locking user xyz
Locking password for user xyz.
passwd: Success
Locking user sankar
Locking password for user sankar.
passwd: Success
Locking user sai
Locking password for user sai.
passwd: Success

Friday, 26 June 2020

OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"ping\": executable file not found in $PATH": unknown

root@sankar:~# docker container exec -it my_nginx ping new_nginx
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"ping\": executable file not found in $PATH": unknown
root@sankar:~#



Step1:- Inspect the networks

root@sankar:~# docker network inspect my_app_network
...
...
Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "8552c9a1a0b2ba2868e50e23da0041af55a4289d34c0ba52aa513e7f27b7288b": {
                "Name": "new_nginx",
                "EndpointID": "0a2e1f480d6e83775b883a1fe2f957b6fb12cf30f3815e5f77455972e08f2752",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "172.18.0.3/16",

                "IPv6Address": ""
            },
            "bf91af54c120c162993e53574143d2e8c0d783b53e8b6e0c539f04d5a54c78e3": {
                "Name": "my_nginx",
                "EndpointID": "54c248889596acb6055106f1ce7edec2513608062e10309094b1fcb4f3fbcb4e",
                "MacAddress": "02:42:ac:12:00:02",
                "IPv4Address": "172.18.0.2/16",

                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]


                                                                                                                                                    
Step3:- Install the ping on both the containers.


root@sankar:~# docker container exec -it my_nginx  bash 
root@bf91af54c120:/#
 
root@bf91af54c120:/# apt update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]        
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [204 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7905 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [7868 B]                                                                        
Fetched 8355 kB in 14s (596 kB/s)                                                                                                                     
Reading package lists... Done
Building dependency tree      
Reading state information... Done
All packages are up to date.


root@bf91af54c120:/# apt-get install iputils-ping

Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  libcap2 libcap2-bin libpam-cap
The following NEW packages will be installed:
  iputils-ping libcap2 libcap2-bin libpam-cap
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 104 kB of archives.
After this operation, 319 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://deb.debian.org/debian buster/main amd64 libcap2 amd64 1:2.25-2 [17.6 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 iputils-ping amd64 3:20180629-2+deb10u1 [43.3 kB]
Get:3 http://deb.debian.org/debian buster/main amd64 libcap2-bin amd64 1:2.25-2 [28.8 kB]
Get:4 http://deb.debian.org/debian buster/main amd64 libpam-cap amd64 1:2.25-2 [14.3 kB]
Fetched 104 kB in 1s (166 kB/s)     
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libcap2:amd64.
(Reading database ... 7632 files and directories currently installed.)
Preparing to unpack .../libcap2_1%3a2.25-2_amd64.deb ...
Unpacking libcap2:amd64 (1:2.25-2) ...
Selecting previously unselected package iputils-ping.
Preparing to unpack .../iputils-ping_3%3a20180629-2+deb10u1_amd64.deb ...
Unpacking iputils-ping (3:20180629-2+deb10u1) ...
Selecting previously unselected package libcap2-bin.
Preparing to unpack .../libcap2-bin_1%3a2.25-2_amd64.deb ...
Unpacking libcap2-bin (1:2.25-2) ...
Selecting previously unselected package libpam-cap:amd64.
Preparing to unpack .../libpam-cap_1%3a2.25-2_amd64.deb ...
Unpacking libpam-cap:amd64 (1:2.25-2) ...
Setting up libcap2:amd64 (1:2.25-2) ...
Setting up libcap2-bin (1:2.25-2) ...
Setting up libpam-cap:amd64 (1:2.25-2) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up iputils-ping (3:20180629-2+deb10u1) ...
Processing triggers for libc-bin (2.28-10) ...
root@bf91af54c120:/#


Step4:- Final check
root@sankar:~# docker container exec -it my_nginx ping new_nginx
PING new_nginx (172.18.0.3) 56(84) bytes of data.
64 bytes from new_nginx.my_app_net (172.18.0.3): icmp_seq=1 ttl=64 time=0.277 ms
64 bytes from new_nginx.my_app_net (172.18.0.3): icmp_seq=2 ttl=64 time=0.122 ms
64 bytes from new_nginx.my_app_net (172.18.0.3): icmp_seq=3 ttl=64 time=0.123 ms
64 bytes from new_nginx.my_app_net (172.18.0.3): icmp_seq=4 ttl=64 time=0.107 ms
^C
--- new_nginx ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 32ms
rtt min/avg/max/mdev = 0.107/0.157/0.277/0.069 ms
root@osboxes:~#

Thursday, 18 June 2020

Earn your FREE New Relic Fundamentals Certification !!

How to crack aws solution architect associate certification

Hello everybody,


I am happy to share that, I have completed my APM certification from the New Relic University.


Steps:-
1.
You need to register through below link

https://learn.newrelic.com/series/fundamentals

2
Please deeply concentrate on the 5min videos and you will complete the assessment.

3.
You must achieve a passing score of 80% or higher on each individual assessment section.


4. Roadmap.




ALL THE BEST !!