size of machine 64 or 32 bit - unix

If I am working on a Unix machine, how could I know the size of the machine whether it is 64-bit or 32-bit machine?

AIX you can do this:
getconf KERNEL_BITMODE
HP-UX you can do this:
getconf KERNEL_BITS
or just:
getconf -a | grep KERN
Sun Solaris you can do this:
isainfo -v
For Linux, yes, the uname -a should do the trick

You can type
uname -m
if i686 or i386 is appearing, you are working with 32 bit
if X86_64 is appearing, you are working with 64 bit

I have to deal with a lot of Unix platforms and generally the best way I have found is to look at the output of "uname -a". For example, if you see something like "i686 i686 i386 GNU/Linux" in the output you know it's a 32 bit machine. If "amd64" shows up it's a 64. Sometimes it's a matter of trying to run a 64 bit programme. Sometimes it's RTFM.

If you're just looking to check the architecture of a machine you're on,
%> uname -a
from the command line usually contains an indication in the output.

You can also try sizeof(int *). Should be 4 on 32 bit machines and 8 on 64 bit machines.

Assuming you want to do this at compile time - take a look here for architecture macros you can test. You are probably looking for __x86_64__.

Related

Machine with Nvidia card:Issues with mount command on ubuntu using hostname

OS: Ubuntu14.04 64 bit
I have a strange problem occuring on machines with Nvidia cards running Ubuntu 14.04 64 bit.
The mount command works when using the IP address but fails when using the host name
Not-working command :
sudo -S mount -t cifs //share.test.com/LAB/Testing/Path1/Path2/Requisite/ -o username=blabla,password=blabla /mnt/src_shar_lnx
the error being
mount: wrong fs type, bad option, bad superblock on //share.test.com/LAB/Testing/Path1/Path2/Requisite/ ,
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
The above command works seamlessly on other machines without Nvidia cards.
Working command:
sudo -S mount -t cifs //192.168.200.1/LAB/Testing/Path1/Path2/Requisite/ -o username=blabla,password=blabla /mnt/src_shar_lnx
Resolved.
installing cifs-utils solved the problem

WHEREIS Command not returning result in AIX

Environment: AIX 5
Using whereis does not return the file-names of source/binary files I am looking for.
For example:
whereis FILE
returns
whereis:
Also tried the above command with suitable command options (-b , -m, -s) .. still the same result.
Anyone aware of the change required to modify the syntax of this command to suit the AIX Unix flavor.
Suggestions much appreciated.
I wish folks who ask questions about AIX would put the version of AIX they are running.
whereis works on my 6.1 machine and my 5.3 machine. I usually use type. It is in ksh and in bash and it is built-in. Here is a log of some commands I did:
type whereis
whereis is /bin/whereis
whereis whereis
whereis: /usr/bin/whereis
What fileset is where is in?
lslpp -w /usr/bin/whereis
File Fileset Type
----------------------------------------------------------------------------
/usr/bin/whereis bos.rte.commands File
Ok. what level of that fileset do I have?
lslpp -ch bos.rte.commands
#Path:Fileset:Level:PTF Id:Action:Status:Date:Time
/usr/lib/objrepos:bos.rte.commands:6.1.8.16::APPLY:COMPLETE:12/26/13:14;44;04
/etc/objrepos:bos.rte.commands:6.1.8.16::APPLY:COMPLETE:12/26/13:14;44;08
I thought whereis use to be a script but on my hosts they are binary executables. Here is the output of what on my 5.3 host:
what /usr/bin/whereis
/usr/bin/whereis:
61 1.14 src/bos/usr/ccs/lib/libc/__threads_init.c, libcthrd, bos530 7/11/00 12:04:14
93 1.13 src/bos/usr/bin/whereis/whereis.c, cmdscan, bos53H, h2005_32B1 7/6/05 08:53:01
And from my 6.1 host:
what /usr/bin/whereis
/usr/bin/whereis:
61 1.16 src/bos/usr/ccs/lib/libc/__threads_init.c, libcthrd, bos61B, b2007_33A0 8/2/07 13:09:21
93 1.13.1.1 src/bos/usr/bin/whereis/whereis.c, cmdscan, bos610 2/11/07 14:12:18
I would not be surprised if the SHELL environment variable is involved in all this so you might see if it is set to something odd. I keep my SHELL set to /usr/bin/ksh and then I have my .kshrc exec's me over to bash. Some scripts on AIX do not have the #!/usr/bin/ksh at the top which causes some issues. At this date, I have not bumped into that in a while.
I'm curious what you find. I'm curious what level of AIX you are running.
Good luck

