Sunday, March 3, 2019

Troubleshooting Linux

Sometimes things in the linux world doesn't always work the way we would like.  It is at those times that some investigation needs to be done. Here are some of the tools that can be used for the investigation. This is not an exhaustive list, but those tools that I've found as I continue to explore the world of linux.

Journal control is an excellent command line tool to find out what is going on in the system.

journalctl -p err -b | grep [item of interest here]

System control allows you to control what is in operation and to check on the status of something.

systemctl status [item of interest here]
systemctl start [item of interest here]
systemctl stop [item of interest here]
systemctl restart [item of interest here]
systemctl -t service -a [gives a listing of all services]
systemctl list-units [gives a listing of everything and status]

If you need to roll back to an older version of some application, you can find the older applications in the pacaman cache.

pacman -U /var/cache/pacman/pkg/[name of older application]

To get a listing of the latest changes, you can search by listing the cache based upon time.

ls -tlaF /var/cache/pacman/pkg/ | more

Monday, July 2, 2018

Driver Blacklisting

To prevent a specific driver from loading during the boot sequence, you will need to create a blacklist configuration file for the system to read and obey. Obviously you will need the name of the driver first. For instance, if you wanted the name of the Bluetooth driver, you could use the following command.
lspci -vv
This command will likely return a rather long list of items and you would need to look through them to find the Bluetooth driver. Below is the response of one of my computers.
04:00.0 Network controller: Qualcomm Atheros AR9485 Wireless Network Adapter (rev 01)
        Subsystem: Dell AR9485 Wireless Network Adapter
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- 
        Kernel driver in use: ath9k
        Kernel modules: ath9k
This is a Bluetooth controller and there at the end is the driver name in question, ath9k. To make sure, this is the only device using this driver, you can use the following command (wouldn't want to nerf something else in the process).
lspci -vv | grep ath9k
With this information, you can now proceed with the blacklisting of ath9k. You will create a file in /etc/modprobe.d/. This can have any filename you want, including the simple name of just blacklist.conf.
nano /etc/modprobe.d/blacklist.conf
Within this configuration file, we put what we want to blacklist.
# Do not load the Bluetooth driver during boot. 
blacklist ath9k
install ath9k /bin/false 
The first line prevents the driver from being loaded directly, but it won't prevent a secondary item from loading it. The second line will prevent a secondary item from loading the driver.

Once you have saved this file, you can reboot, and the driver will no longer be loaded during the boot sequence.

Monday, June 25, 2018

Linux CLI Networking

Working from a terminal interface sometimes is the only option. For example, when something has gone horribly wrong with an update and the system won't boot and you find yourself staring at a terminal while in recovery mode. In this example, the recovery mode does not have any networking enabled by default. Consequently, you may need the means to make that connection. Fortunately, this is fairly easy to perform.

First you'll need to know the name of the interface that you intend to enable. The following commend will give the name of all of the interfaces, so you'll need to pick the one that you want to enable.

ifconfig -a

For this example, we'll say that on the list is eth0. You'll then do something along the lines of the following command to turn it on.

ifconfig eth0 192.168.1.42 netmask 255.255.255.0 up

This will turn on the network interface, set the IP address, and the netmask. You may also need to identify your gateway, which the following command will do for you.

route add default gw 192.168.1.1 eth0

At this point, you should have a working network interface. A quick verification would be to ping a known IP address, like a Google server 8.8.8.8.

Monday, June 18, 2018

Linux CLI USB Mounting

To mount a USB device in the command line in Linux, you will need to know what the device is called.  There are many ways to fetch this information if you don't have it already.
lsusb
blkid
fdisk -l
udiskctl
I typically just use the top one, and the bottom one doesn't work on all systems. Once you have the name of the device, then you will need to decide where to mount it. One potential location is shown below.
/mnt
With the location, you can then mount your USB storage device.
mount /dev/sdj1 /mnt
When done, you can unmount it just as easily.
umount /mnt

That pretty much covers it.

Sunday, February 26, 2017

Making a Test Web Server

I had decided to create a test web server that was ran in a virtual machine.  To minimize the system overhead of running the test web server, I elected to use Arch Linux without a desktop environment running.  Some searching of the internet failed to reveal anything explicitly useful, but a number of useful pieces were found.

This webpage was the first piece in the puzzle of making an ArchLinux web server test box.  This site gave an excellent overview, but there were a few things that were wonky.  In particular, the keyboard suggestion, don't do what it suggests, just use the default (unless you really do need to change it).

The second piece to the puzzle, was this site, which clarified what needed to be done to create the web server itself.

This third piece of the puzzle was this site, which provided the information needed to mount a virtualbox share from within the guest.  This allowed me to use my primary desktop to edit the PHP files easily.

Finally there was this piece that provided nice clear set of instructions on getting the phpMyAdmin up and running.  Of particular note at this stage was the use of this line of code for the web site that I was working on.  It allowed me to set up a test user to have access to a specific database, in a manner similar to what happens on the real server.
GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost';
 Overall, it didn't take too long to put together, get working and it provided a test web server that was fairly resource light on my primary desktop.  Additionally, it only ran when I wanted it running by just launching that particular virtual machine.

Sunday, February 12, 2017

Virtualbox Recovery

If having issues with running VMs on Chakra Linux, try the following sequence of commands.

# rm -rf /var/lib/dkms/vboxhost/5.1.14
# dkms add /usr/src/vboxhost-5.1.14_OSE/
# dkms build vboxhost/5.1.14_OSE
# dkms install vboxhost/5.1.14_OSE

Then reboot.

Also, make sure that following packages have been installed.

virtualbox
virtualbox-host-dkms
virtualbox-ext-oracle

Thursday, June 28, 2012

Gutshot Straight Book Review

Gutshot Straight: A NovelGutshot Straight: A Novel by Lou Berney
My rating: 4 of 5 stars

Got this as a free eBook from B&N and during some travelling got a chance to read it. The first couple of chapters seemed rather predictable. Much like getting a present that is wrapped in such a way that you already know what is inside, but the author does throw some curve balls along the way. Much like the present analogy, as the reader begins unwrapping the present, they discover something much different than what they had anticipated.

The story starts out with a con who has decided that he is going to keep to the straight and narrow. Unfortunately for him, he encounters people who seem to be actively pushing him off the path. Starting with an old flame, and continuing with the woman. The one that can throw him curve balls all day and he just keeps swinging at them, regardless of the consequences. Fortunately for him, she appears to feel the same way about him, at least for the time being.

Overall, I found this to be an excellent read, and I would recommend it to most anyone, from teen to adult.

View all my reviews