Friday, July 10, 2015

ZaReason Verix 547 Touchpad Freezes

This is another in my series of love notes to ZaReason's Verix 547 Linux-compatible laptop.  This time I'm working on some odd "pauses" or "freezes" in the behavior of the touchpad.

Every now and then, seemingly at random, I'll be moving the pointer with the trackpad and suddenly the pointer simply stops.  Clicking, swiping, dragging... nothing.  I can continue to type, so the keyboard is still active, but otherwise the trackpad is simply unresponsive.  Interestingly, if I switch away to a virtual terminal and come back, miraculously the touchpad is active again!

At first I thought it was related to the trackpad itself, which is:

$ xinput --list | grep Touch
⎜   ↳ SynPS/2 Synaptics TouchPad id=11   [slave  pointer  (2)]


$ cat /proc/bus/input/devices
...
I: Bus=0011 Vendor=0002 Product=0007 Version=01b1
N: Name="SynPS/2 Synaptics TouchPad"
P: Phys=isa0060/serio1/input0
S: Sysfs=/devices/platform/i8042/serio1/input/input5
U: Uniq=
H: Handlers=mouse0 event4
B: PROP=9
B: EV=b
B: KEY=6420 30000 0 0 0 0
B: ABS=260800011000003

...

So, a Synaptics part.  But I couldn't quite find anything that matched the exact behavior.  My weak Google-fu finally dropped me here:

https://devtalk.nvidia.com/default/topic/766166/elantech-touchpad-related-nvidia-driver-freeze/

It's not exactly the same environment - the author specifically calls out an ElanTech touchpad, but the behavior is smack on.  Naturally, this is an NVIDIA PRIME-/Optimus-related issue.  ::sigh::

Turns out this author helped identify a bug and it was fixed in an upstream Xorg release - but not the Xorg used in *ubuntu.  While my Xorg says it's 1.16.1 and the was applied to 1.16.0, apparently the patch didn't get accepted until a later release of 1.16.1 - comparing the release dates via 'X -version' showed me that.  Even xorg-edgers didn't have a later X release with the patched code.

A very kind soul packaged up a .deb with the patched xorg binaries and supplied them here:

http://askubuntu.com/questions/507744/touchpad-acting-weird-in-14-04-on-msi-cr70-2m/550603#550603

Long story short, I downloaded the .tar, extracted the .debs, and installed the ones that mattered.  (This user is obviously an X developer, as he had tons of debugging tools and virtualized X server tools installed.)  All I needed was xserver-common and xserver-xorg-core.

It worked!  The touchpad freeze is completely gone.  Thank you, friends!

Oh, and until I upgrade to Kubuntu 15.04, which comes with the fixed X, I put those two packages on hold in apt via:

echo "hold xserver-common" | dpkg --set-selections

This makes life easier when I'm doing upgrades and I might forget to uncheck the xorg packages.

OK, another laptop quirk knocked out!

Knocking out the little things with my ZaReason Verix 547

So, as I've detailed in prior posts, I'm running Kubuntu 14.10 on a new Verix 547 laptop from ZaReason, a vendor and integrator in Berkeley.  So far it's been going well, but there are niggles to deal with, of course.  Even ZaReason, which specifically configures and supports Linux on the machines they sell, has problems with some functionality on this laptop.  Just goes to show the power of OEMs that only test and guarantee operation on Windows - such a hassle!!

Here are some of the issues I've had out of the box with the Verix:

  1. lightdm absolutely refuses to show the greeter (login) screen.  I can still log in and it starts up a Plasma session, meaning the keyboard is active and the greeter is detecting my keystrokes and parsing the password, but the greeter is blank.
  2. There are intermittent pauses in the touchpad operation.  At random times the touchpad will simply cease accepting input.
  3. Sometimes the desktop environment (Plasma/KWin) would become corrupted and unresponsive after a resume from suspend.
  4. I can't get audio to output to the HDMI port.