Command to get L2 Cache size of Sparc and x86 processor with Solaris

what is the command to know the L2 cache size of CPU on Solaris operating system running on Sparc and x86 processors.
I don't have access to a Solaris box to test this out, but you might be able to achieve this using prtpicl.
prtpicl -v -c cpu | grep l2-cache-size
For a more portable option, check out the lstopo command from the hwloc project.
On sparc just run fpversion (/product/SUNWspro/bin/fpversion) and it will print the xcache code-generation options that show the L1 and L2 cache sizes. Then read http://docs.oracle.com/cd/E19205-01/819-5267/bkazt/index.html to understand it.

What does cifs_mount failed w/return code = -22 indicate

I am trying
sudo mount -t cifs //<server>/<share> -o username=user#domain,password=**** /mnt/<mountpoint>
error message:
mount: wrong fs type, bad option, bad superblock on //server/share,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
The syslog has
CIFS VFS: cifs_mount failed w/return code = -22
I am able to mount the same share on another centos system. I can ping the server, mount point directory has been created.
I ran into this problem when using a host name and solved it by using an IP address. E.g.:
use
mount -t cifs //192.168.1.15/share
rather than
mount -t cifs //servername/share
Another possible solution is to install
cifs-utils
.
Ah, the dreaded -22. Basically this seems to be used as a catchall for "something didn't work", although technically it's referred to as an invalid argument.
The client does IMHO a very poor job of telling you the actual problem. (This may not be its fault - it doesn't always have access to that information).
However -- have you checked the logs on the server/machine you are connecting to?
I was connecting to an OS X samba server, and learned from what I found in the logs there that it was necessary to specify additional options under -o as follows:
nounix,sec=ntlmssp
Among the things these settings enable are "allow long names", and "ignore UNIX filename endings"...sec is to specify security flags.
Another possibility is that you're trying to access a filesystem of a type that mount.cifs can't actually handle.
For RHEL/Centos install package - "cifs-utils"
Maybe move the target?
sudo mount -t cifs -o username=user#domain,password=**** //<server>/<share> /mnt/<mountpoint>
Or maybe this solution? (Ubuntu, Debian methods)
sudo apt-get install smbfs
Or for CentOS, RedHat, Fedora try:
sudo yum install samba-client
I had a similar issue on Ubuntu 12.04 with the "mount" package (version 2.20.1-1ubuntu3).
It happened when I was trying to mount the server share using its hostname rahter than its IP.
Another way to solve the issue on Ubuntu was to install the cifs-utils package. That way I could also mount the samba share using the exact same command line (or fstab) but with hostname.
sudo mount -t cifs //hostname/share -o username=user,password=pwd /mnt/share
Just did a clean install of Ubuntu 12.04 LTS and got this trying to hook up my Linux HTPC.
Solved it by running: sudo apt-get install cifs-utils then remounting it.
CIFS returns code "-22" in many cases (not only invalid arguments).
For me installing keyutils did the trick:
apt-get install keyutils
My distribution is "Ubuntu 14.04.2 LTS".
I figured this out by increasing the logging verbosity of CIFS:
echo 7 > /proc/fs/cifs/cifsFYI
# disable again via:
#echo 0 > /proc/fs/cifs/cifsFYI
Documentation on the bitmask ("7") for cifsFYI can be found here: https://www.kernel.org/doc/readme/Documentation-filesystems-cifs-README
After trying to mount once more dmesg included more helpful information:
Dec 7 12:34:20 pc1471 kernel: [ 5442.667417] CIFS VFS: dns_resolve_server_name_to_ip: unable to resolve:
Another maybe helpful link:
http://vlkan.com/blog/post/2015/01/08/smb-mount-troubleshoot/
I have Ubuntu Server 12.10 x64 installed as a VMware VM, running on OS X 10.8 (Mountain Lion).
On the Mac, in SYSTEM PREFERENCES > SHARING > FILE SHARING (on), I added a folder to share. For my tests, I created a new folder within my Public folder called "ubuntu".
In Ubuntu, I issued the following commands:
sudo mkdir /media/target
sudo mount.cifs //10.0.20.3/ubuntu /media/target -o username=davidallie,nounix,sec=ntlmssp,rw
Ubuntu prompted me for the password and, once entered, mounted the folder. I then ran:
df -H
which allowed me to verify the mounts and mount-points.
This has recently manifested thanks to a kernel bug in v5.18.8+, I was able to reproduce on v5.18.9 and v5.18.11.
Here is the relevant ticket on kernel.org, quote:
it appears that kernel 5.18.8 breaks cifs mounts on my machine. With
5.18.7, everything works fine. With 5.18.8, I am getting:
$ sudo mount /mnt/openmediavault/
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel
log messages (dmesg)
The relevant /etc/fstab line is:
//odroidxu4.local/julian /mnt/openmediavault cifs
credentials=/home/julas/.credentials,uid=julas,gid=julas,vers=3.1.1,nobrl,_netdev,auto
0 0
Here is the offending commit, and here is the fix, which applies cleanly to v5.18.11. The cause is, from what I understand, a bug in old versions of the samba server in the negotiation protocol.
If this is your issue, you can:
patch your kernel yourself;
downgrade to v5.18.7;
switch to an LTS kernel;
use the userspace (and also really slow and awful) gvfs-smb;
upgrade the samba version on your server; or
add vers=2.0 to the mount.cifs options in /etc/fstab.
Note that while I haven't tried the last one personally, the venerable #SEBiGEM has confirmed in the comments that it works for v5.18.10.
Note also that I didn't try upgrading samba on the server at all because I hate touching the box it's running on - every time I upgrade anything everything breaks. Doing so might also not be an option for those with NAS appliances.
As a personal sidenote, it's a little sad that so many different things can cause -22. My answer is correct, but very very niche and specific to this point in time. I imagine in a month it will simply be useless noise.
Just experience the problem on RHEL 5. You don't need to install the samba suite, just the samba-client and any dependencies.
Maybe it's too late, but simplest solution described in kernel bug 50631:
in the latest code, unc mount parameter in mandatory. Modified command works for me:
sudo mount -t cifs //<server>/<share> -o username=user#domain,password=****,unc=\\\\<server>\\<share> /mnt/<mountpoint>
Try run the comamnd:
$modinfo cifs
filename: /lib/modules/3.2.0-60-virtual/kernel/fs/cifs/cifs.ko
version: 1.76
description: VFS to access servers complying with the SNIA CIFS Specification e.g. Samba and Windows
license: GPL
author: Steve French <sfrench#us.ibm.com>
srcversion: 9435BBC2F61D29F06643803
depends:
intree: Y
vermagic: 3.2.0-60-virtual SMP mod_unload modversions 686
parm: CIFSMaxBufSize:Network buffer size (not including header). Default: 16384 Range: 8192 to 130048 (int)
parm: cifs_min_rcv:Network buffers in pool. Default: 4 Range: 1 to 64 (int)
parm: cifs_min_small:Small network buffers in pool. Default: 30 Range: 2 to 256 (int)
parm: cifs_max_pending:Simultaneous requests to server. Default: 32767 Range: 2 to 32767. (int)
parm: echo_retries:Number of echo attempts before giving up and reconnecting server. Default: 5. 0 means never reconnect. (ushort)
parm: enable_oplocks:Enable or disable oplocks (bool). Default:y/Y/1 (bool)
If your getting any error then cifs is not installed. Just check with your admin. I thought it helps out.
Adding the option vers=3.0 to the mount command worked for me: sudo mount -t cifs -v <src> <dst> -o ...,vers=3.0,...
You need to install cifs-utils first , just as follows:
sudo yum install cifs-utils
I know this is old, but on older cifs-utils versions, you may have to add the following two lines to /etc/request-key.conf
create cifs.spnego * * /usr/sbin/cifs.upcall -c %k
create dns_resolver * * /usr/sbin/cifs.upcall %k
Workaround without installing additional packages (cifs-utils adds another 81mb in Debian Stretch):
$ FILESERVER_IP=$(getent hosts myfileserver.com | awk '{ print $1 ; exit }')
$ sudo mount -t cifs //${FILESERVER_IP}/<share> -o username=user#domain,password=**** /mnt/<mountpoint>
Many answers, but wasn't work for me.
Solution:
My NAS didn't support Samba 3.0, on which my mount switch automatically.
So I downgraded smb version:
mount -t cifs //192.168.0.2/Share -o rw,vers=1.0,username=*****,password=******* /media/1
It's work.

How do I figure out a computer's architecture from the command line?

Is there a standard program I can use to find out whether I'm on an i386 or x86, 32-bit or 64-bit machine? I'm on a Unix box.
uname -a
less /proc/cpuinfo
There should be more info there...

Resources