One incredibly useful thing I learned when reading a nerdbook on Linux commands, is the ability to direct output to text files.
I recently dug a bit to get the Wifi LED on my Thinkpad to work under Ubuntu.
I had previously tried… not hard, and failed to get it working, but using output direction, I was able to sift through and get it going no problem. There are only two things that don’t work with Ubuntu right out of the box with Linux.
The Wifi activity LED.
The Wifi switch.
Both are non-critical and don’t effect operation at all, however, it is nice to be able to have flashing lights and indicators of network traffic, at least to me it is.
So, unlike many things in Linux, the mad-wifi documentation for Atheros wifi cards is well documented, and EXTREMELY clear and easy to follow. Using that howto and a bit of knowledge, I was able to conqueror and flawlessly fix the problem.
When I began entering commands, I noticed I was getting unknown key errors, I didn’t know because if it was my device name that I was using was wrong or something else, but after reading the howto, I decided to just
Reading the manual, I found out that sysctl is used to manipulate and list kernel parameters. The two parameters I was interested in was -w and -A.
According to the manual, the -A parameter will list all available values in a handy table form.
The -w parameter is used when you want to change a value.
Here’s where the fun is. I run the -A switch to see it prints an easy-to-interpret list, but is ugly and hard to navigate within the shell.
The output looks like
net.ipv6.conf.ath0.mtu = 1500
From coding experience, I am able to break that down and easily understand what that line is meant to do.
The first word, net, is telling me what type of device it is. Other examples are fs for filesystem, and dev for device.
The second, ipv6 (Internet protocol version 6), is what part of the net category the next word is being operated on.
Next, conf, means configuration, and is meant to show that the value being represented is part of configuration data.
Next, ath0 is what the previous words are a part of. It’s an ipv6 net device’s configuration, ath0.
Following is mtu (maximum transmission unit), simply a descriptor, ucast and locktime are other examples. This is telling you the exact part of the configuration you are looking at, in this case, ath0’s mtu configuration.
Of course, the assignment statement on the right is what the value that comes before it has been set to.
Now that the basics of deciphering sysctl configuration data are out of the way, we can move on to business. Since the output in terminal is so ugly, we’re going to pipe the output into a text file, a searchable, readable, manipulatable text file.
sysctl -A > /home/User/file.txt
That easy, all you’re saying is to take the main command, sysctl -A, and pipe the output it produces, >, into a file that will be created, file.txt, in location, /home/User.
Now, I navigate and open up the file and easily find the keys I need.
dev.wifi0.softled = 1
dev.wifi0.ledpin = 0
Notice one of the keys, ledpin, is set to 0, obviously off. So we want to change that to 1. Simple stuff.
sudo sysctl –w dev.wifi0.ledpin=1
Simple as that, the light comes on, blinks as described in the howto and everything is good. I simply add that command minus the sudo to /etc/sysctl.conf and I’ll never have to worry about it again.