-

Freenas: Plagued by name to sid deadlock errors?

Posted by aionman on Jul 9, 2015 in Linux, NAS, Networking

And here are the permissions as seen on Windows. I have Account Unknown, where probably I want it to recognize it as something like jnewsome (Unix User\jnewsome).  And the Freenas console shows something like

“STATUS=deamon on ‘winbindd’ finsihed starting up and ready to serve connectionssam_sids_to_names: possible deadlock – trying to lookup SID S-XXXXXX”

[​IMG]

Solution:

service samba_server stop
sqlite3 /data/freenas-v1.db ‘update services_cifs set cifs_SID=”S-1-5-21-1590911872-798304854-2854342261″‘
service ix-pre-samba start
service samba_server start

 

[root@freenas] ~# net groupmap list
users (S-1-5-21-1590911872-798304854-2854342261-1001) -> users
[root@freenas] ~# net groupmap delete sid=”S-1-5-21-1590911872-798304854-2854342261-1001″
Sucessfully removed S-1-5-21-1170145438-4009580803-3350505473-1001 from the mapping db
[root@freenas] ~# net groupmap add unixgroup=users rid=1001
Successfully added group users to the mapping db as a domain group​

And also try this

  1. fetch “http://download.freenas.org/errata/fixsid.py” -o /usr/local/bin/fixsid.py
  2. chmod 755 /usr/local/bin/fixsid.py
  3. mount -urw /
  4. hash -r
  5. fixsid.py
  6. Run the commands the script says to after completion or reboot

 
-

VMWare could not start after updaing Centos 6 kernel

Posted by aionman on Jan 10, 2015 in CentOS, Linux, VMWare

When update my Centos 6 to kernel 2.6.32-504 , my VMWare Workstation 10.0.3 doesn’t work, when start the vm appear the error.

could open /dev/vmmon: No such file or directory.

 

  1. sudo service vmware stop
  2. sudo rm /lib/modules/$(uname -r)/misc/vmmon.ko
  3. sudo vmware-modconfig –console –build-mod vmmon /usr/bin/gcc /lib/modules/$(uname -r)/build/include/
  4. sudo depmod -a
  5. sudo service vmware start

 

Chose there best essayhttp://customessayhere.com/!

 
-

LVM Resizing

Posted by aionman on Dec 23, 2013 in Linux

LVM Resizing Overview


In our LVM Configuration KB, we showed how to create a linear mapped logical volume (LV).  In this KB, we are going to build on our LVM knowledge and show you how to resize an existing ext3 file system and it’s associate LV.

Note: Procedures for resizing XFS, ResierFS and other volumes may differ.  You should check your documentation for non ext3 volumes before proceeding.  Resizing a file system can also be destructive if not done properly.  You should always make sure you have a backup of your data before attempting a resize!

Logical Volumes can be increased or decreased in size depending on your needs.  However, resizing the LV does not eliminate the need to resize the file system contained within the LV.  This is an important concept to understand since resizing the LV without resizing the file system can cause corruption of your data.

In the following pages, we will guide you through expanding and contracing LV’s and their associated file systems.  Let’s get to it!

 

 

Grow File System


Increasing the size of a file system managed with LVM can be done online (with the file system mounted.)  In order to grow the LV and file system:

  • Check to see if free space exists on the LV that contains the file system
  • Expand the LV if it does not contain enough free space (which could require expanding the volume group if it is out of free space)
  • Grow the file system to utilize all available space on the LV

