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.