Monday, July 8, 2013

Kernel-3.10 Nvidia 325.08 error

Found working patch from the nvidia developers forum. https://devtalk.nvidia.com/cmd/default/download-
comment-attachment/58795/ 

How to apply patch in Gentoo: Just let epatch_user do the work :-)

All you need to do is create a nvidia-drivers dir in /etc/portage/patches/x11-drivers/
mkdir -p /etc/portage/patches/x11-drivers/nvidia-drivers 

Download patch and copy it to newly created directory.
cp ~/Downloads/nvidia-drivers-linux-3.10.patch /etc/portage/patches/x11-drivers/nvidia-drivers/ 

Then just emerge nvidia-drivers or module-rebuild rebuild
PATCHES=/etc/portage/patches emerge -va nvidia-drivers

Wednesday, May 29, 2013

SAMBA Windows DC authentication on RedHat/Centos/Oracle Linux 6.x with SElinux enabled

Install winbind

yum install samba samba-winbind

Kerberos authentication

Create a backup of the krb5.conf file.
mv /etc/krb5.conf /etc/krb5.conf.org
vi /etc/krb5.conf
[logging]
default = FILE:/var/log/krb5.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmin.log
[libdefaults]
default_realm = CONTOSO.COM
dns_lookup_realm = false
dns_lookup_kdc = false
clock_skew = 300
ticket_lifetime = 24h
forwardable = yes
[realms]
CONTOSO.COM = {
kdc = DC.CONTOSO.COM
admin_server = DC.CONTOSO.COM
default_domain = CONTOSO.COM
}
Test kerberos DC connection
kinit administrator 

SMB configuration

Create a backup of the smb.conf file.
mv /etc/samba/smb.conf /etc/samba/smb.conf.org
vi /etc/samba/smb.conf

[global]
workgroup = CONTOSO
realm = CONTOSO.COM
load printers = no
preferred master = no
local master = no
server string = fileserver
password server = 10.0.0.2
encrypt passwords = yes
security = ADS
netbios name = storage
client signing = Yes
dns proxy = No
wins server = 10.0.0.2
idmap uid = 10000-20000
idmap gid = 10000-20000
winbind separator = +
winbind enum users = Yes
winbind enum groups = Yes
winbind use default domain = Yes
auth methods = winbind
template shell = /bin/false
interfaces = lo eth0 127.0.0.1 10.0.0.10
bind interfaces only = yes
#
acl compatibility = auto
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=262144 SO_SNDBUF=262144
getwd cache = yes
#
#log level = 1

Add SAMBA server to Domain

kinit administrator
net ads join -U administrator 
Start winbind
/etc/init.d/winbind start
/etc/init.d/winbind status
net rpc getsid 
or
net rpc getsid net rpc getsid -S CONTOSO.COM -U administrator

Edit /etc/nsswitch.conf and add wins to do host lookups.
hosts: files dns wins
Check winbind get domain users/grups
wbinfo -u 
wbinfo -g 
Now tell PAM that samba requires authentication and account from winbind. Add the following lines to /etc/pam.d/samba
vi /etc/pam.d/samba
auth required /lib/security/pam_winbind.so 
account required /lib/security/pam_winbind.so
Edit the /etc/nsswitch.conf file so it will look like this:
vi /etc/nsswitch.conf 
passwd: compat winbind 
group: compat winbind 
shadow: compat

Create a share. 

First we need to create a folder

mkdir –p /data/share

chmod 777 /data/share

Mount filesystem

vi /etc/fstab

/dev/sda3   /data/share      ext4    rw,acl,user_xattr       0 0
mount /data/share
# Or remount existing partition
#mount -o remount /data/share

Enable SELinux share permission (relable)

chcon -R -t samba_share_t '/data/share'
Open the /etc/samba/smb.conf file and paste the following lines:
vi /etc/samba/smb.conf
[share]
comment = share
read only = no
path = /data/share
hide files = /lost+found/
valid users = @"CONTOSO+domain users"
admin users = @"CONTOSO+Domain Admins", root , administrator
write list = @"CONTOSO+Domain Admins" , root , administrator
read list = @"CONTOSO+domain users"
available = yes
browseable = yes
public = yes
writable = yes
acl check permissions = Yes
acl group control = Yes
acl map full control = Yes
#acl map full control = no
force unknown acl user = No
dos filemode = no
inherit permissions = yes
store dos attributes = no
map archive = No
map hidden = No
map system = No
map readonly = No
nt acl support = Yes
map acl inherit = yes
profile acls = No
inherit owner = No
inherit acls = yes
acl group control = yes
vfs objects = acl_xattr
Restart the Samba service via:
/etc/init.d/samba restart
Test the new share. Go to your Windows box and browse to the Linux box via \\share

