CentOS – Blank Screen – No Login

Background

Yesterday, I installed CentOS v7 on a refurbished box.  I went the “Server with GUI” option, but upon starting up for the first time, the usual login screen is not coming up.

I have a dull blank screen, rather than one that lists my username.

Remediation

Idea

Took to the net and found a few people had similar problems.  The most widely promulgated option is to edit the /etc/default/grub configuration file and look for the “GRUB_CMDLINE_LINUX” entry.

And, go on to add “video=LVDS-1:d” to the end of the current contents of the entry.

Steps

Outline

  1. Access Terminal window via pressing the key combination CTRL-ALT-F2
  2. Login from the terminal by entering the username and password
  3. The configuration file /etc/default/grub is read only and so change the file to writable
  4. Edit in vi or your choice editor as sudo
    • Look for the “GRUB_CMDLINE_LINUX” entry and add “video=LVDS-1:d” to the end of the current value.
  5. Reconfigure using grub2-mkconfig
  6. Reboot your computer

 

Details

Here are the steps in detail.

CTRL-ALT-F2

Access Terminal mode by pressing the key combination CTRL-ALT-F2.  The Terminal Screen should appear.

 

Logging from the Terminal

Logging from the Terminal by entering your username and password.

 

Launch vi in sudo mode


sudo vi /etc/default/grub

 

Edit /etc/default/grub

Add ” video=LVDS-1:d
Before

grub-20160813-1143PM ( Before )

Add

grub-20160813-1146PM ( Before)

Reconfig Grub


sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Reboot

reboot

Credit

No original thoughts here!

Credits go out to the guys ( scubastevesama) who spoke about it on Reddit.

And, the ones ( Josef Holland ) who blogged about it.

References

CentOS Login Screen

  1. centos 7 installation issue, no login screen – scubastevesama
    Link
  2. Josef Holland – Disable Laptop LCD Completely on boot
    Link
  3. [RESOLVED] Atom D510 – 6.0 updated to 6.1 – became confused about monitor configuration
    Link
  4. Install on a laptop with external monitor only
    Link

 

Editing /etc/default/grub

  1. Amanda Folson – Modify File Permissions with chmod
    Link
  2. I need to change the Read Only in gedit to Read/Write
    Link

VLC on CentOS – Installation

Prelude

Time was one would have to search around to find Video and Audio codec files to play videos on a personal computer.  But, like Mase and Brandy “I have sat on top of the World” since someone introduced me to VLC.

From that time till now, that is all I use on MS Windows, Apple OSX, and Linux.

 

Background

Googled for tested paths towards installing VLC on CentOS.  The links that came up are:

The instructions basically states that we should avail the EPEL repository along with the RPMForge repository.

 

Repository – EPEL

The EPEL repository contains prerequisite files.

# EPEL6-FAQ
# http://fedoraproject.org/wiki/EPEL6-FAQ
# EPEL6 is an add on repository for RHEL and it's variants. It contains packages that
# are not shipped
sudo yum localinstall --nogpgcheck http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

# epel-release-6-8.noarch.rpm
sudo rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm

 

Repository – RPMForge

The RPMForge repository contains the VLC RPM.

We will prepare our system for RPMForge installs by doing the following:

  • Install the repository GPG Key
  • Download the rmpg-release package
  • Verify the downloaded package
  • Install the package
  • Review the installed package

 

