r/SurfaceLinux • • Dec 10 '15

Out-of-the-box support for Linux Mint 17.3 Cinnamon on Surface devices - with improved touch support

This is a follow-up to my original LiveCD, but as I've done lots of updates since the last edit (and can't change the title to reflect that it's no longer the Beta/RC1 of Mint 17.3), it's high time for a new post.

The latest LiveCD now contains the following startup applications (as well as blueman for Bluetooth management, as before):

  • onboard for on-screen keyboard; docked to the bottom of screen by default

  • touchegg for gestures; compiled from git so that it works smoothly with Mint, unlike the standard Ubuntu version

  • autorotate with palm detection for automatic rotation; modified to work with SP1-3, regardless of model

  • autobacklight for auto backlight; slightly modified so it's disabled by default

  • redshiftgui for adjustment of light at night-time; disabled by default, and set to the longitude/latitude of Greenwich, UK when enabled

Also, I've included a GUI for Touchegg - again, I had to slightly modify the code for this as the original did not automatically restart touchegg after saving a new configuration, even though it tried to. Unfortunately, due to the /home folder being empty by default on the LiveCD, you need to press the "Defaults" button and then "Save" to be able to change the gestures.

As for firmware, I've included the latest Skylake and Broxton graphics drivers from Intel, along with the latest Marvell Wifi/Bluetooth.

Finally, I've included the latest kernel-surface package from my kernel PPA, which has all of the patches for the Surface line of devices known of thusfar, along with backported drm-intel graphics (including FBC and PSR power-saving for SP3 and Surface 3), plus the updated GCC-5 and initramfs-tools. There's also an updated graphics stack from my xorg-update PPA, which bumps X.org up to 1.18.2 along with all the drivers. Oibaf's PPA is also included as a PPA, so that LibDRM and Mesa are updated regularly once installed.

EDIT 1: There was slight mishap with the original LiveCD. The default configuration for touchegg doesn't contain a mapping for single-tap to "left mouse click", and without this, options in any menu accessed from the taskbar (including the Main Menu and Profile) don't work. I've fixed the issue by adding this both to touchegg and Touchegg-gce, but unfortunately this required a new ISO. The link to this ISO is now above.

EDIT 2: From the questions so far, it looks like I need to clarify the support on various Surfaces.

  • Surface Pro, 2 and 3: everything should work.

  • Surface Pro 4 and Book: with these having cutting-edge technology, the support in the Linux kernel isn't fully there yet. Due to this, the touchscreen won't work, nor will backlight control, physical buttons and cameras I believe.

  • Surface 3 (non Pro): although I have included kernel patches for the S3 (mostly the drm-intel changes, as these are required to actually boot), again support is limited. It's usable at least, though.

  • Surface RT range: these definitely won't work with this LiveCD. As 32-bit ARM devices, they'd need a different one, even if the bootloader could be bypassed somehow.

I would really like the SP4, SB and S3 experience with this CD to be better, and keep trying bleeding-edge patches in the hope these will fix at least the touchscreen, but I only have an SP3 so I can't easily test any changes (other than to check they don't break anything on that at least). It will get there eventually though; Linux always has to play catch-up with new technology, unfortunately.

EDIT 3: With the fix in Edit 1, onboard didn't function properly (keys were clicked twice - not very useful). I added a workaround for this by adding Onboard to its own group within the Touchegg GUI, and making single-tap do nothing for that group. Also, on the SP2 the touchscreen and pen weren't being reorientated properly when the screen was rotated. So, I made a number of changes to the autorotate script, and it works as intended now; there's even "palm detection" for when you're using the pen. Thanks to AykoPoel for the inspiration behind that. Finally, I got rid of the "remove media and press ENTER" prompt on powering off from the LiveCD, and set a timeout of 1 second on the grub menu (for when there's no keyboard/type cover). These are all fairly minor amends, but I've uploaded the new LiveCD with them now, please see above as usual for the updated link.

EDIT 4: I've now shared a folder on Google Drive and placed the ISO image into it, so the link will remain static. There's also a "Beta" sub folder, which is the latest, untested image - the current is identical in terms of scripts and applications, but with a patched Xenial kernel. Testers, especially with Surface Pro 4 and Surface Book, are most welcome! On previous models, this kernel appears to be more stable, quicker to boot, slightly better in terms of battery consumption, and because it's based on the latest "stable" Linux kernel, it's possible to integrate patches such as this one. The "Alpha" and "Beta" sub folders are now obsolete, I have kept the old ISOs within OLD sub-folders for anyone who still wants them, but as the latest Alpha is more stable, up-to-date and runs on more devices than the old "stable", with better display and HiDPI, it seemed insane to still keep that as an "Alpha". However, because many people have become accustomed to downloading the latest from the "Alpha" folder, for now I've made a copy of the "stable" into there.

EDIT 5: I've integrated some more ACPI patches into the latest beta version, mostly from patchwork, so the kernel more closely resembles the latest Linux tree. All of the patches (except BFQ, because that one's easy to find) now have a "From: (url)" at the top, in case anyone is curious where they come from. A few are amalgamated, and there may be slight amends, which were necessary to prevent problems with fuzzes (or worse, rejections) during the patching process. The beta LiveCD and compiled debs are now up to reflect the changes. No longer relevant, as these are all in the 4.4 kernel.

