Friday, December 25, 2015

How to install NVIDIA driver 352.63 in Linux Mint 17.3

Last March, I wrote a guide to install the NVIDIA 346.35 video card driver on Linux Mint 17.1. A few things have changed since then. Since we're upgrading to Mint 17.3, I'm updating the NVIDIA driver also. Here's how I did it.

Here is the computer I'm doing the driver installation on:
Motherboard: Biostar A960G+
Video card: EVGA GeForce GTX 960 video card
Ram: Corsair 8GB DDR3 CML8GX3M2A1600C9
Processor: AMD FX-6300

Installation procedure
1. Print out these instructions (or have this page open on another device). Read through these instructions before doing anything so you understand the procedure. It's helpful to understand what you're doing, instead of just typing a command because someone said to do it.

2. Backup your system, unless you're starting from a fresh install, like I did. I installed Linux Mint 17.3 from a DVD that I burned.

3. Then I installed the updates, so the system was up to date. Usually you need to check for new updates a second time after you run updates because the first update may only update the updater. I ran all the updates before attempting to install the video driver.

4. Go into the Software Manager, and search for libc. Install the libc6-dev package (Embedded gnu c library: development libraries and header files). The NVIDIA driver will need this for its installation. If you don't have this installed, the NVIDIA driver installation will fail.

5. Download the Nvidia 352.63 driver for Linux.

6. (Optional) Make a backup copy of grub.cfg in case you need to revert back. Open a terminal, and type the following:
    cd /boot/grub
    sudo cp -p grub.cfg grub.cfg.original

7. (Optional) Backup grub
    cd /etc/default
    sudo cp -p grub grub.original

8. Since the driver installation requires that we boot into a terminal instead of the GUI, we need to change that, temporarily. We need to make two changes to the file /etc/default/grub
    sudo gedit /etc/default/grub
    Add the word "text" so that the following line looks like this:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash text"

    The next edit is important, otherwise, you'll get a black screen instead of booting to terminal. Go down a few lines and uncomment the following line (remove the #)
    GRUB_TERMINAL=console
If you don't uncomment that line, you'll get a black screen instead of a terminal. Not fun.

9. Save the file and exit gedit.

10. Re-build grub.cfg by running the command
    sudo update-grub

I got a "Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMOUT is set is no longer supported." I don't know what's up with this, but I'm continuing anyway.

11. We're still in the GUI now, but after we reboot, it should go straight to a terminal instead of launching the GUI. Reboot now.

12. When the computer turns back on, it should be in the terminal window, asking for login. Type your user name, hit enter, then enter your password. If you got a black screen, you probably didn't uncomment the correct line in step 8.

13. You should be at the command prompt now. I assume you downloaded the NVIDIA driver to your downloads directory. We'll go there now. 
    cd Downloads

14. Login as root with the command su <enter>, and type in your password. The prompt will now be a # instead of a $. Run the installation driver as root by typing:
    sh NVIDIA-Linux-x86_64-352.63.run

Accept the license agreement.

It said "The distribution-provided pre-install script failed! Are you sure you want to continue?"
I selected "continue the installation".

"Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later."
I don't think we'll be updating the kernel module. Even updating from Linux Mint 17.2 to 17.3 doesn't update the kernel, so I'm saying "No" to this question.