Based on the instructions available @ CentOs.org – Additional Resources >> Repositories >> RPMForge (  http://wiki.centos.org/AdditionalResources/Repositories/RPMForge ), here is a quick script that we used.

 

# Install RPMForge
# http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

#Install DAG's GPG key
sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

#Download the package (x64)
sudo wget -O "rpmforge-release-0.5.3-1.el6.rf.i686.rpm"  "http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm"

#Download the package (x32)
sudo wget -O "rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm" "http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm"

#Verify the package you have downloaded
rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm

#Install the package
sudo rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm

#Review Package
sudo rpm -qa | grep -i rpmforge

 

Ensure VLC RPM Package Availability

Using “yum info“, let us make sure that everything is in place for a good install.

 

Sample :

sudo yum info vlc


Output :

YumInfoVLC

 

 

Install VLC

 

Install VLC via rpm.

Sample :

sudo yum install vlc

 

Output:

InstallVLC

 

Use VLC

Once installed, one can initiate the app from the terminal mode by issuing VLC.

Or via the desktop menu – Sounds & Video \ “VLC Media Player”.

 

 

Error

I experienced a couple of problems preparing the repositories. I was able to scale them through others well lighted path.

I have documented those steps below:

 

Error: Cannot find a valid baseurl for repo: rpmfusion-free

Tried:

sudo yum localinstall –nogpgcheck http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

and

sudo yum localinstall –nogpgcheck http://mirrors.mediatemple.net/remi/enterprise/remi-release-6.rpm

 

But, got the same error:

Error: Cannot find a valid baseurl for repo: rpmfusion-free

 

Solution Guide

How to fix rpmfusion-(non)free repo error in CentOS 6.4
http://www.aliencoders.com/content/how-fix-rpmfusion-nonfree-repo-error-centos-64

 

The steps are:

  • Identify the Repository that rpmfusion is using
  • Remove Fedora RPM Fusion files
  • Install Prerequisite (EPEL 6)

 

Which Repo is rpmfusion* using?

Query active repositories by issuing “yum repolist enabled” request:

Command: 
yum repolist enabled | grep -i rpmfusion

Output:

listRepos for rpmFusion

We can see that rpmFusion is using the one for Fedora 6.


Remove Fedora Files

Remove installed rpmfusion repositories

#RPM Fusion for Fedora 6 - Free
sudo rpm -e rpmfusion-free-release

#RPM Fusion for Fedora 6 - Free - Updates
sudo rpm -e rpmfusion-free-updates-release   

 

 

Identify Redhat CentOS ( EL ) Files

Identify the files that we need:

Visit http://download1.rpmfusion.org/free/ and be sure to identify the URL to the files that we need for EL (Enterprise Linux ).

 

RPMFusion--Free--Folder

 

Install CentOS Files

Here is the script that we used for installing the RPMFusion files:

 

# EPEL6-FAQ
# http://fedoraproject.org/wiki/EPEL6-FAQ
# EPEL6 is an add on repository for RHEL and it's variants. It contains packages RHEL.
# yum local install
sudo yum localinstall --nogpgcheck http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

# epel-release-6-8.noarch.rpm
sudo rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm

# Install RPMFusion - v6 - free - works on 32/64 bit
sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm 

# Install RPMFusion - v6 - nonfree - works on 32/64 bit
sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm

   

 

 

Error: ERROR 22 – “The requested URL returned error: 403 Forbidden”

 

Tried:

sudo yum localinstall –nogpgcheck http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
But, got the error:

http://centos.alt.ru/repository/centos/6/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 – “The requested URL returned error: 403 Forbidden”

Trying other mirror.

Error: Cannot retrieve repository metadata (repomd.xml) for repository: CentALT. Please verify its path and try again

 

Validate Problem

Review the current contents of the /etc/yum.repos.d/centalt.repo file.

 

Command:

cat /etc/yum.repos.d/centalt.repo

 

Output:

centalt-repo

 

 

Solution Guide

Here is the link we will follow to hopefully repair the problem.

repository metadata (repomd.xml) for repository: mratwork-centalt
http://unix.stackexchange.com/questions/132674/repository-metadata-repomd-xml-for-repository-mratwork-centalt

which states to change from a specific URL to a mirrored one.

In essence we are changing the baseurl from http://centos.alt.ru/repository/centos/6/$basearch/ to http://mirror.sysadminguide.net/centalt/repository/centos/6/$basearch/.

 

Example:

 

# mkdir /etc/yum.repos.d/deprecated/20140823
sudo mkdir -p /etc/yum.repos.d/deprecated/20140823

#backup file
sudo cp /etc/yum.repos.d/centalt.repo /etc/yum.repos.d/deprecated/20140823

#Change baseurl from old to new
#baseurl.new=http://centos.alt.ru/repository/centos/6/$basearch/ 
#baseurl.new=http://mirror.sysadminguide.net/centalt/repository/centos/6/$basearch/ 
sudo sed -i 's/centos.alt.ru/mirror.sysadminguide.net\/centalt/g' /etc/yum.repos.d/centalt.repo

 

References

References – Linux Installation Tools

References – Tool – YUM

 

References – Tool – RPM

 

References – Tool – Generic

 

References – Repository

References – Repository – epel

 

References – RPMForge

 

References – Linux Commands

 

References – Linux Commands – sed

 

References – VLC – Installation

 

References – VLC – Installation – Q&A

 

 

References – Repository – Installation – Errors

 

References – Error – Repository Metadata (respond.xml) for repository – CentAlt

 

References – Error – Fix rpmfusion

 

Technical: Linux – CentOS – Connected Servers Shares not showing up in some “File open” Dialogs

Technical: Linux – CentOS – Connected Servers Shares not showing up in some “File open” Dialogs

Background

In Google Chrome and Firefox, I am a trying to upload some images from a network computer, but those shares are not showing up.

 

Connect to Server

Imagine for a few minutes, you are on your Linux box and you need to connect to your WIndows box and upload some files \ images.

Im my case, my Linux box is a CentOS and so from my desktop, I access the Desktop Menu bar and click on the menu items Places and “Connect To Server …”.

 

ConnectToServer

 

Windows Shares Not Visible

Unfortunately, based on my Application, I have a slightly different Open Dialog:

 

gEdit

gEdit

 

 

Chrome

Chrome

 

 

 

Firefox

 

Firefox

 

The major differences for me is that  in gEdit, I am able to locate my network shares… That slot is “/danieladeniji/<server-name>” and in our example it is only visible (as the last entry on the left panel) in gEdit.

 

Using Samba, Mount Windows Resources\Shares

Install Utilities

Install Utilities – samba-client


sudo yum install samba-client

We are good… as we got back

Package samba-client-3.6.9-168.el6_5.i686 already installed and latest version

 

Install Utilities – samba-common


sudo yum install samba-common

We are good… as we got back

Package samba-common-3.6.9-168.el6_5.i686 already installed and latest version
Nothing to do

 

Install Utilities – cifs-utils

sudo yum install cifs-utils

 

We are good… as we got back

 Package cifs-utils-4.8.1-19.el6.i686 already installed and latest version

Using Samba, Mount Windows Resources\Shares

 

Create Mnt Folder

sudo mkdir /mnt/demobox__DanielAdeniji

Mount Mnt Folder

sudo mount --verbose -t cifs //demobox/DanielAdeniji /mnt/demobox__DanielAdeniji -o username=dadeniji,domain=labdomain,password=candi,sec=ntlm

 

By the way had a lot of problems with this step.  Pasted below are some of incorrect entries we entered and the corresponding errors.

 

Aliased Hostname 

When I tried issuing against an alias name


sudo mount --verbose -t cifs //aliasName/DanielAdeniji /mnt/demobox__DanielAdeniji -o username=dadeniji,domain=labdomain,password=candi,sec=ntlm

 

When we tried obfuscating our hostname by adding an alias name to our hosts files, and targeting that aliasname, here is the error message we get

mount error(5): Input/output error

 

Crediting Pastorino
http://www.linuxquestions.org/questions/linux-networking-3/cifs-mount-error-5-%3D-input-output-error-but-smbfs-works-456897/

 

 

Incorrect Password

If the password is incorrect


sudo mount --verbose -t cifs //demobox/DanielAdeniji /mnt/demobox__DanielAdeniji -o username=dadeniji,domain=labdomain,password=candi,sec=ntlm

wrong password

mount error(13): Permission denied

 

 

If Password contains special characters

If the password contains special characters such as !


sudo mount --verbose -t cifs //demobox/DanielAdeniji /mnt/demobox__DanielAdeniji -o username=dadeniji,domain=labdomain,password=candi!,sec=ntlm

you will get an error message, such as “event not found

bash: !,sec=ntlm: event not found

to correct quote your password

sudo mount --verbose -t cifs //demobox/DanielAdeniji /mnt/demobox__DanielAdeniji -o username=dadeniji,domain=labdomain,password='candi!',sec=ntlm

see we replace candi, with ‘candi!’

 

List Mount Points

Using the mount command, we will list our mount points

Syntax:


mount -v

 

Sample:


mount -v | grep -i "Daniel"

 

Output:

ListMountPointsThatHaveDanielInTheirName

 

 

List Mount Point Contents

Using the mount command, we will list our mount points

Syntax:


ls /mnt/<folder>

 

Sample:


ls /mnt/demobox__DanielAdeniji | more

 

Mounted Folders

So though we still can not view connected servers, we can access our Windows Shares through the mnt folders (/mnt)

 

OpenFile--MountPoints

 

 

Windows Computer Names and Aliases

Btw, to use aliases for MS Windows host names, place them in your /etc/samba/lmhosts file.

etc--samba--lmhosts

 

This is one way you can avoid the “mount error(5): Input/output error” we spoke about earlier.

Keep in mind that trying to use the /etc/hosts will not do.

Dedication

I am going to dedicate this post to Bart and Jorge Castro.  They firmly, yet economically stated this question in a Q/A post titled “gvfs – How do applications open from/save to smb shares? – Ask Ubuntu” ( http://askubuntu.com/questions/224441/how-do-applications-open-from-save-to-smb-shares ).

For me, a newbie, clear and concise concerns helps declutter my space and rather than waste time trying to see if my environment is not properly setup, I can spend cycle trying to bridge seeming implementation gaps.

 

References

References – Mounting Windows Share – Blog

 

References – Mounting Windows Share – Q/A

 

References – Off Topic

Desktop – Linux \ Windows – Unable to move Application Windows as Top Bar is not visible

Background

There are so much we do on the computer that we are not even aware how we do it. For example, moving and resizing a screen we know we click on something and start moving things around.

But, when we can not do it, we try to see if there alternatives to the more obvious pathways.

 

Problem

My problem has occurred a couple of times in the last few days. I am moving things out of the way and then all of a sudden, I am unable to to move the Application Screen back to focus.

 

Topbar-Not-ShowingUp

 

In the image pasted above, I am no longer able to move and resize my Chrome Application.

Solution

I googled for ways to move things around, but was unsuccessful at describing the problem appropriately.

The best help came via:

Ask Leo – I can’t see the top of a window so I can’t minimize/maximize or close – what can I do
http://askleo.com/i_cant_see_the_top_of_a_window_so_i_cant_minimize_maximize_or_close_what_can_i_do-2/

 

His advice is that I should invoke the System Menu, via keystrokes; specifically ALT-spacebar.

So went back to the little window that is still visible and click in the client Area; there by making sure that the Application is the Active Window and thus the recipient of any key.

And, then hold down ALT while pressing the space-bar.

SystemMenu-Small

Once we did so, we have a nice system menu that, and I can now access the “Move” option.

I suppose I could have accessed ALT-F7, all this time.

Prior to know, I was using CTRL-Shift-W to close otherwise orphaned Chrome Windows.

Chrome – Keyboard Shortcuts
https://support.google.com/chromebook/answer/183101?hl=en

 

Thanks Leo.

 

 

Technical: DNS – Query for Name Server (NS) – On Linux\CentOS Using Dig

Technical: DNS – Query for Name Server (NS) – On Linux\CentOS Using Dig

 

Install

Install – whois

Install whois:

sudo yum -y install jwhois

 

Install – dig

As Dig is part of the bind-utils, install bind-utils

sudo yum -y install bind-utils

 

 

 

Using Dig

On Linux, we can use dig to query for Name Servers.

Using Dig – Query System’s default Name Server

Syntax:

dig  NS <domain-name> +noall +answer

 

Sample:

dig  NS youtube.com +noall +answer

 

Output:

DigQueryForNameServer

Explanation:

In the example above, we are querying the system’s default Name Server.  And, asking it for the authoritative nameservers for the youtube.com domain.

 

Using Dig – Target specific name server

In case something is wrong with our default named server or our default Named Server has been configured not to forward DNS Queries, we can target another DNS Server.

 

Syntax:

dig  @NS <domain-name> NS +noall +answer

 

Sample:

dig  @68.94.156.1 bbc.co.uk  NS +noall +answer +stats

 

Output:

DigQueryForNameServer- target specific server

 

Explanation:

In the example above, we are specifically targeting an AT&T named server (68.94.156.1) and querying for bbc.co.uk domain NameServers.

We do not really need the stats answer block (Query time, Server, when), but included it so that we can confirm that our result came from the specific server that we requested that it comes from.

To exclude stats data, remove +stats or add nostats.

 

 

Using Dig – Query DNS Server (and got back SERVFAIL)

Using dig, query DNS Server and we are getting back SERVFAIL.

Syntax:

dig  <domain-name> NS

 

Sample:

dig notfullysetup.org NS

 

Output:

Image:

dig -- SERVFAIL

Textual:



[dadeniji@adelia tmp]$ dig NS notfullysetup.org

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> NS 
notfullysetup.org

;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 6679
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;notfullysetup.org. IN NS

;; Query time: 42 msec
;; SERVER: 68.87.66.196#53(68.87.66.196)
;; WHEN: Mon Apr 28 10:23:04 2014
;; MSG SIZE rcvd: 33

[dadeniji@adelia tmp]$ 

 

Explanation:

In the example above, we are querying a DNS Server and getting back an error status, specifically SERVFAIL.

SERVFAIL means that an authoritative server is registered, but it is unreachable or faulty.

 

Using Dig – Query DNS Server tracing delegation path

Using dig, query DNS Server and note the delegation path.

Syntax:

dig  <domain-name> +trace

 

Sample:

dig notfullysetup.com +trace

 

Output:

[dadeniji@adelia tmp]$ dig NS notfullysetup.com +trace

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> NS notfullysetup.org +trace

;; global options: +cmd
. 319385 IN NS h.root-servers.net.
. 319385 IN NS m.root-servers.net.
. 319385 IN NS e.root-servers.net.
. 319385 IN NS i.root-servers.net.
. 319385 IN NS g.root-servers.net.
. 319385 IN NS j.root-servers.net.
. 319385 IN NS a.root-servers.net.
. 319385 IN NS l.root-servers.net.
. 319385 IN NS d.root-servers.net.
. 319385 IN NS b.root-servers.net.
. 319385 IN NS k.root-servers.net.
. 319385 IN NS c.root-servers.net.
. 319385 IN NS f.root-servers.net.
;; Received 496 bytes from 68.87.66.196#53(68.87.66.196) in 727 ms

com. 172800 IN NS k.gtld-servers.net.
com. 172800 IN NS l.gtld-servers.net.
com. 172800 IN NS h.gtld-servers.net.
com. 172800 IN NS g.gtld-servers.net.
com. 172800 IN NS m.gtld-servers.net.
com. 172800 IN NS d.gtld-servers.net.
com. 172800 IN NS j.gtld-servers.net.
com. 172800 IN NS f.gtld-servers.net.
com. 172800 IN NS b.gtld-servers.net.
com. 172800 IN NS i.gtld-servers.net.
com. 172800 IN NS c.gtld-servers.net.
com. 172800 IN NS e.gtld-servers.net.
com. 172800 IN NS a.gtld-servers.net.
;; Received 505 bytes from 2001:7fe::53#53(2001:7fe::53) in 1038 
ms

notfullysetup.com. 172800 IN NS ns1.notfullysetup.com.
notfullysetup.com. 172800 IN NS ns2.notfullysetup.com.

dig: couldn't get address for 'ns1.notfullysetup.com': no more

[dadeniji@adelia tmp]$ 


 

Explanation:

In the case listed above we asked for a trace on what dig did, and it says that the root servers were queried and returned our ns1 and ns2 name servers.

But, we were unable to get the address for ns1.

Upon taking a second look, you might also notice that the first query went to the root servers and we were referred to the gtld-servers.net servers.

Keep in mind that *.gltd-servers.net servers are authoritaive for .com top level domain.

 

Who Is

As one plays more with dig, you might find it important to make sure that your NameServers are properly recorded, as well.

The whois utility provides a nice complement to dig.
Syntax:

whois <domain-name>

 

Sample:

whois wordpress.com | egrep 'Name Server'

 

Output:

whoIs

 

 

Helpful Hints

Helpful Hints – When specifying Name Server

When specifying Name Server using @NS, see if you can use IP Address , as the initial DNS resolution for NS might itself fail.

Helpful Hints – When querying for specific Name, place a period at end of full name

When querying for a specific name, please place a period at end of the name to indicate that the default name (resolv.conf in linux) not be appended to the hostname.

 

References

References – Installation

 

References – DNS Examples

References – DNS TroubleShooting

 

References – DNS TroubleShooting – Trace

 

References – DNS – Q&A

 

 

Technical: Installing and Using GIT Command Line Interface on CentOS

Technical: Installing and Using GIT Command Line Interface on CentOS

Background

Now that my primary box is this CentOS Linux box, I need to make sure that I can share a bit on it.

With a web browser, I am able to post to wordpress.

And, I probably can look for a web interface to get to github, as well.  But, I really need to re-familiarize with Bash and command line stuff.

And, so I will stay away from nice, pretty GUI for now.  And, go shell.

 

Installation

On CentOS, we can install via the yum.

sudo yum install git-core

Yum install is easy as it takes care of installing all the dependant files.

 

Customize

 

Set User name

git config --global user.name "Daniel Adeniji"

Set email address


git config --global user.email "Daniel_Adeniji@nobody.com"

 

 

Create a repository

Connect to your github online account, and create a new repository

 

Identify local folder on host

On your Linux\Cent OS host, identify or create local folder that will serve as your working folder.

In our case, we will use /home/dadeniji/development/apache.org/tomcat/MSAdventureWorksDWDB.Public

 

Change Working Directory

Make identified folder your working directory

Launch Unix terminal and change working folder to identified folder.

Syntax:

cd <working-folder>

 

Sample

cd /home/dadeniji/development/apache.org/tomcat/MSAdventureWorksDWDB.Public

 

Clone Git Repository

Clone Git Repository

Syntax:

git clone git@github.com:<user-name>/<file>.git

 

Sample:


git clone git@github.com:DanielAdeniji/JavaJSPJSTLMSSQL.git

 

Output:

Here is the output we got back…




[dadeniji@adelia MSAdventureWorksDWDB.Public]$ ssh -vT git@github.com
OpenSSH_6.6, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [192.30.252.130] port 22.
debug1: Connection established.
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/dadeniji/.ssh/known_hosts:2

debug1: No more authentication methods to try.
Permission denied (publickey).
[dadeniji@adelia MSAdventureWorksDWDB.Public]$ 


 

 

Set up SSH Keys

We know that we have yet to set up SSH keys on this box.  And, unfortunately I do not recollect where I placed previously used ones.

So let us go re-create SSH (Private & Public) keys.

Thankfully, GitHub has very good documentation on doing so:
https://help.github.com/articles/generating-ssh-keys

SSH Key Folder Location

SSH Keys are kept in /home/<username>/.ssh and in our case it is /home/dadeniji/.ssh.

In Linux by convention folders whose name starts with . are hidden files.  And, so the folder might not show up.

Here is a default listing Folder Listing:

Folder-List-Visually

 

Enhanced Folder Listing:

On CentOS, to view hidden files, please click on the menu items “View”/ “Show Hidden Views” or use the keystrokes (CTRL-H).

Here is the “Show Hidden Views” picture:

Folder-List-Visually-after

 

 

Check for SSH Key

Command:


cd ~/.ssh
ls -al

Output:

 

ssh - list files

Generate SSH Key

Command:

ssh-keygen -t rsa -C "dadeniji@ephraimtech.com"

 

Output:

ssh-keygen

 

Add Key to SSH Agent

Command:

ssh-add ~/.ssh/id_rsa

 

Output:

ssh-add

 

Review SSH Keys

Let us re-issue ls, and see whether we now have our keys.

Command:

cd ~/.ssh
ls -al

Output:

ssh - list files (found)

Add SSH Keys to Git-Hub

  • Access Github
  • In the top bar (https://github.com)
  • topMenuClick on the wrench button    wrench  .
  • The “Account Settings” ( https://github.com/settings/profile ) will show up
  • The “Account Settings” screen looks like this:AccountSettings
  • Click on “SSH Keys”
  • SSH Keys:Listing for SSH Keys.SSHKeys
  • Click on the “Add SSH key”AddSSHKey
  • Post entering SSH KeyAddSSHKey [after]
  • Confirm password to continue — Enter passwordConfirmPasswordToContinue
  • Here is the the listing of our “SSH Keys”SSHKeys (After)
    We can see that the new key’s status is listed as  “Added just now — Never used“.

SSH Key – Test

Command:

ssh -T git@github.com

 

Output:

Output – Textual:


[dadeniji@adelia ~]$ ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '192.30.252.129' to the list of known hosts.
Hi DanielAdeniji! You've successfully authenticated, but GitHub does not provide shell access.
[dadeniji@adelia ~]$


Output – Image:

PermanentlyAddedTheRSAHostKeyForIPAddress

 

 

Clone Git Repository (Attempt #2)

Clone Git Repository

Syntax:

cd <home-directory>

git clone git@github.com:<user-name>/<file>.git

 

Sample:


cd /home/dadeniji/development/apache.org/tomcat/MSAdventureWorksDWDB.Public git clone git@github.com:DanielAdeniji/JavaJSPJSTLMSSQL.git

 

Output:

Here is the output we got back…

Textual:


Initialized empty Git repository in /home/dadeniji/development/apache.org/tomcat/MSAdventureWorksDWDB.Public/JavaJSPJSTLMSSQL/.git/
warning: You appear to have cloned an empty repository.


 

Image:

cloned-empty-git-repository

 

Git Repository – Add

Add Files

Syntax:

cd <home-directory>

git add <files>

 

Sample:


git add '*.jsp'

 

Output:

Textual:

fatal: Not a git repository (or any of the parent directories): .git

 

Image:

NotAGitRepository

 

Remediate

Googling on the error message tells me that I really needed to have indicated the folder that I wanted to use as my Git current folder.

As we did not indicate otherwise, a new folder is created underneath the current folder bearing:

inproper-use-of-git-clone

 

In the screen above the name of the folder is JavaJSPJSTLMSSQL.

 

Move Git Local Repository

Move Git Local Repository

Syntax:

cd <home-directory>

mv <local-folder>/.git . 

rm -rf <local-folder>

 

Sample:


cd /home/dadeniji/development/apache.org/tomcat/MSAdventureWorksDWDB.Public move JavaJSPJSTLMSSQL/.git . rm -rf JavaJSPJSTLMSSQL

 

Check Git Local Repository

 

Syntax:

git status --short

 

Sample:


git status --short

 

Output:

gitStatus--short

 

Reset Git Local Repository – Reset

 

Syntax:

git reset --hard

 

Sample:


git reset --hard

 

Output:

Textual:


fatal: Failed to resolve 'HEAD' as a valid ref.

 

Image:

failed to resolve head

 

We will ignore this error for now.

Git Repository – Add

Add Files

Syntax:

cd <home-directory>

git add <files>

 

Sample:


git add 'README.md'
git add '*.jsp'
git add '*.html'
git add 'META-INF/context.xml'
git add 'WEB-INF/*'

Git Repository – Create ignore file (.gitignore)

Add Files

Syntax:

touch .gitignore

 

Sample:

 

touch .gitignore

 

If there are files that we do not want shipped-off, we will list them in the .gitignore file.

Mask Private Data

We will like to share source code, but keep certain private data hidden.  We will use sed for that.

 

Sample:


sed --expression='s/HRPROD/dbHost/' --expression='s/username="hrdb"/username="dbUser"/' --expression='s/mygoodpwd/dbUserPassword/' META-INF/context.xml > META-INF/context.xml.tmp && mv META-INF/context.xml.tmp META-INF/context.xml sed --expression='s/HRPROD/dbHost/' --expression='s/hrdb;/dbUser;/' --expression='s/mygoodpwd/dbUserPassword/' jspSimple.jsp > jspSimple.jsp.tmp && mv jspSimple.jsp.tmp jspSimple.jsp

 

 

 

Git – Review File Status

Review Git Status in terms of what files are on.

Syntax:

git status

 

Sample:

git status

 

Output:

gitStatus

 

 

Git – Commit Changes – Locally

Commit Git Changes locally.

Syntax:

git commit -m <comment>

 

Sample:

git commit -a -m "initial batch"

 

Output:

gitCommit

 

Git – Commit Changes – Remotely

Commit Git Changes remotely.

Syntax:

git push -u origin master

Sample:

git push -u origin master

 

Output:

gitPush

 

Git – Review Github

Let us quickly review Github and make sure that our files are there.

Our URL is https://github.com/DanielAdeniji/JavaJSPJSTLMSSQL.

 

exploreFilesOnGithub

 

 

 

Git – Review Log

We use “git log” to review our change logs.

Syntax:

git log

Sample:

git log

Output:

gitLog

 

Listening to

Dave Loggins – Pieces of April
https://www.youtube.com/watch?v=gAlaYEmS0oY

 

 

References

References – Git – Tutorial

 

References – Git – SSH Key Management

 

References – Git – Q/A

 

References – Git – SSH Key – QA

 

 

References – SSH Key – Management

  • Git Tutorial starting with git using 10 commands

 

 

 

 

 

 

 

Linux (Cent-OS) – CD Drive – Aftermath of “Safely Remove Hardware”

Background

It all started innocently enough.  There are a couple of machines that I wanted to play with.  One has a trial version of MS Windows 7, and believe me it works well and reliably.  And, the other one will not even come up!

I am trying to get my Linux Lab environment back up.  Who isn’t these days?

Well once Cent OS is installed, like every other Windows aficionados I started playing around with the GUI and pressed on a wrong button.

 

Introduction

Which wrong button, you might ask?  Well, the one that states “Safely Remove Drive“.

SafelyRemoveHardware_2

And, so even though my sure and reliable Memorex DVD Double Layer is still attached, it is no longer visible, as confirmed in the screen shot below:

ComputerWindowPostsSafelyRemoveHardware

 

 

So how do we get the CD/DVD Back?

List CD / DVD

I tried listing devices, grepping on cdrom

Command:

ls -la /dev | grep cdrom

Output:

listCDAndDVD

From the output above, our CDs and DVDs are:

a) /dev/cdrom1
b) /dev/sr0

 

 

Eject CD

Ejected the CD, hoping placing a new one in will result in the OS now seeing it.

Syntax:

sudo eject /dev/ [filename]

Command:

sudo eject /dev/cdrom1

 

List Attached Hardware Devices

 

Use dmesg

Use dmesg to list hardware devices that Kernel recognizes.

In this case, list SCSI related info

Syntax:

dmesg | grep -i SCSI

Output:

dmesg--grep--SCSI

 

In this case, list usb related info

Syntax:


dmesg | grep -i usb

Output:

dmesg--usb

 

Hoping to remount it, using mount … But when I tried to do so, did not get anywhere.

Command:

mkdir /mnt/DVD
mount -r -t iso9660 /dev/sr1 /mnt/DVD

Error Message:

mount: special device /dev/sr1 does not exist

 

 

Reset USB Devices

 

The one thing that worked, is the one posted by Tamás Tapsonyi

How do I reset a USB Device without unplugging it in linux
Link

 


# Original by Tamás Tapsonyi
# Slightly modified by Daniel Adeniji
# resetting USB ports
# http://askubuntu.com/questions/645/how-do-you-reset-a-usb-device-from-the-command-line/290519#290519
#http://stackoverflow.com/questions/59838/how-to-check-if-a-directory-exists-in-a-shell-script
# if Folder exists /sys/bus/pci/drivers/ehci_hcd/
# resetting USB2 ports
if [ -d "/sys/bus/pci/drivers/ehci_hcd/" ]; then
   echo "Resetting USB2 Ports ..."
   for i in $(ls /sys/bus/pci/drivers/ehci_hcd/|grep 🙂
	 do echo $i &gt;/sys/bus/pci/drivers/ehci_hcd/unbind
        echo $i &gt;/sys/bus/pci/drivers/ehci_hcd/bind
    done
    echo "Completed resetting USB2 Ports"
else
   echo "Skipped USB2 Ports"
fi


# if Folder exists /sys/bus/pci/drivers/xhci_hcd/
if [ -d "/sys/bus/pci/drivers/xhci_hcd/" ]; then
   echo "Resetting USB3 Ports ..."
   for i in $(ls /sys/bus/pci/drivers/xhci_hcd/|grep 🙂
     do echo $i &gt;/sys/bus/pci/drivers/xhci_hcd/unbind
     echo $i &gt;/sys/bus/pci/drivers/xhci_hcd/bind
   done
    echo "Completed resetting USB3 Ports"
else
   echo "Skipped USB3 Ports"
fi

 

Validation

Our CD/DVD now shows up on the GUI and we can also query /var/log/dmesg and see that it is registered as sr1

Command:

cat /var/log/dmesg | egrep '(CD|DVD)'

 

Output:

var-log-dmesg --egrep cd-dvd

 

Conclusion

Of course, you can always unplug/re-plug in the USB Device or restart the device if it has its own power switch.

 

 

References

References – CD / DVD

 

References – CD/DVD Eject

 

References – dmesg

References – USB Device Reset

 

References – VLC