EDIT 6: The beta ISO has been updated with HiDPI enabled, text scaling set to 0.7, cursor size set to 18 (from 24) and icon size to "small", rather than standard. This further improves the touch experience, as UI elements and text are much easier to click (and read!); dconf-editor is included too, in case you want to change any settings. I've also upgraded the kernel to the latest Xenial version, based on 4.3.3. The debs are in the usual place for anyone who wants them, with patches to follow on GitHub later today (they're exactly the same, although I've modified the build script very slightly to do away with the "-oldmodule" and "version" patches). Also no longer relevant, but the stable ISO has all of the updates mentioned. The kernel, of course, is more up-to-date than that now. I have also removed the debs from Google Drive because they can be downloaded directly from the PPA instead.

EDIT 7: Last edit before the New Year - promise! I've added the UVC video patch and the "official" touchscreen patches one two from Daniel Martin (replacing my version) - thanks go to shvr for sourcing those. There's also a minor pinctrl patch which was pushed to 4.4-rc6, so that's included too. Merry Christmas ;) The pinctrl patch is integrated into the 4.4 kernel, so this is no longer required either. Err.. Happy Easter, I guess? ;)

121 Upvotes

398 comments sorted by

View all comments

Show parent comments

1

u/tigerite Dec 15 '15

I had that the first time I tried to install Mint 17.2 (pre patched kernel, when I was starting out) and I had that error about /target/ too, with "encrypted filesystem" on. I turned that option off the second time and it worked then, albeit really slowly because the wifi wasn't patched. I've also heard of other people having this issue randomly, but then had it work the next time they tried, so it seems a bit sporadic. Unfortunately I don't know why that is, as it's something within Mint itself, and isn't related to my changes.. I will see if I can dig anything out as to what it's doing. rEFInd is certainly another option though, it even has an icon for Mint these days..

1

u/[deleted] Dec 15 '15

Interesting. I made sure encryption was off for everything, so it shouldn't be related. Oh, Microsoft products, heh. I figure I'll just go the refind route. So long as it eventually boots.

1

u/tigerite Dec 15 '15 edited Dec 15 '15

Please do let me know if rEFInd works, I've never actually tried it from within the LiveCD environment, I would imagine you'll need to mount /dev/sda1 to /boot/efi first for it to work. I've had a dig around and found the culprit for the grub fail, but it's beyond my knowledge to fix; it's in /usr/share/grub-installer/grub-installer. It seems like it should only try to install grub-efi-amd64-signed if the /target/boot/efi folder exists, which the partitioner should have mounted, detecting EFI is necessary (according to the comments in the file). But then it fails to install into /target/, which doesn't make sense.

Edit, ok, that's just a generic message apparently, meaning that apt-install (which is a script to apt-get install with some menagerie of options enabled) failed. Very helpful..

1

u/[deleted] Dec 16 '15

Hmmm, I had the thought that I had to try manually mounting /boot/EFI and installing to /dev/sda and /dev/sda2 and it just boots right into windows every time. The /target/ error goes away if I manually mount /boot/EFI, and as far as I can tell the EFI files are where they should be but the bios ignores it.

I mean, I'm not understanding something -- how does this work for ANYONE? You can't install the bootloader unless you do it 100% manually as far as I can tell, which is kind of a nuisance outside of distros like Arch where its documented.

How did you install this?

1

u/tigerite Dec 16 '15 edited Dec 16 '15

My problem was almost certainly related to the wifi, which kept getting knocked out with the vanilla Mint 17.2 due to unpatched firmware. Once I had worked around that, by switching the power management off for wifi, it went without a hitch (as long as I had an Internet connection at the start of the process and chose to install updates). No connection means the grub installation fails.

EFI on Linux has always been a voodoo art to get working, and even when you manage it (either manually or when the installer works) then Windows still prevents grub from booting. [The way to bypass that, is to use bcdedit

  • although this didn't happen to me, so I was one of the lucky ones.

The other problem is there are so many variables that could be causing the issue. For instance, it's also possible your EFI partition is corrupted (maybe you haven't disabled Fast Startup in Windows - which has a lovely habit of corrupting the EFI)? The last post in that link is by the creator of rEFInd, I had forgotten there's a USB version, so you could definitely give that a try.

1

u/tigerite Dec 15 '15 edited Dec 15 '15

Just one more thought on this, have you connected to the internet before running the installer? Because without a connection, it will fail to download the grub package, and thus fail with the message. This thread shows people having the same issues 2 years ago with Xubuntu.

Or, could you check that your USB drive hasn't altered the name of the grub2-efi-amd64-signed file ?