SyntaxHighlighter JS

2018-02-04

MacBook Pro 2012 broken GPU fix

I have a 17" 2011 MacBook Pro that suffers from the notorious GPU video failure (https://www.bit-tech.net/news/tech/laptops/apple-admits-gpu-design-flaw/1/)

Here is the work-around to turn off the GPU. Credit to PeytonPlaysMc

  1. Boot into Recovery Mode
    Hold Command+R+S keyboard buttons while pressing the power button
  2.  Disable System Integrity Protection (SIP)
     
    Type on the command prompt
    csrutil disable
  3. Reboot MacBook Pro into Single User mode
    Type on the command prompt
    reboot
    Then hold Command+S keyboard buttons
  4. Hard disk check
    Type on the command prompt
    /sbin/fsck -fy
  5. Mount root file system in read-write mode
    Type on the command prompt
    /sbin/mount -uw /
  6. Make a directory to save the AMD drivers
    Type on the command prompt
    mkdir /AMD_save
  7. Move AMD drivers to the save directory
    Type on the command prompt
    mv /System/Library/Extensions/AMD* /AMD_save
  8. Delete AMD driver cache
    Type on the command prompt
    rm -rf /System/Library/Caches/com.apple.kext.caches/
  9. Create AMD drive cache directory

    Type on the command prompt
    mkdir /System/Library/Caches/com.apple.kext.caches/
  10. Force refresh of drive cache
    Type on the command prompt
    touch /System/Library/Extensions/
  11. Reboot MacBook Pro to normal mode. Graphics will run slow at this point

    Type on the command prompt
    reboot
  12. Boot into Recovery Mode
    Restart MacBook Pro while holding Command+R+S
  13. Enable System Integrity Protection (SIP)
     
    Type on the command prompt
    csrutil enable
  14. Reboot MacBook Pro to normal mode.Type on the command prompt
    reboot
  15. Launch Terminal in UI and type
    sudo nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00
  16. Restart MacBook Pro one final time

2017-11-28

Debugging sshd and sssd

After patching a CentOS 7 server with the latest rpms, ssh would not authenticate with Active Directory.

To debug,

1. Become root on the Unix server.
  sudo su -

2. Stop the sshd service (Note: this will not kill your current session)
  systemctl stop sshd

3. Start sshd in debug mode. The debug output will print on the terminal
  /sbin/sshd -d

4. From another terminal, ssh into the server
  ssh username@server

5. The sshd debug messages showed that the username could not get authenticated with AD. The first place to look is sssd (System Security Services Daemon)

6. Restart sssd. Got an error message stating sssd failed to start
  systemctl restart sssd

7. First view the sssd error log status. The logs did not provide much debug info
  systemctl -l status sssd

8. Start sssd in debug mode. The debug output will print on the terminal
  sssd -i -d 4

9. The error message in this case was "PAM unable to dlopen /usr/lib/samba/libreplace-samba4.so: version 'SAMBA_4.4.4 not found"

10. Checked the version of the samba-client. This showed that yum update installed both samba-client 4.4.4 and 4.6.2
  yum --showduplicates list samba-client


11. Reinstalled samba-client to only have one version
   yum remove samba-client
   yum install samba-client


12. sssd now success starts and users can AS authenticate on ssh
  systemctl start sssd
  systemctl start sshd


2017-07-30

My quick Boston DevOps talk

I gave a quick talk at the Boston DevOps MeetUp on July 26, 2017 about how my Ansible installer side project became the official product installer at HealthEdge.

https://www.youtube.com/watch?v=Q7sDcU4--l8&t


Forcing Oracle to drop user

If there are sessions currently connected to an Oracle user schema, then you cannot drop the user. For example, if the Oracle user 'mytest' is currently logged in, then

DROP USER mytest CASCADE;

ORA-01940: cannot drop a user that is currently connected 

If you cannot get the Oracle user to voluntarily log off, then as the Oracle admin, you will have to kill the Oracle user session.

There are two ways to kill an Oracle session

ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;
ALTER SYSTEM DISCONNECT SESSION 'sid,serial#' IMMEDIATE;

With "kill session", Oracle will request the session to end. With "disconnect session", Oracle will terminate the server process associated with the session.

The Oracle script at https://github.com/juttayaya/oracle/blob/master/drop-user/drop_user_force.sql will both kill and disconnect all Oracle sessions for a user then drop it.  Example of usage:

sqlplus sys as sysdba @drop_user_force.sql mytest

If you are using AWS Oracle RDS, then use the equivalent script https://github.com/juttayaya/oracle/blob/master/drop-user/drop_user_force_aws_rds.sql . Example of usage:

sqlplus sys as sysdba@aws-rds-hostname:1521/ORCL @drop_user_force_aws_rds.sql mytest

2017-07-22

Ansible ssh connection closed error

Problem:
Ansible returns the error "Failed to connect to the host via ssh: Shared connection to host closed"


Solution:
Modify ansible.cfg to send a SSH keep-alive ping every 2 minutes.

ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s -o ServerAliveInterval=120