Debuging

SAMBA reset ACL on file or directory

setfacl -b FileOrFolder

SAMBA show ACL

getfacl FileOrFolder

SAMBA set ACL group

setfacl -m g:group:rw  FileOrFolder

SAMBA set ACL user

setfacl -m u:user:r FileOrFolder

Tuesday, April 2, 2013

GitLab 5.0 installation RedHat

Rewriting the default protocol for GitHub for those using proxy to access Internet on servers:

git config --global url.https://github.com/.insteadOf git://github.com/


after this git prefers https:// protocol over git://. 

This is very useful when you are using scripts for in installation.

If you want to install Gitlab with proxy you would get

Fetching git://github.com/gollum/gollum.git
github.com: errno=Connection refused
after changing protocol to https everything runs smooth ;-)

For large projects check timeout in ~/gitlab/config/unicorn.rb

GitLab error
OpenSSL Errors and Rails – Certificate Verify Failed – Gem::RemoteFetcher::FetchError

http://railsapps.github.com/openssl-certificate-verify-failed.html
source 'http://rubygems.org'

Monday, March 18, 2013

Using lftp for mirroring files from a remote ftp or even better http server.


lftp -c "open www.remoteserver.com/directory/; mirror"

Ten parallel transfers
lftp -c "open www.remoteserver.com/directory/; mirror --parallel=10"

Use lftp as download accelerator for a single file
lftp -e 'pget -n 5 ftp://path/to/file'

Friday, December 14, 2012

Monitor dmesg in real time with watch.



watch "dmesg | tail -20"

Analyze the boot process with the blame command ARCH linux


Install graphics tools in ARCH

pacman -S eog dot2tex

Script
#-------------------------------
#!/bin/bash

systemd-analyze
systemd-analyze blame
systemd-analyze plot > /tmp/graph.svg

systemd-analyze dot | dot -Tsvg > /tmp/dot-graph.svg
echo "Show graph
eog /tmp/graph.svg 
eog /tmp/dot-graph.svg
"
#------------------------------- 

Plot svg graph example


Plot svg dot-graph example

Monday, November 26, 2012

Problem with SMART probing sata disk on some chipsets/sata controllers results system is freeze (ata exception frozen).




Very annoying linux / hardware bug triggered by SMART ata check it only manifests in some cases of SATA controllers and hard disks. In my case:

On M3A32-MVP DELUXE controller
Marvell Technology Group Ltd. 88SE6121 SATA II / PATA Controller

Error in /ver/log/messages looks like this:

[  115.670018] ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[  115.670027] ata5.00: failed command: SMART
[  115.670036] ata5.00: cmd b0/d0:01:00:4f:c2/00:00:00:00:00/00 tag 0 pio 512 in
         res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
[  115.670039] ata5.00: status: { DRDY }
[  115.670047] ata5: hard resetting link
[  115.989123] ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[  116.088351] ata5.00: configured for UDMA/133
[  116.088380] ata5: EH complete
[ 7300.699855] ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[ 7300.699863] ata5.00: failed command: IDENTIFY DEVICE
[ 7300.699872] ata5.00: cmd ec/00:01:00:00:00/00:00:00:00:00/00 tag 0 pio 512 in
         res 40/00:00:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
[ 7300.699876] ata5.00: status: { DRDY }
[ 7300.699883] ata5: hard resetting link
[ 7301.019187] ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[ 7301.131523] ata5.00: configured for UDMA/133
[ 7301.131557] ata5: EH complete

Bug reports 

Solution  - testing 
Gentoo udev rules are located in /usr/lib/udev/rules.d

Locate 80-udisks.rules and remove following line:
KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="ata", ENV{DEVTYPE}=="disk", IMPORT{program}="udisks-probe-ata-smart $tempnode"

Rrepeat every time after update of udev.