Friday, September 7, 2018

Installing Linux Lubuntu 18.04.01 on Lenovo MIIX 320

I was looking for a cheap lightest notebook, not really looking for specific brand or spec. When a web suggest some choice, I forgot what is it, then my decision fall into Lenovo Miix 320. In my country, the notebook come with 2GB RAM, and 128 GB eMMC configuration. It come preinstalled with Windows 10, and I expect I would rid it off at the first attempt, cause I know the OS is power hungry for 2 GB RAM, and I do not want to deal with all the bad things happen in Windows environment. You know, Windows always need antivirus to run over time, which will consume the already limited processing power and resources, and many-many other things that Microsoft still failed to make OS as thin as Win XP (IMHO and subjective, Win XP feels good at 512MB RAM-without anti-virus and stable enough until it become un-supported OS and Microsoft stop patching it).

After I decided the laptop, I search for some success story installing linux on the machine, so I found:
None promise a smooth installation and both confirm at least Camera and SD Card slot would not work. For the records, I choose LXDE for my all Linux desktop, as based on my experience, it is  lighter than XFCE,Gnome/Mate but still give simplicity experience than other lightweight Windows Manager. 

To be note, this article is made based on the both link above with additional some change that I made. Some information are copied here as for archive in case the links above become inaccessible.

Preparation

Download the Lubuntu Desktop 64-bit from:

And write the image to USB either using dd on mac/linux, and for me it's my first using Etcher on the preinstalled Windows 10. 

On Windows 10, we need to shrink the partition of the Windows, just decided how many partition that you need for your linux. On my case, as I have 128 GB eMMC version, I decided to give linux 32GB. So the Windows partition is reduced using Disk Management less 32GB.

Still on Disk Management, turn off the BitLocker. This step is needed when you want to dual boot, as we will turn off the secure boot on the Lenovo bios. Turning BitLocker off, you will loose the encryption feature on the Windows partition.