Some of these I've already managed to get around.  Woo-hoo!  Thank you, Interwebz!!  Specifically:

  1. After searching for days and trying many hacks, lightdm was still always showing a blank screen for a greeter.  The strangest thing was that I could still type my password, press enter, and then the splash would come up and the desktop environment (Plasma) launched fine.  This would happen whenver the greeter was shown, such as logging out and relogging in.  However, the screen locker was fine - resuming from suspend would show the password field.

    After a LOT of fiddling around and searching, I knew that the problem was related to X and not to the touchpad.  For example, I could tap the pad and move the cursor outside the password field, and suddenly typing and pressing <enter> wouldn't log me in.

    Also, I didn't see any errors in the X or lightdm log.  Nothing that screamed "Hey, I can't display myself!".  I found a post that describes dealing with black screen issues with NVIDIA Prime systems.  It referred specifically to 14.04, but it talked about the same problem - booting up into a black screen with keyboard active and switching to a VT.

    The post was mainly concerned with corrupt xorg.conf's that were being rewritting by 'gpu-manager', which I don't appear to have running on my system.  BUT, when I compared their "correct" xorg.conf to my own conf file, I noticed something interesting.  They included this option in the Intel device section:

    Section "Device"
        Identifier "intel"
        Driver "modesetting"
    EndSection

    The "modesetting" driver was something I hadn't seen before.  Here was my xorg.conf, autogenerated by nvidia-xconfig:

    Section "Device"
        Identifier "intel"
        Driver "intel"
        BusID "PCI:0@0:2:0"
        Option "AccelMethod" "SNA"
    EndSection

    Mine was a tad different - notice the "intel" driver, but that's really it.  Everything else is just extra specification.  So, I modified the driver to go from "intel" to "modesetting" and... VOILA!  I can see the lightdm greeter now!  It's not pretty - very barebones, but it works!  I assume I can hack on the theme (background, etc.) to make it nicer.
This post is a little longer than I expected, so I'll address the other issues in subsequent posts.

Thursday, July 2, 2015

My new ZaReason Verix 547 and Kubuntu 14.10 - almost perfect!

So, as I recounted in a previous post, I returned the Gigabyte P55W rev4 laptop because I couldn't get it to run Kubuntu 14.10 reliably.  I replaced it with a ZaReason Verix 547 15.6" big, honkin' machine and I've been getting Linux up on it.  Little quirks along the way, but I can't complain so far.

I decided to try to save some dough and reuse 16GB of Corsair Vengeance DDR3L memory I had, as well as reuse a SanDisk Extreme 480GB SATA SSD and a Mushkin 120GB mSATA SSD, all from my late and lamented Dell Inspiron 15R Special Edition (2012).  ZaReason was amenable to this, and actually delivered a laptop to me without any memory or storage.

In retrospect, I should have just gone with their components.  For one thing, I blew up my memory during the install.  Well, it died sometime between when I ripped out of the obstreperous Gigabyte lappy and I installed it in the new Verix system.  The system booted fine and brought up the GRUB menu both on my SSD and from the live Kubuntu 14.10 stick.  But, trying to load an OS choked with kernel panics, and a subsequent mem test immediately barfed out tons of errors (red lines in MemTest86 are bad).

After a quick trip to Frys, and an eternal wait for them to actually find the memory in their little locked electronics wire bunker, I was back in business.  The Verix is easy to get out, with only 6 screws to undo and then easing the plastic tabs out to get access to the bottom of the laptop.  The two 2.5" SATA slots are there, as well as 2 of the memory slots.  But, I couldn't find the other two memory slots or the mSATA slot.

I think those are actually under the keyboard, but I couldn't figure out how to actually get it off.  I can see the tabs above the F-key row on the keyboard.  I have to insert some implement into the tabs to force the keyboard out of the tray... but I can't figure out how.  Oh, well.

The problem with adding the memory from the base of the computer is the memory slots are partially covered by the heatpipe from the 970M.  Ugh.  Here's a picture:


You can see the two empty SO-DIMM slots to the left of the big-ass heatsink.  This was more of a pain than I expected.  It took some time and patience, but I did finally get them installed:



It all came up fine.  The mem test went fine, the Kubuntu install was easy.  Woo-hoo!

 At this point it was running Nouveau and doing OK.  I did an update, an upgrade, then a dist-upgrade and rebooted.  Yeah, yeah, I probably didn't have to reboot... but there were some messages on the Interwebz indicating people had encountered problems installing nVidia binaries without doing HARD shutdowns in between.