"Install NVIDIA's 32-bit compatibility libraries?"
Yes (sure, why not? I'm guessing this is so we can run the graphics with 32 bit applications.)

"Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X? Any pre-existing X configuration file will be backed up."
Yes

"Your X configuration file has been successfully updated. . . . " Installation is now complete.
<OK>

15. After installation completes, don't reboot yet. We still have to fix grub so it doesn't boot to a terminal again. We'll use the pico editor since we're not in the GUI. I'll assume you're still logged in as root. Open /etc/default/grub to edit:

    pico /etc/default/grub

Remove the word "text" so the line is back to how it was before:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
You should probably leave this line uncommented:
   GRUB_TERMINAL=console

16. Save the file (ctrl-o) and exit pico (ctrl-x). So in the future, if you hit ctrl-alt-F1, you should get a terminal. If you comment the above line again, it just goes to a black screen. To get back to the GUI, hit ctrl-alt-F7 or ctrl-alt-F8, but don't do that now since we're not in the GUI yet.

17. Now we need to rebuild grub.cfg with the following command (still logged in as super-user or root):
    update-grub

18. Shutdown the computer (as root) with the following command line:
     shutdown -h now

19. Turn the computer on, and it should boot up normally, into the GUI with the Nvidia driver. If you look in the system settings under Driver Manager, it should probably look similar to this window:


20. Does this mean that I could have had Mint install the same driver? I don't know. Let me know if you can install the NVIDIA driver using the Driver Manager. Just like I experienced in elementary school, the teacher handed out an assignment that had a list of instructions. It was a long list of things like "tie your neighbor's shoes". Step 1 was to read the entire assignment first. The last step was to ignore all the previous instructions, sign your name to the page, and hand it in.  

Leave a comment if this helped you.
Thanks.

Tuesday, November 24, 2015

1000 Lumen Duracell Flashlight Teardown

Here, I'll show you how to disassemble a Duracell 1000 lumen flashlight. While it may not be very practical, somehow it's satisfying to tear apart a product with a serious design flaw.

These flashlights were designed to run on alkaline batteries, not rechargeable batteries. Rechargeable batteries are capable of a much higher current output than alkaline batteries. The switch in the end of the flashlight does not limit the current to below the 3 A maximum limit on the Cree XM-L datasheet.

The flashlight I'm about to disassemble was the victim of such careless behavior as to actually use rechargeable batteries in a Duracell branded flashlight. One click of the button and that was it. The LED was burned out. This feature made for some very unsatisfied customers. Now, for the disassembly.

Update 14 April 2018: I checked out the new Duracell 1000 lumen flashlights at Costco and they now say they work with rechargeable batteries. 

First, I'll remove the lens with two strap wrenches.



Next, I'll unscrew the LED module.


Next, I'll pop the plastic off that surrounds the LED. This is the part that secures the LED and heat sink (MCPCB assembly). There is heat sink compound between the MCPCB and the aluminum housing. But this plastic piece doesn't seem to be a very secure or reliable method to make sure the MCPCB doesn't come off the base if the flashlight is dropped.



After un-soldering the two wires, the MCPCB can pop out.

The original MCPCB was part number RB-AL03, made by RAYBEN. It's rated at 0.5 - 0.9 C/W, with maximum operating temperature 110 C.

I looked up a similar LED on mouser.com and found an XML LED for $6.93 each, or $3.24 each for 2000 at a time. I didn't find the same MCPCB available online, but another one for an XML that sells for $1.01 each, or $0.44 each for 10,000 at a time. So it's not surprising that you can find XML MCPCB assemblies on ebay for less than $10 each.

But is it worth it to fix an $18 flashlight? Probably not. Your labor per hour, ordering the parts, and paying for shipping makes it impractical. However, if you could pop in a higher power MCPCB, then maybe it would be worth it to make a custom flashlight. Or, how about a UV LED for spotting fluorescent dye? Or how about a red, green, or blue flashlight?


And, of course, what teardown would be complete without a look at the power button assembly? I used a 17 mm socket and a hammer to push the button out. Then I rotated it counter-clockwise when the ground tabs got up to the threads so that they wouldn't get caught.


Here it is, the power switch board. This is the assembly that cost Duracell so much in product returns. (I have no idea how much.) They must not have realized that you should use a current source to drive LEDs, not a voltage source. Notice that there are no inductors on the board. That means they aren't using a DC-DC converter such as a buck converter. Now, was it worth it to have all those product returns to save a buck, leaving out an inductor? I think not.



Well, there you have it. The power button actually still worked (on my other flashlight) after I re-assembled it.



Saturday, October 10, 2015

Diagnosing Insufficient EGR Flow

1999 Mercury Cougar 2.5L V6
OBD-II trouble code P0401

The check engine light came on and gave me code P0401 for insufficient EGR flow. I should have gone straight into diagnostics mode instead of shop-and-swap. I replaced the DPFE sensor because I had one fail on my old 1995 Windstar and figured this one had failed too. I also replaced the EGR valve because that's the first thing back-yard mechanics replace when there's an EGR code. I knew better, but was lazy. Both those parts still had some life left in them. Oh well. With my luck, they probably would have failed eventually. But that didn't take care of the trouble code. So I needed to get to work and properly diagnose the problem.

I connected my OBD-II scanner and set it to capture the DPFE sensor voltage continuously. The flow sensor was reading about 1 volt for no flow. So far, so good.

Next, I needed to apply vacuum to the EGR valve's vacuum port. All you need to fully open the valve is 5 inches Hg. I revved the engine up and the voltage didn't go over 1.5 V. Holding the EGR valve fully open at 2000 RPM, it only read 1.2 V. Fully closed is 1 V; full EGR flow is 5 V. I wasn't getting much flow.

I needed to narrow down where the restriction was. So I removed the EGR valve, plugged it's intake port and ran the engine. Exhaust came out of the tube, as expected. Revving the engine got the DPFE sensor to read up to 5 V at wide open throttle. Bonus! Max EGR flow reads 5 V. The new DPFE sensor was working as it should.

Next, I needed to see if the EGR valve itself was much of a restriction. This step was just to exhaustively diagnose the flow restriction for each part. I attached the old EGR valve to the tube, without bolting it to the intake manifold. Revving the engine with 5 in Hg applied to the EGR vacuum port gave me over 4 V. If I was being scientific about it, I would have recorded the exact results and test conditions.

EGR flow sensor - check.
EGR valve - check.
Intake manifold ports - need to check.

Now it appears that the most likely location for the flow restriction is in the intake manifold. I reassembled everything except the vacuum hose to the EGR valve. While revving the engine with 5 inches vacuum on the EGR valve port, it didn't get over 1.5 V on the DPFE sensor. Bingo. My intake manifold EGR ports were plugged.

I took off the upper intake, which I didn't really have to do. Of course, I didn't know that at the time. The job can be done by removing the throttle assembly. But by taking off the manifold, I could spray it off and blow it out without getting garbage in the intake.

By the way, spraying carb cleaner and mass airflow cleaner in the EGR port didn't work. Blowing compressed air into the EGR port didn't clean it out either. It seemed like there wasn't a restriction because the compressed air could blow through, but if you look at the picture below, one of the three ports was completely blocked off. The other two were mostly blocked. If this was a heart, and the EGR ports were heart arteries, the patient would have been dead.

Gray arrows showing clogged EGR passages

I peeled off the gasket and cleaned out the EGR ports. Unfortunately, I forgot to take a picture of it all cleaned out. A screwdriver was all the technology I needed to remove the carbon build-up.

Carbon build-up in EGR passages

After re-assembling it, I repeated the EGR flow test. I watched the DPFE sensor readout while applying 5 in Hg vacuum to the EGR valve vacuum port and revving the engine. I got over 3 V, so cleaning out the ports definitely made a huge difference. Again, sorry I didn't get the exact measurements and test conditions. It was enough to show me that it was working.

Simply driving for 10 miles didn't turn the light off, so I resorted to resetting the check engine light with my OBD-II scanner. I was hoping the code would go away on its own so I didn't have to wait a day before getting the emissions checked. Amazingly, after driving another 10 miles or so, the readiness monitors were all ready for emissions testing. I was thinking the evaporative emissions system wouldn't be ready for a day. The light didn't come back on, and it passed emissions. Yay! It barely passed safety though. The emissions guy advised me on the left rear caliper. It wasn't braking as much as it should have been. I have a feeling I know what's coming soon on this blog.

Thursday, August 20, 2015

Obnoxious Password Rules


We've all seen password rules, and most likely been annoyed by them. They think they're doing us a favor by requiring a highly secure password. But freedom is better. The more password rules they have, the less secure the password is because it's harder to remember, and it has to be written down, in its entirety. It can be so easily forgotten that you have to use the forgot password link and have a temporary one emailed. And email isn't very secure.

Can you imagine having to remember a password like this? &#p>b2"D8%u>w+\{6

On August 14th, I tried to login to my.t-mobile.com and was redirected to a page where I was required to change my password to a more secure one. I tried one of my usual passwords, and all the check marks turned green, so I figured it was good. So I clicked the button. No good. I tried several new passwords that appeared to satisfy the password auditor, but they still didn't pass their new, hidden stringent quality standards auditor, so I made up a stupidly complex password with absolutely no words found in the English dictionary. That appeared to be the problem with my other attempts. They included words found in the dictionary.

This new password had 16 characters, upper and lower case letters, numbers, and symbols. It looked like the gibberish that would appear on the screen when you tried to open an executable file in notepad. Finally, their algorithm appeared to accept my new password. But, since their server was "experiencing problems", I couldn't make it all the way through the password changing process. I didn't know if I should use my new or old password to log in.

I tried logging in with my new password, then my old password, but somehow went over the number of attempted login re-tries and got locked out for 24 hours. They had an option to "click here" and email me a temporary password. I tried, but of course, the server was "experiencing problems". Could it be that the overly stringent password requirements backfired? I was imagining thousands of frustrated T-mobile customers cursing their website, unable to pay their bills.

Saturday, August 15, 2015

Replacing the timing chain on my 1999 Cougar 2.5L V6

I count it as a blessing that the engine didn't fail. It was close, and it could have had the timing chain fail at any time. It wasn't making noise (aside from the rattle at start-up), so I figured it was okay to drive the car to the airport and back before changing the timing set. My wife advised against it, but I figured it would be ok. She was right, but thankfully not so right that the car didn't make it.

Since I found the timing chain guide fragments in the oil pan, it was only logical to replace the entire timing set.

1999 Cougar 2.5L V6 DOHC, showing both timing chains

After removing the cover, I rotated the engine counter-clockwise and it made the left side timing chain very loose. The tensioner didn't keep tension on it in this situation. Here, I can lift the chain off the guide and shake it. The left side (front of car side) timing chain had actually skipped a couple teeth. This explains the loss of power. Getting blocked by trucks passing from behind you when you're trying to merge into traffic gets old really fast.




Check out how worn the old guide is compared to the new one. This was all because it was missing the plastic piece. Without that plastic piece, the chain just tore into the aluminum.

Old and new timing chain guide, without the plastic piece attached


Old timing chain guide that lost the plastic piece

Since the chain was so loose, it somehow rubbed on the oil pump. It looks fine still, so I'm not going to replace it this time. (The oil pump is on the bottom half of the picture, with the crankshaft protruding out from the center of it.)

Oil pump housing damage

After doing this job, I can tell you that if the oil pump ever needs to be replaced on this car, it'll be more than the oil pump needing replacing. There's no oil pressure gauge. That means that if the oil pressure light comes on steady while driving, it would probably mean "you need a new car". But it may also be repairable. You could start by taking out the radio, then you have a big pile of used parts that you roll out of the driveway. Drive another assembly of parts (commonly called a car) into the same space, re-install the stereo, and you're good to go.

Not only had one guide completely failed, the remaining three guides all had fragments broken off. They were barely hanging on.

Broken chain guide, barely hanging on

So, to prevent the plastic from coming off the new guides, I glued the plastic pieces on all four new guides with black RTV silicone. I wonder why the engineers didn't implement something like that in the first place.

Glueing the timing chain guides together

I find it puzzling that they warn us to never rotate the engine counter-clockwise, but this can happen a little bit every time you shut off the engine. Also, what happens when you stall the engine when you're trying to start on a steep incline? These things happen, and the manufacturer can't just assume that the engine won't ever rotate backwards during every-day use.

The plastic timing chain guides had a small clip to keep them from sliding off, but they look like a backwards rotation could easily dislodge them and break pieces off as I saw on my engine.

After installing the left side chain, and counting and re-counting links to be absolutely sure it was timed correctly, I noticed that the other chain had black links for aligning with the timing marks. Oh, how easier the first chain would have been if I had seen those. Oh well. The left side chain is either on backwards, or doesn't have marked links.

I got confused on how they counted the links. The literature says that there are ten links between the timing marks on the intake and exhaust cams. I took that a little too literally. There are ten whole links if you put the marked link over the mark, instead of putting the mark between the links. If you line the marks up between the links then it's 11 links between the two cams, and 24 instead of 23 from the cam to crank mark.

If someone ever takes this engine apart, they may wonder how in the world the chain skipped a tooth on all three sprockets, yet remained exactly in time.

So if you have a marked chain, then put the marked links directly over the timing marks, and count the unmarked links between the marked links and you should end up with 10 links between cams, and 23 between cam and crank on the non-tensioned side. That goes for both chains.

One thing I learned on this job was that there's a special way to rotate the cams to neutral. At cylinder 1, TDC of the compression stroke, the left side chain's cams are in the neutral position. Remember, left side chains are on the right if you're facing them. Let me explain. No, there's too much. I'll just summarize. Left is in reference to the left side of the engine as you sit in the driver's seat in a traditional rear-wheel drive vehicle.

If you then rotate the crank clockwise from TDC so that the crankshaft key is in the 3 o'clock position, then the right side cams (your left . . . towards the rear of the car) are in the neutral position. If you try to install the second chain with cylinder 1 at TDC, you may have the cams snap-turn and pinch your thumb. It's okay. My thumb is fine now. Oh, and 3 o'clock is as you're facing the front of the engine. The front of the engine is on the passenger side of the car, in this case.

The car is running better now. Before the repair, it would lose power above about 5200 RPM. I mentioned that to my son after he borrowed the car, and he said "yeah, I noticed."

Of course.

Now it pulls all the way up to 6500 RPMs. I didn't go all the way up to the rev limiter, and it definitely accelerates faster than before.

Update 22 May 2017

The left timing chain tensioner failed. The product was Engine Tech brand and only had a 12 month 12,000 mile warranty. It's been almost two years since I installed it. Here's the link to that blog entry.

Wednesday, July 29, 2015

What's the biggest part you've ever found in an oil pan?

The 1999 Mercury Cougar 2.5L V6 has been leaking oil since I got it last fall. I tried changing the timing cover seal for the crankshaft. That wasn't leaking much. I rebuilt the power steering pump. That wasn't the biggest leak. It looked like the oil pan gasket was leaking, so I decided to change that. If it's still leaking, then the timing cover gasket better be it.

The engine used to make a bad chattering noise when I started it until it built up oil pressure. I didn't know what it was, but then one day, the noise went away. That should have been a clue that something bad happened. Cars don't just fix themselves. If the noise went away, then something probably fell off, or broke.

When I took the oil pan off, the oil pump pickup screen was cram packed with debris. Again, not good. That was restricting oil flow. In the oil pan, I found some sizeable chunks of what looked like a timing chain guide.

Timing chain guide chunks

So without that plastic piece, the timing chain has been rubbing on metal instead of plastic. That's not good. The oil had a brassy metallic color to it when I drained it.

There's a baffle in the bottom of the oil pan that I removed to get the rest of the chunks out. 

1999 Cougar 2.5L oil pan, inside view
Oil pickup tube and screen, cleaned out

Bottom of engine, oil pan removed

Timing chain, looking from the bottom of the engine
Without the plastic piece on the timing chain guide, it will change the timing of the camshafts on that bank. The OBD-II scanner also showed a long term fuel trim difference between bank 1 and bank 2. That means there's an air flow difference between the two banks. So this was the cause of at least some of the missing horsepower.


Monday, July 6, 2015

H19txt Disassembly

I was moving a cabinet on a hand-truck when it fell off and I tried to catch it. My earpiece was in my pocket when I tried to catch the cabinet, and the earpiece got squashed. It still works, but the microphone no longer picks up sound well enough to hear.


So, for the sake of sharing, I decided to disassemble the H19txt. It was already broken, so any further damage wouldn't matter to me. Obviously, I'm not responsible for any damage caused by following the same procedure I list here.

First I removed the top gray cover. If you use a sharp knife and pry it towards the center, it should release the clips and pop off.


Next, remove the plastic trim by prying away from the body. These two pieces were already damaged from being squashed between my thigh and a falling cabinet.



The flip easily comes off by prying the clips wider. One end fits over a square side that activates a switch on the circuit board. The other end is rounded. It's the same basic style as the H17. I broke the flip on my H17 and ordered a replacement. The replacement was the H19 style. The replacement didn't have the rubber bumper on it that made it close softly. That's one feature from the H17 that I like better than the H19txt.



 The circuit board can be removed by first prying up on the USB connector end. Then carefully slide it towards the USB end of the earpiece.


Underneath the circuit board, we can see the lithium ion cell. It is taped in, and can be removed by prying it out.




For my replacement H19txt, the first thing to do is to hold the call button down when opening the flip to get to the settings menu. I turn off the voice prompts so that it takes less time from turning on to being able to talk when I answer the phone.

So, if you have an H19txt and want to replace the battery or something, I hope this helps.

Monday, June 8, 2015

Fixing buzzing H19txt bluetooth earpiece

After a year or so of using my H19txt, it started buzzing like something was on the speaker. I thought the speaker may have either been torn, or my ear hair was poking into the speaker.

After a little testing, I determined that my ear hair was definitely not poking into the speaker. So I decided to peel off the speaker grille. There wasn't much to lose at this point if I broke it. Luckily, it was attached with foam tape. Here's a picture of the earpiece with the grille removed.
You can see the black double-sided foam tape on the back of the speaker grille. There is a bunch of pocket lint, skin cells, and maybe even some ear wax built up on the screen over the speaker. Since I had a microscope handy, I took a picture of it.
After a little cleaning, the screen looks better.
Amazingly, after pressing the grille back on, the buzzing sound was gone.

I also went through the menu and turned off the voice interface. (To get to the menu, hold the call button down as you open the flip.) So now when I turn it on, it just beeps instead of saying "Phone one connected . . . More than eight hours of talk time." If I get a call and it's in my pocket, I can open the flip and put it on my ear and start talking sooner instead of waiting for it to get done saying "phone one connected".


Wednesday, May 20, 2015

Dude, Where's my PC?

If you've ever had a PC or laptop stolen, lost, or knew someone who had that happen to them and wished there was an easy way to track it down, this may help.

It will work on Windows systems if you install Linux as a dual-boot option. It will default boot to Linux. Password protect Windows so that the "user" is forced to only use the Linux OS. You can have Linux boot without requiring a password login. This will keep the new "user" busy while your computer is phoning home. Just don't write the super-user password down on your computer.

If you have the public IP address, you can get a close physical location, but probably not close enough to matter. However, if you also have a list of the nearby wifi networks and signal strengths, you can pinpoint the location pretty accurately if you know some trigonometry. See? This is one good reason to pay attention in math class.

It may take some roaming around from the IP address's stated location before you find one of the networks, but in theory it should be possible to locate the missing PC. 

Here are the steps.

1. Backup your PC. You know, just in case you accidentally have it install Linux by erasing your Windows installation.

2. Install a linux operating system if you don't have one already. Choose dual-boot if you wish to keep Windows.

Prevent the new "user" from easily re-installing the operating system:

3. In BIOS, set the boot order to boot to the hard drive only.

4. Password protect BIOS so step #1 can't be changed without the password. 

5. If you'd like to be able to remotely log-in to the PC if you knew its IP address, install openssh-server.
sudo apt-get install openssh-server

6. Enable your PC to email you by setting up mail:
   sudo apt-get install ssmtp
   sudo apt-get install mailutils
If you have gmail, you have to change your google account setting to allow access from less secure apps, otherwise it will block your PC's login attempt. If you forget to do this, you'll get an email that will tell you that google blocked a login attempt.

7. Edit the mail configuration file
sudo gedit /etc/ssmtp/ssmtp.conf

# Example file /etc/ssmtp/ssmtp.conf ---------------------------------------------------
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=your.email.address@gmail.com

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587
AuthUser=your.email.address@gmail.com
AuthPass=your.gmail.password
UseTLS=YES
UseSTARTTLS=YES
# Where will the mail seem to come from?
#rewriteDomain=

# The full hostname
hostname=gmail.com

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES
# end of file --------------------------------------------------------------------------------------------

8. Change permissions on the email config file so that a non-superuser can't view its contents. We want to hide the ssmtp.conf file from non-superusers because it contains the password for your email.
sudo chmod 600 /etc/ssmtp/ssmtp.conf

9. Install curl so we can get the public IP address the computer is using.
sudo apt-get install curl

10. Create a script. We'll show you an example in a bit. In order to run every day that the PC is powered on, copy your script to the directory: /etc/cron.daily/
Make sure the name of your script does not have an extension, or else it won't run. If you name it checkin.sh, thinking it'll work because some shell scripts end in .sh and it even runs from the command line, it still won't run automatically.

Here's an example script that will email you the public IP address and the surrounding wifi network names and signal strengths.


#!/bin/bash
#
# Get public IP address and save it in ~/.locality at the end of the file.
# Save only the IP address to the file, and error output to the bit bucket.
curl ident.me > ~/.locality 2>>/dev/null

# Get the location of the ip address that's saved in the file .locality and dump the error in the bit bucket.
curl ipinfo.io/<~/.locality >> ~/.locality 2>>/dev/null

# Check if I'm superuser. It should be, if it runs automatically.
if [[ $(id -u) -eq 0 ]]; then
echo "" >> ~/.locality
echo "Superuser" >> ~/.locality
echo "" >> ~/.locality
else
echo "" >> ~/.locality
echo "Regular user" >> ~/.locality
echo "" >> ~/.locality
fi

# Scan for wireless networks and save to the same file. Send errors to the bit bucket.
# must be superuser to run this command.
iw dev wlan0 scan >> ~/.locality 2>>/dev/null

# Email
# Subject
SUBJECT="My PC location"
# To
TO_EMAIL="your.email.address@gmail.com"
# Message
# Sending email using /bin/mail
mail -s "$SUBJECT" "$TO_EMAIL" < ~/.locality
# Delete the .locality file.
rm ~/.locality 
# end of script checkin ---------------------------------------------------------


11. Hide the contents of your script from regular users, but allow them to run it, because, you know, another email confirmation is great.
sudo chmod 711 /etc/cron.daily/checkin

Additional Information

How to find the public IP address from the command line:
xmodulo.com/how-to-find-the-public-ip-address-from-command-line.html

How to find the geographic location of the ip address
Use curl ipinfo.io/[ip address] (from xmodulo.com/geographic-location-ip-address-command-line.html)

How to scan nearby wireless networks from the command line:
xmodulo.com/manage-wifi-connection-command-line.html

How to send email from a script:
http://linuxconfig.net/manual-howto/sending-mail-from-bash-script.html

I'll bet some experts out there can improve on this. If you have any great ideas, leave a comment!

Saturday, March 7, 2015

How to install the Nvidia 346.35 driver for a GTX 960 video card on Linux Mint 17.1

It took several tries and research on the internet to figure out how to get the driver loaded. After crashing Cinnamon a couple times, I figured out how to get it to install without crashing and everything seemed to work right. Since I had such a difficult time figuring out the correct way to install the driver, I'm creating this guide in case it can benefit someone else.
Click here for a more recent tutorial on installing version 352.63 on Linux Mint 17.3.

System build specs
Motherboard: Biostar A960G+
Video card: EVGA GeForce GTX 960 video card
Ram: Corsair 8GB DDR3 CML8GX3M2A1600C9
Processor: AMD FX-6300

Installation procedure
I followed these steps exactly and it worked without crashing anything.

1. Print out these instructions. Read through them before doing anything so you understand the procedure. It's helpful to understand what you're doing, instead of just typing a command because someone said to do it.
2. Backup your system, unless you're starting from a fresh install, like I did. I installed Linux Mint 17.1 from a DVD that I burned.
3. Then I installed the updates, so the system was up to date. I updated it before attempting to install the video driver.
4. Download the Nvidia 346.35 driver for Linux.
5. (Optional) Make a backup copy of grub.cfg in case you need to revert back. Open a terminal, and type the following:
    cd /boot/grub
    sudo cp -p grub.cfg grub.cfg.original
6. (Optional) Backup grub
    cd /etc/default
    sudo cp -p grub grub.original
7. Since the driver installation requires that we boot into a terminal instead of the GUI, we need to change that, temporarily. We need to make two changes to the file /etc/default/grub, with gedit, running it as super user:
    sudo gedit grub
    Add the word text so that the following line looks like this:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash text"
    The next item is important, otherwise, you'll get a black screen instead of booting to terminal.
    Uncomment the following line (remove the #)
    GRUB_TERMINAL=console
If you don't uncomment that line, you'll get a black screen instead of a terminal. Not fun.
8. Save and exit gedit.
9. Re-build grub.cfg by running the command
    sudo update-grub
10. We're still in the GUI now, but after we reboot, it should go straight to a terminal instead of launching the GUI.  Reboot now by going through the normal turn-off procedure
11. When the computer turns back on, it should be in the terminal window, asking for login. Type your user name, hit enter, then enter your password. If you got a black screen, you probably didn't uncomment the correct line in step 7. 
12. You should be at the command prompt now. I assume you downloaded the Nvidia driver to your downloads directory. We'll go there now. 
    cd Downloads
13. Run the installation driver by typing:
    sudo sh NVIDIA-Linux-x86_64-346.35.run
Say yes to everything. It said a pre-install script failed, but I continued installation anyway.
14. After installation completes, don't reboot yet. We still have to fix grub so it doesn't boot to a terminal again. We'll use the pico editor since we're not in the GUI.
    cd /etc/default
    sudo pico grub
Remove the word text so the line is back to how it was before:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
You should probably leave this line uncommented:
   GRUB_TERMINAL=console
15. Save the file and exit pico. So in the future, if you hit ctrl-alt-F1, you should get a terminal. If you comment the above line again, it just goes to a black screen. To get back to the GUI, hit ctrl-alt-F7 or ctrl-alt-F8, but don't do that now since we're not in the GUI yet. 
16. Now we need to rebuild grub.cfg with the following command:
    sudo update-grub
17. Shutdown the computer with the following command line:
sudo shutdown -h now
18. Turn the computer on, and it should boot up normally, into the GUI with the Nvidia driver. But it doesn't list it in System Settings / Device Drivers. 

Leave a comment if this helped you.
Thanks.

Sunday, January 4, 2015

Bleeding the ABS unit on a 1996 Ford Thunderbird


Vehicle

1996 Ford Thunderbird LX 3.8L
It has the Teves MK IV ABS system with traction control.

 

Symptoms

I've been having a problem with my brakes for a few years now. The rear brakes don't have enough braking power. When I took my car in for safety inspection, the brake bias was way too far forward, meaning the fronts did most of the braking, and the rears barely did anything.

The other problem was that if I pressed hard on the brake pedal, I could get it to go all the way to the floor. If I did a panic stop, I could almost get the wheels to lock up on dry pavement, but this would require lots of pressure on the brake pedal. I was worried that I would have to press too hard in an emergency situation.

 

Attempt 1

So I replaced the master cylinder and bled the brake system. That didn't help at all. I was considering replacing the proportioning valve, but didn't because I suspected air in the ABS unit because of the excessive pedal travel.

I activated the traction control while bleeding the brakes. I activated the ABS in the snow, then bled the brakes. I bled the brakes again. Nothing helped.

 

Research

So I turned to the internet and the service manual. Both sources said that I needed to get my hands on a T90P-50-ALA tool. I didn't have the $300 that they wanted for one on ebay. So I found some wiring diagrams and a pin-out diagram. These were really helpful, but I still made a couple mistakes along the way. Hopefully you don't repeat my mistakes.


 

Attempt 2

This was a near disaster. I blew a fuse trying to hook up power to the ABS valves. I was connecting to the wrong end of connector C-104. Basically, I connected power to pins 3 and 33 of the ABS module without the ABS relay being activated. When the main ABS relay is not activated, it connects pins 3 and 33 to ground. Connecting power to ground is not a good thing. Something had to melt. It's a good thing there was a fuse between the battery and my connection to ground. 

After recovering from that mistake, I thought you run the pump with all the valves activated. Well, that made the ABS motor make an awful sound. I hope I didn't damage it. After putting it all back together, it still wasn't fixed. I was not having a successful day.

The ABS module is located in front of the front wheel on the driver's side. Here's a picture with the inner fender removed and the wiring harness detached.


 

More Research

Then I took a look at the hydraulic diagram. I realized my mistake. By closing the inlet valves, I blocked the path of the brake fluid from the pump, preventing it from circulating. (See dead head definition.) If I activated only the outlet valve, then the motor could circulate brake fluid, leaving the air bubbles in the reservoir. The inlet valves are normally open, while the outlet valves are normally closed. When you activate either valve, you change the state (open to closed, or vice-versa). Activating the valve is done by grounding the appropriate pin on the connector to the ABS module. 

This is an ABS diagram similar to my Thunderbird, but it doesn't have the traction control valves in the diagram.


 

Attempt 3

Here's the approximate procedure I used to bleed the ABS unit on my Thunderbird without the help of the T90P-50-ALA tool.

  1. Remove the front driver's side wheel, remembering to implement all safety precautions.
  2. Remove the inner fender.
  3. Disconnect the wiring harness from the ABS control module. You pull on the metal clip and rotate it up to the top. Then lift the connector to remove it from the module.
  4. Ground pin 34 to activate the main relay. This makes power available to the valves.
  5. Ground pin 15 for twenty seconds to run the ABS motor.
  6. Ground pins 2, 21, 36, and 18 to activate each wheel's outlet valves, one at a time while the ABS motor is running. Don't run the motor for more than 60 seconds. Maybe run each valve for 5 seconds each.
  7. I'm not sure if you're done at this point if you have traction control. But here's what I did next.
  8. I hadn't found a hydraulic diagram for the traction control part yet, so I opened both rear dump valves (pins 18 and 36) with the ABS motor running while I activated pins 37 and 40, one at a time to run fluid through the traction control part.
I was really hoping this worked. Unfortunately, it is mostly the same. But it was enough to get it to barely pass the brake skid-pad test at inspection.






 

More Research

I found this diagram on the internet. It looks like this is the traction control version for FWD (still not my RWD version, but maybe close enough to figure it out).
 
 
Only the outlet valves are normally closed. The inlet valves and the two special valves for the traction control are normally open.
When the traction control is activated, the special valves close to prevent the ABS unit from applying pressure to the  front brakes.

I'll probably have to work on this again to pass the next annual inspection. So here are the next two possible solutions I'm going to try.


Bleed one-way valves

Activate both traction control valves and dump valves for the back wheels while pressing on the brake pedal to bleed through the one-way valves.

Close the inlet valve and compress the caliper piston to bleed each one-way valve on the inlet valves. Do this for each wheel.


Bleed pressure relief valves

Activate both traction control valves and the ABS pump.

Hopefully this fixes it. I don't see a way for the $300 bleeder tool to bleed the one-way valves if there's any air stuck in them. So I don't see a point in spending the extra money if there's a chance it won't solve my problem. Inspection is coming up, so if the brakes don't pass this month, I'll be updating this post soon.