Lets get started!

  1. First, check the size of the file system to see if it needs expanding
    [root@Linux01 ~]# pwd
    /TCPDumpLV
    [root@Linux01 TCPDumpLV]# df -kh .
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/TCPDumpVolGRP-TCPDumpLV 3.1G 2.9G 69M 98% /TCPDumpLV

    Note: The disk free command shows that we have 65MB available on our file system and that its 98% use.  If we don’t take action soon, we risk filling the file system.

  2. Let’s find out which Volume Group contains the Logical Volume that holds /dev/mapper/TCPDumpVolGRP-TCPDumpLV
    [root@Linux01 ~]# lvdisplay /dev/TCPDumpVolGRP/TCPDumpLV
    — Logical volume —
    LV Name /dev/TCPDumpVolGRP/TCPDumpLV
    VG Name TCPDumpVolGRP
    LV UUID hYQs4t-YtY7-51hl-c4ps-4N6d-2W7h-IidcxF
    LV Write Access read/write
    LV Status available
    # open 1
    LV Size 3.12 GB
    Current LE 100
    Segments 1
    Allocation inherit
    Read ahead sectors auto
    – currently set to 256
    Block device 253:5

    Note: You can see the volume group for this file system is TCPDumpVolGRP

  3. Let’s find out if the volume group TCPDumpVolGRP has available free space to allocate to the logical volume
    [root@Linux01 ~]# vgdisplay TCPDumpVolGRP
    — Volume group —
    VG Name TCPDumpVolGRP
    System ID
    Format lvm2
    Metadata Areas 3
    Metadata Sequence No 5
    VG Access read/write
    VG Status resizable
    MAX LV 0
    Cur LV 2
    Open LV 2
    Max PV 0
    Cur PV 3
    Act PV 3
    VG Size 11.91 GB
    PE Size 32.00 MB
    Total PE 381
    Alloc PE / Size 228 / 7.12 GB
    Free PE / Size 153 / 4.78 GB
    VG UUID 9fWFIS-vDlg-xOW6-Xmb8-Tkrg-GPZw-ZnUZwh

    Note: This volume group has plenty of free space.  If we were out of physical extents, we would have to add additional physical volumes to this volume group before continuing on.

  4. We will now resize the logical volume TCPDumpLV by adding 3GB
    [root@Linux01 TCPDumpLV]# lvresize -L +3GB /dev/TCPDumpVolGRP/TCPDumpLV
    Extending logical volume TCPDumpLV to 6.12 GB
    Logical volume TCPDumpLV successfully resized
    [root@Linux01 TCPDumpLV]#
  5. Confirm the new size of the logical volume
    [root@Linux01 ~]# lvdisplay /dev/TCPDumpVolGRP/TCPDumpLV
    — Logical volume —
    LV Name /dev/TCPDumpVolGRP/TCPDumpLV
    VG Name TCPDumpVolGRP
    LV UUID hYQs4t-YtY7-51hl-c4ps-4N6d-2W7h-IidcxF
    LV Write Access read/write
    LV Status available
    # open 1
    LV Size 6.12 GB
    Current LE 196
    Segments 2
    Allocation inherit
    Read ahead sectors auto
    – currently set to 256
    Block device 253:5

    [root@Linux01 ~]# pwd
    /TCPDumpLV
    [root@Linux01 TCPDumpLV]# df -kh .
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/TCPDumpVolGRP-TCPDumpLV 3.1G 2.9G 69M 98% /TCPDumpLV

    Note: You will notice that although we have increased the size of the logical volume, the size of the file system has been unaffected.

  6. We now need to resize the ext3 file system to utilize the remaining available space within the logical volume
    [root@Linux01 TCPDumpLV]# resize2fs -p /dev/mapper/TCPDumpVolGRP-TCPDumpLV
    resize2fs 1.39 (29-May-2006)
    Filesystem at /dev/mapper/TCPDumpVolGRP-TCPDumpLV is mounted on /TCPDumpLV; on-line resizing required
    Performing an on-line resize of /dev/mapper/TCPDumpVolGRP-TCPDumpLV to 1605632 (4k) blocks.
    The filesystem on /dev/mapper/TCPDumpVolGRP-TCPDumpLV is now 1605632 blocks long.
    [root@Linux01 TCPDumpLV]# df -kh .
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/TCPDumpVolGRP-TCPDumpLV 6.1G 2.9G 2.9G 50% /TCPDumpLV

Nice work, you just resized your file system while it was online!  Now lets take a look at reducing the size of a file system.

 

 

 

Shrink File System


Decreasing the size of a file system managed with LVM must be done off-line (unmounted.)  To shrink the file system and LV:

  • Unmount the file system
  • Run a file system check to ensure the integrity of the volume
  • Shrink the file system
  • Shrink the logical volume