Then came adding the xorg-edgers PPA and doing another update.  Another reboot, then going into a TTY (X didn't come up), running nvidia-xconfig to generate a default X.org config file... and here I am!  glxgears is rocking around 11K FPS (with anti-aliasing and font smoothing turned off...), and the display is nice.  Yeah, it's REALLY big, but the sound is also fine.  I can't complain.

Not all's perfect, though it is pretty durn good.

I've been having an odd "pause" problem where the display seems to freeze for a period of time.  Turns out it was related to my trackpad... but more on that later.

From Gigabyte to ZaReason!

About a month ago I needed a new laptop and bought a hot-of-the-presses Gigabyte P44W v4 from NewEgg.  In a previous post I described my experience with the Gigabyte.  My initial reports were positive, but unfortunately I quickly soured on the machine.  It suffered from a number of problems that were showstoppers for me:

  1. I never got the nVidia proprietary drivers installed correctly.  The CPU (i7 4710MQ)'s integrated graphics and the discrete nVidia card never worked correctly.  The binary drivers would never correctly detect the discrete card.  Nouveau would work (unreliably), but X would always fall back to the iGPU.  What was the point of a 970M w/3GB?
  2. Kubuntu 14.10 was never very happy.  I quickly backed away from Kubuntu 15.04, which is the first Kubuntu to feature systemd and Qt 5/Plasma 5, but even my workhorse 14.10 wasn't reliable.  I suffered from frequent lockups and long pauses.  It wouldn't always start up consistently, either.
  3. Wireless range was quite poor.  I never had a problem with my Dell talking to my wireless router (D-Link Dir-645) through multiple walls and between floors, but the Gigabyte was barely able to hold the link open.  Throughput was poor, and I ended up having to actually go into the room with the router to do any downloading.
Because the laptop was so new, I didn't have any previous experience to mine (how did we live before StackOverfow and Google?), so I felt adrift.  I ended up pulling out my RAM, SATA and mSATA SSDs, replacing the OEM components, and returning it to NewEgg.  They quickly gave me an RMA and a full refund, including shipping.  STILL LOVE NEWEGG!!

I was looking for a laptop that had been vetted for Linux, and I ended up wading into the land of "Linux Certified" vendors, the most famous being System76.  After a lot of searching, I settled on ZaReason, a small system builder in Berkeley that has been around for 7+ years.  I liked ZaReason because it's computers were completely configurable (every component), their laptops all had removable batteries, and, of course every system came with Linux preinstalled and thus were guaranteed to work well with my favorite operating system.

I settled on a Verix 547, which has a 15.6" FHD screen (which is nice!), 2 2.5" SATA III ports, 4 SO-DIMM slots (up to 32GB), and a big 9-cell battery, amongst other goodies.

There are some trade-offs, however:

  1. The systems are more expensive.  The components seem to be of high quality, but I paid about a 20% markup on the ZaReason as it was out of the box.
  2. I really mean complete configurability.  In addition to choosing all the normal stuff (CPU, RAM, HDD/SDD size, etc.), I actually had them not supply any RAM or storage in my laptop.  Yes, it basically came in an unbootable state!  I had a very specific way I wanted to install Kubuntu and I didn't feel like describing it down to every detail for them.  They did test it on their own, but when the sent me the system with the components ripped out.
  3. They really worked with me.  I sent a bunch of questions about how reliable they found the 970M to be with Linux, how they set it up, etc.  Tony @ ZaReason always got back to me quickly and with a positive, "Yeah, we can do that for you" response.  They even gave me a refund for the stock components I had them remove!  So, I saved about $100 by not including the stock 4GB of RAM or the 500GB HDD.
  4. They provided an educational discount - as I'm enrolled in the OMSCS program at Georgia Tech, I could take advantage of it.  Every 5% helps!
  5. The laptop uses a generic shell (case) rather than any customized, vendor-specific, space-optimized case.  So, it's BIG - like 2.1" thick!  It has a huge bezel, which makes room for a full-size keyboard w/number pad (bleah).  It's also about 6 pounds, so this is NOT a Macbook!  This might fit into the "luggable" category.
  6. Shipping is slower than for a pre-configured system, so don't expect your rig to arrive just a few days after your order.
Overall, the ZaReason Verix 547 is working out well.  Maybe it'll be another post to describe installing Linux and getting the Optimus config working.

Friday, June 12, 2015

Brand spanking new Gigabyte P55W v4 laptop... Linux?!?

My workhorse Dell Inspiron 15R Special Edition that I got almost three years ago finally bit the dust.  It had Kubuntu 14.10 running from a SATA SSD and Windows 7 running off an mSATA SSD.  The laptop stopped detecting the power connection.  I tried multiple adapters (I had two, for both work and home), different wall sockets, etc., but nothing worked.  The power socket on the laptop had become very woodgie, with the male plug maintaining a very tenous connection and frequently falling out at the slightest jiggle.  I believe that an internal connection between the socket and the motherboard had become damaged.

After 3 years of faithful service, I wanted to go Dell again... but they've completely drunk the touchscreen, ultra-quad-wide-HD, Windows 8.1 Kool-aid that I couldn't find a laptop I liked.  I became hooked on the mSATA port, allowing me to showhorn two SSD disks plus the optical drive.  I ended up discovering a very new Gigabyte laptop, the P55W v4 (http://www.gigabyte.com/products/product-page.aspx?pid=5458#kf).  It only came out a few weeks ago but came with one of the first non-U (ulta lower power) mobile 5000-series CPUs (i7 5700HQ), up to 16GB, IPS FHD display, mSATA port, nVidia 970M... it looked really good.

Newegg had a great custom configuration (http://www.newegg.com/Product/Product.aspx?Item=N82E16834233094), the P55W-BNE, that perfectly met my needs.  Also, since the Dell was completely toast, I ripped out the extra memory, Samsung SATA SSD, and mSATA SSD and wanted to transfer it to the new lappy.  Turns out that the Newegg version was about as cheap as I could get for the features I wanted, since I reused the upgrades from the Dell (memory, SSDs).

But, would the Gigabyte run Linux?  There was a time running Linux on bleeding-edge hardware required persistence and determination.  The CPU was announced just a few weeks ago - this is HOT off the presses.  I pulled the OEM hard drive with Windows 8.1 (bleah) and the supplied 8G DDR3 1600 stick, replaced these with the parts from the Dell, and added the mSATA SSD (Gigabyte kindly provided a thermal pad for the mSATA SSD!).  The bottom of the Gigabyte is a single plastic part, so these replacements required me to completely remove the bottom (about 10 screws.  However, once the bottom was off, access to the SATA, mSATA, and memory slots was easy-peasy, which was in stark contrast to performing the same task on the Dell, which demanded that I remove four layers of case, keyboard, boards, and pray that I didn't snap off some plastic...

Naturally, I encountered problems:

  1. The system wouldn't boot at first.  I had to turn off secure boot in the BIOS as well as switch to the SATA conroller to IDE mode (from AHCI) and switch the boot method from UEFI to legacy OS.
  2. The bus order was different between the Gigabyte and the Dell, so my Linux drive (the Samsung with Kubuntu 14.10) switched from sda to sdb.  No huge biggie, since most of the Linux low-level disk access stuff (filesystems, grub, etc.) switched to using UUIDs, which aren't slot-specific.  I did have to modify /etc/fstab because I had hardcoded the Windows 7 NTFS drive's mountpoint (bad Jason!).
  3. The WLAN card wouldn't initialize.  syslog was showing me that it detected the WiFi hardware (Intel 7265-N) but couldn't find any compatible firmware for it.  I build my own custom kernels, so I was at 4.0.4, but it apparently doesn't include the firmware for this adapter.  I ended up dowloading the firmware directly from kernel.org: https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-7260-ucode-25.17.12.0.tgz.  I copied the iwlwifi-7265D-12.ucode file from that package into /lib/firmware, and we were off to the races.
  4. The trackpad wouldn't work.  The system didn't even detect the touchpad at all.  It's attached to the i8042 input bus serial chip, and this is what I should have seen via cat /proc/bus/input/devices:

    I: Bus=0011 Vendor=0002 Product=000e Version=0000
    N: Name="ETPS/2 Elantech Touchpad"
    P: Phys=isa0060/serio1/input0
    S: Sysfs=/devices/platform/i8042/serio1/input/input8
    U: Uniq=
    H: Handlers=mouse0 event8
    B: PROP=1
    B: EV=b
    B: KEY=6420 30000 0 0 0 0
    B: ABS=260800011000003


    After googling around, I discovered a message that mentioned a patch for 3.13 to fix the problem, here: http://askubuntu.com/questions/529797/elantech-touchpad-not-detected-on-gigabyte-laptop.  The patch was to i8042.c.  I had a copy of the kernel source, so I looked into the file.  Turns out there was ALREADY a workaround for the problem in 4.0.4.  Yes!  The work around was controlled by an i8042 module parameter, 'kbdreset'.  A reboot and manually adding the 'i8042.kbdreset' parameter to the kernel boot line, my trackpad is now happy.

    To persist the change, I modified GRUB_CMDLINE_LINUX in /etc/defaults/grub with that option, and now it reliably comes up every time.
  5. I can't start Windows from the mSATA SSD.  I haven't yet fixed this...
In the end, most of these would probably have been fixed if I had installed fresh, but the most relevant stuff I did:
 
  1. I had to turn off secure boot in the BIOS as well as switch to the SATA conroller to IDE mode (from AHCI) and switch the boot method from UEFI to legacy OS.
  2. I ended up dowloading the Intel 7265-N wireless firmware directly from kernel.org: https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi-7260-ucode-25.17.12.0.tgz.  I copied the iwlwifi-7265D-12.ucode file from that package into /lib/firmware.  This fixed the wireless issue.
  3. I added i8042.kbdreset to GRUB_CMDLINE_LINUX in /etc/defaults/grub and regenerated the grub.cfg (update-grub) to fix the trackpad issue.
In the end, the Gigabyte P55W v4 seems to support Linux really well.  I'm happy!!

 I hope this may be useful for somebody down the line.