Tuesday, November 24, 2020

Touchpad not working on CloudReady / Chrome OS? Here's how to fix it!

Covid-19 break seems to be opening up interesting avenues for me. I started a storeroom cleanup activity and I found an old laptop which I set aside a long time back. To my surprise, it booted up with no issues but the OS was extremely slow. It was running Windows but only had 2GB RAM. My instant thought was to install Linux on it.

So without even thinking, I started downloading Ubuntu. That's what you install when it comes to Linux, right? When the download was almost done, I figured that I was wrong. Ubuntu now requires 4GB RAM at a minimum! Sigh!

So I started looking at lighter distros. One was Lubuntu, which claimed to work with 2GB RAM. I downloaded that onto my flash drive and booted it up. It came straight to the GUI, without prompting me to install it. Now Lubuntu is running off my flash drive, and I cannot seem to find a way to make it install into the laptop. Maybe I have downloaded the wrong image, but whatever! (Guess what, there was this BIG icon on the desktop titled "Install OS" and I've missed it. So much for being a Software Engineer.)

One of my searches came up suggesting me to try out Chrome OS. I've been excited about it ever since Google released it but have never got a chance to try it out. Well, my laptop was made by eMachines, so there is no way I could install the version that comes installed on Chromebooks. But I found that a company called Neverware releases a port of Chrome OS for free. That sounded just right for me, so I got that downloaded by following the instructions on their website: https://www.neverware.com/freedownload#home-edition-install

And then it happened again. The OS booted up off the flash drive just like Lubuntu without prompting me for a clean install. But at least this time, I didn't have to curse all the way up to Linus Torvalds because CloudReady was much more explicit. Thank you! But my joy didn't last very long. Once the OS was installed and the laptop booted from its own hard drive, the touchpad seems to be not working. Now you cannot conveniently press the Windows key, type Device Manager, and go look for an updated driver, can you? Once again, Google to the rescue. How can something be more ironic?

Thankfully, I'm not alone. This touchpad issue seems to be something resident with Chrome OS. But the bad news is none of the solutions mentioned on the threads in CloudReady Community worked for me. The only promising solution was this. It sounded insanely simple. But I hit some roadblocks while following along. Keep that link open on a separate tab, we'll be needing to refer it from time to time.

And before I forget, I've been doing my research on my regular laptop which was running Windows, and trying out all the hacks on the other. I didn't have an external mouse at my disposal, otherwise, I would've done all that in CloudReady itself. I recommend doing it there itself because it makes your life easy when it comes to copying URLs and stuff.

First of all, you need to open up a terminal. It turned out that Ctrl+Alt+F2 doesn't work on CloudReady. You need to hit Ctrl+Alt+T in Chrome to get a terminal. And when you type 'sudo su', it doesn't seem to like that.

Then you learn you need to type 'shell', to get a proper terminal, or bash if that's what you should be calling it. And voila, you get a bash logged in as 'chronos', who is the root I believe. Perfect!

Now you try out the command 'mount -o remount, rw /' just to learn that it doesn't work either. It tells you that 'mount: only root can use "--options" option'. Seems 'chronos' is not the root after all.

Now you learn you gotta type 'sudo su -' to log in as root. And then you get a properly elevated bash, along with some funny warnings saying now you should better know what you are doing. Yeah right! What you are actually going to do is execute some low-level commands on your laptop, as root, which some stranger on the Internet claimed to fix your touchpad. So much for security!


So you run the mount command again anyway, just top be greeted with this: 'mount: cannot remount rw read-write, is write protected'. Well, this is the built-in protection kicking in so you cannot go around doing any harm out of your own stupidity, even as root. You need to disable it. That's how the hacker gets to gain access to your system remotely. Wait, what?    

Type "sudo disable_verity" to take care of that. Oh, I forgot to mention, that step was irreversible. Too late to worry about that now, so go ahead and reboot. Well, how? You may ask. "sudo rebootis what you need.

Once you are back online, try out the mount command again and it shouldn't give you an error this time. Remember, you gotta repeat the steps to log in as root first. Now you try out the next command in that tutorial "cp /etc/X11/xorg.conf.d/50-touchpad..." and figure out that it doesn't work as well. The reason seems to be that the path does not exist. Now you are literally screwed!

I didn't understand any of those Linux bash commands on that tutorial, but with my limited DOS knowledge, I could tell that we are trying to backup an existing configuration file related to the touchpad and then replace the original with one from the Internet.

So the first thing I did was to see if that URL still works. All my future effort will go in vain if that final bit fails. httpys://chromium.arnoldthebat.co.uk/files/fw/etc/X11/xorg.conf.d/50-touchpad-cmt.conf seems to be valid. Now I need to find where the heck my configuration files are.

First I tried a couple of DOS commands and was surprised to find out that those work! There's that "etc" folder, but there is no 'X11'. I need to find where my touchpad configuration file is. A little bit of googling told me that "find -name "*touchpad*.*" will do the trick.

There you have it. That stupid config is buried in the "gesture" folder now. But wait, the name is somewhat different. Mine is called "40-touchpad-cmt.conf", so I'm guessing that replacing it with the one mentioned in the tutorial is not gonna work. Off to google again...

Searching for that file name took me here: https://chromium.googlesource.com/chromiumos/platform/xorg-conf/+/refs/heads/master/40-touchpad-cmt.conf. That seems to be mirroring their official repo if I'm not mistaken. But how the heck am I gonna download this without the nagging html styling? Well, it turns out there is no such way! Really? Well, I got a better idea. How about just copy-paste the damn text into a new file and host it somewhere? Github Gists to the rescue!

So I created a gist with the content of that file. Now anyone can download it as a raw file by going to this URL: https://gist.githubusercontent.com/elninoisback/82d0a014d13c330d225cbcd52ed3ceb9/raw/4ae1773388197ef1802953873e2ae2e2cf38aaed/40-touchpad-cmt.conf. But wait, how on earth am I going to type that into a console? I could've used my keyboard skills to open up a new tab, login to my Github, and try to copy that off somehow, but I was too lazy for that. I tried a URL shortener instead. So now it's down to this: http://shorturl.at/qtvMS. I dunno if this will stay working forever, but you just need it to work only 5 minutes, so why not?

Back to the bash. Few commands to get inside the "gesture" folder. Then run the following:
cp 40-touchpad-cmt.conf 40-touchpad-cmt.conf.bak rm 40-touchpad-cmt.conf wget http://shorturl.at/qtvMS
mv qtvMS 40-touchpad-cmt.conf

If you are lucky, you will have no issues. If so, skip the below step. But for me, nah, are you kidding me? I wasn't that lucky. It said "wget" is not a valid command. Fcuk this, I'm going to install Windows XP. Yep, that's exactly what I felt. But after a little bit of more googling, I got to know that you can actually enable wget by running the below:
sudo su -
dev_install
emerge net-misc/wget

So after getting that hosted config file downloaded into that folder, and after getting it renamed back to its original name, you gotta reboot the laptop. We covered that earlier didn't we? Just type "sudo reboot", and the next time when it boots, your touchpad will be responsive! Err but I know your mileage might vary. Did I mention, you gotta be very very lucky too? :P

If you got any hiccups, or even if this didn't work for you at all, let me know in the comments. I'll try my best to help you out. Cheers to your new OS!

Touchpad not working on CloudReady / Chrome OS? Here's how to fix it!

Covid-19 break seems to be opening up interesting avenues for me. I started a storeroom cleanup activity and I found an old laptop which I s...