Note: You cannot shrink the file system beyond the amount of free space that is available on it.  So if the file system you want to shrink has 1GB of free space, you will only be able to shrink the volume by 1GB.  However, logical volumes are not as forgiving.  If you are not careful, you can shrink the LV to a size less than what is required by the file system.  If the LV is resized smaller than what the file system has been resized to, things will go very badly for you.  Did we mention you should backup your data before hand?

Let’s get started!

  1. First, check to see how much space is available
    [root@Linux01 ~]# pwd
    /TCPDumpLV
    [root@Linux01 TCPDumpLV]# df -kh .
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/TCPDumpVolGRP-TCPDumpLV 6.1G 922M 4.9G 16% /TCPDumpLV

    Note: The disk free command shows that we are using 922MB and have 4.9G available on our file system.  Therefore, we can safely shrink the volume to 1.5G (leaving a little bit for overhead) without any issue.

  2. Unmount the file system
    [root@Linux01 TCPDumpLV]# cd /
    [root@Linux01 /]# umount /TCPDumpLV
  3. Check the file system for errors
    [root@Linux01 /]# e2fsck -f /dev/mapper/TCPDumpVolGRP-TCPDumpLV
    e2fsck 1.39 (29-May-2006)
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    /dev/mapper/TCPDumpVolGRP-TCPDumpLV: 13/802816 files (7.7% non-contiguous), 261017/1605632 blocks
    [root@Linux01 /]#
  4. Shrink the file system to 1.5GB
    [root@Linux01 /]# resize2fs /dev/mapper/TCPDumpVolGRP-TCPDumpLV 1500M
    resize2fs 1.39 (29-May-2006)
    Resizing the filesystem on /dev/mapper/TCPDumpVolGRP-TCPDumpLV to 384000 (4k) blocks.
    The filesystem on /dev/mapper/TCPDumpVolGRP-TCPDumpLV is now 384000 blocks long.

    [root@Linux01 /]#

  5. Shrink the logical file system to 1.5GB
    [root@Linux01 /]# lvresize -L 1.5G /dev/TCPDumpVolGRP/TCPDumpLV
    WARNING: Reducing active logical volume to 1.50 GB
    THIS MAY DESTROY YOUR DATA (filesystem etc.)
    Do you really want to reduce TCPDumpLV? [y/n]: y
    Reducing logical volume TCPDumpLV to 1.50 GB
    Logical volume TCPDumpLV successfully resized
    [root@Linux01 /]#

    Note: Special precaution should be taken with this step.  It’s possible to reduce the logical volume size by more than the size of the file system.  If you do reduce the LV size by more than what you resized the file system to (from step #4), this will almost certainly end very badly for you.  Ensure the LV is large enough for the file system and that you make a backup before hand!

  6. Verify the new size of the logical volume
    [root@Linux01 ~]# lvdisplay /dev/TCPDumpVolGRP/TCPDumpLV
    — Logical volume —
    LV Name /dev/TCPDumpVolGRP/TCPDumpLV
    VG Name TCPDumpVolGRP
    LV UUID hYQs4t-YtY7-51hl-c4ps-4N6d-2W7h-IidcxF
    LV Write Access read/write
    LV Status available
    # open 0
    LV Size 1.50 GB
    Current LE 48
    Segments 1
    Allocation inherit
    Read ahead sectors auto
    – currently set to 256
    Block device 253:5

  7. Remount the file system and verify the new size
    [root@Linux01 /]# mount /dev/TCPDumpVolGRP/TCPDumpLV
    [root@Linux01 /]# cd /TCPDumpLV/

    [root@Linux01 TCPDumpLV]# df -kh .
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/TCPDumpVolGRP-TCPDumpLV 1.5G 920M 497M 65% /TCPDumpLV

 
-

VMware Workstation-10.0.1 fails after RedHat-6 / Centos software update

Posted by aionman on Dec 21, 2013 in CentOS, Linux, VMWare, Windows 7, Windows XP
No problems in XP or Windows 7 VMs anymore.
Summary of what I did:$ sudo service vmware stop$ sudo mv -v /usr/lib/vmware/modules/binary /usr/lib/vmware/modules/binary.orig

$ sudo rm -v /lib/modules/$(uname -r)/misc/v*.ko

$ sudo depmod -a

#I already had gcc, make, and the kernel headers, but if anyone is following this, they should probably make sure

$ sudo yum install make gcc kernel-headers-$(uname -r)

start vmware

 
-

Using DD for disk cloning

Posted by aionman on Sep 27, 2013 in Linux

There’s been a number of questions regarding disk cloning tools and dd has been suggested at least once. I’ve already considered using dd myself, mainly because ease of use, and that it’s readily available on pretty much all bootable Linux distributions.

dd is most certainly the best cloning tool, it will create a 100% replica simply by using the following command. I’ve never once had any problems with it.

dd if=/dev/sda of=/dev/sdb bs=32M

(add a “bs=100M conv=notrunc” and it could be much faster)
Be aware that while cloning every byte, you should not use this on a drive or partition that is being used. Especially applications like databases can’t cope with this very well and you might end up with corrupted data.

 

 

 
-

How to install Google Chrome 28+ on CentOS 6

Posted by aionman on Sep 16, 2013 in Linux

How to install Google Chrome 28+ on CentOS 6

The problem

Sadly, the Google folks apparently think that the world’s most popular commercial Linux (Red Hat Enterprise Linux aka RHEL) and its free equivalents (e.g. CentOS and Scientific Linux) are no longer worth supporting at all w.r.t. their Google Chrome browser.

Yes, they’ve dropped support for version 6.X of the above RHEL-based platforms from Google Chrome 28 onwards, despite the OSes being the latest release and fully supported by their respective maintainers until November 2020! It’s equally bad that the latest Mozilla Firefox and Opera browsers run happily on the platforms, providing short shrift for any excuses the Google folks have come up with to justify their somewhat blinkered support stance.

I’ve built Chromium from regularly pulled source code in the past for CentOS 5 and it’s a tough job on that platform and I didn’t want to do it again for CentOS 6.

The solution

Luckily, there is a solution to this and it’s not rocket science or that original either. You need to grab libraries from a more recent Linux distro, put them in a tree (/opt/google/chrome/lib) exclusively picked up by Google Chrome and then you can indeed run Google Chrome on CentOS 6.4 or later.

I’ve picked Fedora 15 RPMs to extract the libraries from because they’re the closest to CentOS 6’s libraries and the oldest ones to actually work with the latest Google Chrome release. Before you ask, I’ve tried the Fedora 16 libraries and the Google Chrome binary crashes using those. Without further ado, I present to you…

The download

install_chrome.sh 4.20 (22nd August 2013 – use yum check-update ahead of OmahaProxy if possible, don’t rely on exact OmahaProxy versions [any newer version will do] when installing, removed terminal warning because of Google Chrome 29 fix)

It’s a bash sell script, so you run it as root as follows:

chmod u+x install_chrome.sh
./install_chrome.sh

IMPORTANT NOTE:
In order for nacl_helper to start correctly, the current release requires you to disable SELinux e.g. temporarily with “echo 0 >/selinux/enforce” as root or permanently by editing /etc/selinux/config to set SELINUX=permissive and then rebooting. A future release will hopefully set some SELinux policies to avoid this requirement.

The script has optional command line arguments – here’s the output of “./install_chrome.sh -h”:

Syntax: ./install_chrome.sh [-b] [-d] [-h] [-n] [-q] [-s] [-t tmpdir] [-u] [-U]

-b (or --beta) will switch to beta versions (google-chrome-beta).
-d (or --delete) will delete the temporary directory used for downloads
   if an installation was successful.
-h (or -? or --help) will display this syntax message.
-n (or --dryrun) will show what actions the script will take,
   but it won't actually perform those actions.
-q (or --quiet) will switch to "quiet mode" where minimal info is displayed.
   Specify -q twice to go completely silent except for errors.
-s (or --stable) will switch to stable versions (google-chrome-stable),
   which is the default if -b or -U haven't previously been specified.
-t tmpdir (or --tmpdir tmpdir) will use tmpdir as the temporary directory
   parent tree rather than $TMPDIR (if set) or /tmp.
-u performs an uninstallation of Google Chrome and chrome-deps rather the
   default action of an installation.
-U (or --unstable) will switch to unstable versions (google-chrome-unstable).

I would recommend you read the comments at the top of the script and inspect the code carefully since you need to run it as root. It will do a fair amount of downloads to get what it needs and if it finishes successfully, you should be able to run the “google-chrome” command as a non-root user.

http://chrome.richardlloyd.org.uk/

 

 
-

How to speed my too-slow ssh login?

Posted by aionman on May 31, 2013 in Linux, Networking

When I’m trying to ssh to a remote server, after I enter the username, it takes a lot of time before it displays the password prompt. Basically, my SSH ( openSSH ) is slow during authentication process. How do I solve this problem?’

$ ssh -v root@remote-host
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to remote-host [1.1.1.1] port 22.
debug1: Connection established.
debug1: identity file /home/allen/.ssh/identity type -1
debug1: identity file /home/allen/.ssh/id_rsa type -1
debug1: identity file /home/allen/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent

debug1: SSH2_MSG_SERVICE_ACCEPT received <-- OpenSSH hanging here for 1 min

debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/root/.ssh/identity
debug1: Trying private key: /home/root/.ssh/id_rsa
debug1: Trying private key: /home/root/.ssh/id_dsa
debug1: Next authentication method: password

Solution: set UseDNS to no in sshd_config file

To fix this performance issue while connecting to a remote server using ssh, set the UseDNS to no as shown below in your /etc/ssh/sshd_config file.

$ vi /etc/ssh/sshd_config
UseDNS no

Restart the openssh and connect to the remote server again, which should be quick this time and will not hang at SSH2_MSG_SERVICE_ACCEPTED.

# service sshd restart

$ ssh -v root@remote-host

 
-

Disable ipv6 on CentOS 6

Posted by aionman on Feb 28, 2013 in Linux, Networking

With several late CentOS 6.2 systems being built on the network I have been running into network disconnect and performance issues being caused by IPV6. Since I am currently not using it on my network I decided to disable it. Here is what I found from several different resources on the Internet.

We can modify /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

Disable in the running system:

echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6

or

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

 
-

IPtables: open port for specific IP

Posted by aionman on Feb 26, 2013 in Linux

Command and Syntax

There seems to be a lot of confusion with this, so I’m going to make this quick any easy. IPtables is a stateful firewall tht is both powerful and efficient. That being said, let’s look at how to restrict a port or service to a specific IP or range of IPs. Entering the following at root will allow SSH connections from the first two locations and drop them from everywhere else:

iptables -I INPUT -p tcp -m tcp -s 70.85.189.123 --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m tcp -s 70.85.189.100/29 --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m tcp -s 0.0.0.0/0 --dport 22 -j DROP

Remember, if you want this configuration to survive reboots, you will need to use the command iptables-save. Red hat-based systems will store the configuration in the files /etc/sysconfig/iptables. If you would like to edit this file directly, use the following:

-A INPUT -p tcp -m tcp -s 70.85.189.123 --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp -s 70.85.189.100/29 --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp -s 0.0.0.0/0 --dport 22 -j DROP

Remember, IPtables like most hardware firewalls, uses stateful packet inspection. It will read the rules in order from top to bottom. This is why we put all the allowed networks first and then put in a blanket deny all (0.0.0.0/0). You can enter hosts into IPtables using any of the following formats:

IP address: ex. 70.85.189.123
DNS name: ex. skullbox.net
CIDR: ex. 70.85.189.100/29

 
-

SAMBA share – ACCESS DENIED from Windows 7

Posted by aionman on Oct 11, 2012 in CentOS, Linux, Windows 7, Windows XP

 

Need to disable SELinux

How do I turn off SELINUX in Redhat or CentOS?

Run the following command to check if SELinux is running:
# getenforce

You can effectively disable it by running the following command
# setenforce Permissive

This will put selinux in a passive mode until the machine is rebooted. If you would like to permanently alter the attributes of selinux, view the SELINUX= line in /etc/sysconfig/selinux.

Copyright © 2017 IT Support Blog All rights reserved. Theme by Laptop Geek.