Once the partition conversion done, you can restart the windows to make it boot from bios. Press the Volume-Up button while it restart. There are some other way like from Windows 10 Setting, Recovery boot...etc... (I'm already forgotten when I make this article)

On the BIOS, make sure to turn of the Secure Boot. You would not able to boot to the USB if Secure Boot still on. Save and boot again, hold the Volume-Up Button to come the BIOS again, select boot device then your USB drive.

Boot to Installation Image

On first boot, You will greeted by Installation grub. DO NOT press enter directly. You need to edit the boot parameter by press e to come to edit entry.

Before the line that starts with linux, add:
set gfxpayload=keep

At the end of the line that starts with linux, add:
nomodeset i915.modeset=1 fbcon=rotate:1

So they will lookalike:

Continue to boot. You may ended do the installation in portrait mode. This because the Ubuntu recognize the default screen as in portrait mode. Once done, you will boot it, and when in grub, you need do the exactly as above on the first boot, edit the boot parameter by press e.

Note: After the boot, You will have a black/blank screen. Just close the lid for some seconds and open it again (some time need 2nd attempt). You should see the login screen in portrait mode. Just login in any way you feel possible, then open terminal (Ctrl-Alt-t)and use xrandr to rotate the screen:

xrandr -o right

The command above will only rotate the screen, but it would not rotate the digitizer of the touch screen, so you will loose it for a while.

Fixing things

Now times to make some fix to the linux to adapt with the hardware. As most (if not all) of the commands below need root permission, we would become root by:
sudo su

It's much easier to manage things as root user rather than we type sudo multiple time on multiple commands. So commands below are run as root!!


grub

nano /etc/default/grub

Change or add the following lines:

# This to remove the splash screen
GRUB_CMDLINE_LINUX_DEFAULT=""
# 2 Lines below are as adviced by Mansoor, there are explanation on his web.
GRUB_CMDLINE_LINUX="nomodeset i915.modeset=1 fbcon=rotate:1"
GRUB_GFXPAYLOAD_LINUX=keep


Press Ctrl+x and then y and press Enter to save it.

To make the boot show the right text, we still need to hack the grub update script. FYI, this hack should be not recommended, but it's not covered with the /etc/default/grub. Because somehow the grub can show in landscape mode, but after, the kernel recognize the screen in portrait mode.

nano /etc/grub.d/10_linux

## commented line 154 about setting gfxmode, so become:
#echo " gfxmode \$linux_gfx_mode" | sed "s/^/$submenu_indentation/"
# Then add (note: space after first double quote is tab, to keep the file look nice):
echo " set gfxpayload=keep"
echo " gfxmode 800x1280"

Press Ctrl+x and then y and press Enter to save it.


Then update the grub with command:

update-grub

initramfs

I do not really know if this part would took effect, but as xowl advice about the backlight and blanking during boot, I was applied this part. In the end, related or no, I can do backlight controls in the X.

cd /etc/initramfs-tools
nano initramfs.conf

Change the line:
MODULES=most
to
MODULES=list

Press Ctrl+x and then y and press Enter to save it.

lsmod | cut -d ' ' -f  1| sudo tee -a modules
nano modules

Change the line (actually remove the header):
Modules
to (and add this line, on my case, I have same module below so I doubled it):
pwm-lpss
then find a like that says i915 and remove it.

Press Ctrl+x and then y and press Enter to save it.

And update the initramfs with command:

update-initramfs -u

X configuration

As advised by Xowl, create file /usr/share/X11/xorg.conf.d/11-miix320.conf

nano /usr/share/X11/xorg.conf.d/11-miix320.conf

Press Ctrl+x and then y and press Enter to save it.
Notice the: Option "Rotate" "Right", this is to rotate the screen from portrait to landscape.

I prefer to use xorg-input-libinput rather than xorg-input-synaptic as the libinput have built-in 'disable touchpad while typing' rather we need to invoke another process syndaemon for synaptic, beside libinput is loaded too for the touchscreen. So move all the synaptic config file out, or you can delete them, or even remove the package.

mv /share/X11/xorg.conf.d/*synaptics* /usr/share/X11/

Then we need to 'rotate' the digitizer of the touchscreen and also modify on the touchpad options.

Add this to the touchscreen section:
Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"
So it will look like:


And add these to the touchpad secion:
Option "Tapping" "on"
Option "NaturalScrolling" "on"
The natural scrolling is to invert the scroll, you may prefer to turn it off.
So the section will look like:

Press Ctrl+x and then y and press Enter to save it.

When I write this article, the hard-click on the touchpad/clickpad still not work, either incompatible with the kernel or the libinput driver.

Blank/Black Screen on reboot

As on the first boot after the installation, the lid need to close then open again, it somewhat like triggering the DPMS off with close then on with the lid open. So we need to firing the event by scripts. This part may differ with different distro even Ubuntu variants may use different script name, but basically, we need to call command:
xset dpms force off && sleep 1 && xset dpms force on
Just after the X started and need be called by the Display Manager.

LUbuntu is use lightdm as Display Manager. As in documentation, lightdm have config display-stopped-script and greeter-setup-script, but none is work for me. And I found it call command 'upstart'. So I just create script /bin/upstart

nano /bin/upstart



Press Ctrl+x and then y and press Enter to save it.

chmod +x /bin/upstart

This script is not perfect, as it will be called when boot and every time screen being locked and user log-off, while actually it just need to be called once at very first boot.

Volume Controls

Volume controls is not run out of the box and the default LUbuntu is not work, we need to use XFCE daemon:

apt install xfce4-volumed

And with GUI:
  1. Open the 'Start Menu' -> Preferences -> Setup Hot Keys
  2. Open the 'Programs' tab
  3. Remove the lines with Open the 'Programs' tab
    • XF86AudioRaiseVolume
    • XF86AudioLowerVolume
    • XF86AudioMute
  4. SAVE, then close the window
  5. Open the 'Start Menu' -> Preferences -> Default applications for LXSession
  6. Go to the 'Autostart' tab
  7. In the 'Known Applicaions' part, put a tick near the 'XFCE Volume Daemon'
  8. Close the window

Battery Gauge

Battery Gauge was work out of the box at the first days I use the Miix 320, but after it stop to work. So I took xowl's advice. This is more a hack rather a solution, as this make a script keep running all over the time although most being slept. I change the original script from sleep 10 seconds to 30 seconds.
Please note, the script have more lines than the visible, scroll or select all in the text area.

apt install i2c-tools
nano /opt/axpd.sh

Press Ctrl+x and then y and press Enter to save it.

chmod +x /opt/axpd.sh
nano /etc/cron.d/axpd
Press Ctrl+x and then y and press Enter to save it.

Conclusion

Having linux on Lenovo Miix 320 is not perfect, but for day-to-day usage (like browsing, office work, youtube), it's better than use the preinstalled Windows 10. After all we are moving things to the cloud.

Here are the list for things to be fix:
  • Hard-click on the touchpad/clickpad
  • Headphone jack insertion event (I still failed to probe it)
  • Camera
  • SD Card Slot

No comments:

Post a Comment