Thursday, April 21, 2016

Configuring Ubuntu 15.04 on Macbook Pro 13 Inch Late 2011

Most of things work out of the box for Ubuntu 15 on Macbook Pro but there are still something you have to fix.

Keyboard backlight is reset to maximum every time I reboot


Put the following command in /etc/rc.local file just before 'exit 0':
chmod 777 /sys/class/leds/smc::kbd_backlight/brightness
Then add the following command in /etc/profile file:
echo 0 | tee /sys/class/leds/smc::kbd_backlight/brightness

Note that we can just put the second command in /etc/rc.local and it should work but I don't know why the content of the file is reset back when I enter the login screen every reboot.

Reverse function keys


To use 'fn' key in combination with function keys to turn on or off volume for example, you must put the following command in /etc/rc.local just before 'exit 0':
chmod 777 /sys/module/hid_apple/parameters/fnmode
Then, add the following command in /etc/profile file:
echo 2 | tee /sys/module/hid_apple/parameters/fnmode

Trackpad


For drag and drop, just use your index finger to click and hold the trackpad and move your middle finger for dragging.

In my case, 3-finger tap for making middle click does not work so I have to configure it in the default synaptics driver settings. You can use synclient program to make the real-time change to the settings but just temporarily.
synclient TapButton1=1
synclient TapButton2=3
synclient TapButton3=2
synclient ClickFinger3=2
1, 2, and 3 mean left, middle, and right buttons respectively. To make permanent change, you can put those commands in a script file, /usr/share/mysynclients.sh for example and then add it to Startup Application. Or you can try to modify xorg.conf file but it made palm detection not work well. However, if you want to do it, you can put the following codes in /usr/share/X11/xorg.conf.d/50-synaptics.conf file as following:
Section "InputClass"
        Identifier "Default clickpad buttons"
        MatchDriver "synaptics"
        Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
        Option "SecondarySoftButtonAreas" "58% 0 0 15% 42% 58% 0 15%"
        Option "TapButton1" "1"
        Option "TapButton2" "3"
        Option "TapButton3" "2"
EndSection
But, it might not work as the Gnome setting daemon in /etc/X11/xorg.conf file will override existing settings in /usr/share/X11/xorg.conf.d/50-synaptics.conf. You can fix it by:
> sudo apt-get install dconf-editor
> dconf-editor
And then, browse to /org/gnome/settings-daemon/plugins/mouse/ (or /org/cinnamon/settings-daemon/plugins/mouse/ for cinnamon) in the editor and uncheck Active checkbox. Then, reboot.

Disable locked drags
synclient TapAndDragGesture=OFF

Sensors (Fan)


coretemp allows lm-sensor detect the other sensors such as the rotation speed of the fan and the GPU temperature. Typing the following command will activate the coretemp in next reboot:
sudo modprobe coretemp
You should use fan controller daemon included in the mactel-support ppa called macfanctl.
sudo add-apt-repository ppa:mactel-support/ppa 
sudo apt-get update
sudo apt-get install macfanctld

You can change the minimum fan speed in this file /etc/macfanctl.conf.

Others

For more configurations for such as battery saving (or you can install indicator-cpufreq), go read this.



Related Articles:
http://myt8chnote.blogspot.com/2016/04/installing-ubuntu-on-macbook-pro-using.html

Monday, April 18, 2016

Where is Java home on Mac OS X?

I'm using Mac OS X Lion v10.7 and I have downloaded Java 8 DMG file from Oracle's web site and installed it. After installing it, i can't find Java home directory. According to http://stackoverflow.com/questions/1348842/what-should-i-set-java-home-to-on-osx, there is an executable file that print Java home location to console by default, /usr/libexec/java_home.

> ls -l /usr/libexec/java_home
lrwxr-xr-x  1 root  wheel  79 Apr  7 17:03 /usr/libexec/java_home -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home
> /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home

And then you can set JAVA_HOME variable in /etc/profile file as following:
> export JAVA_HOME=$(/usr/libexec/java_home)


Add favorite folder to Finder's sidebar

To add a favorite folder to the Finder's side bar on Mac OSX Lion v10.7, we can just simply drag that folder in Finder to the sidebar. ;)

Saturday, April 9, 2016

How I backup/clone all drives of my Macbook Pro

I'm running OS X Lion v10.7 on Macbook Pro 13 inch late 2011. I have installed 3 operating systems on it such as Mac OS X Lion, Windows 7, and Ubuntu 15.04. To avoid problems in the future such as disk failure, I have backup my drive as following:

1. Mac OS X Lion is my primary OS and I use Carbon Copy Cloner to clone the partition to external hard disk drive so I can boot OS X from the external HDD any time to restore the partition.

2. To backup and restore Windows 7, I must do it from within OS X using Winclone app version 4.x.

3. For Ubuntu, I used Clonezilla to backup/restore the partition it was installed on to/from image files. I installed Clonezilla Live on a USB drive so that I can boot into Clonezilla from that USB by not depending on any operating systems. According to Clonezilla's official website, I made the bootable USB on Ubuntu using Tuxboot program. There are 2 methods to make a Clonezilla live USB by Tuxboot, online (downloading) and offline (ISO file). I used the online method in which Tuxboot downloaded the latest Clonezilla live for me and wrote it to my USB drive.

I think I should use only Clonezilla to backup/restore all partitions of my Macbook Pro.


Installing Ubuntu on Macbook Pro using bootable USB stick

I'm using Macbook Pro 13 inch late 2011 and I have just installed Ubuntu 15.04 on it successfully using a bootable USB stick. I followed this post http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-mac-osx to make a bootable USB stick. When restarting machine, I hold option key until I see an option to boot from the USB drive. Surprisingly, it worked only for Ubuntu 15.04 ISO file I downloaded from Ubuntu's web site. For other previous versions such as 10.04 and 11.10, the USB drive is not bootable at all (it didn't show up boot menu).

Note that if you have an external hard drive and want to put Ubuntu Live on that partition to make it bootable, it wouldn't work. You can only do it with the entire USB drive.


Related Articles:
http://myt8chnote.blogspot.com/2016/04/problems-with-ubuntu-1504-on-macbook.html

Thursday, April 7, 2016

A workaround for setting up Windows 7 on Macbook Pro without optical drive

I want to make an update on the post i wrote here http://myt8chnote.blogspot.com/2016/04/installing-windows-7-on-macbook-pro.html After rebooting several time, the Windows partition was corrupted and then i also tried to do it the same way again many times but it no longer worked. I have just found a workaround for that.

As my Macbook Pro only boot from the USB drive that has OSX on it, I used Carbon Copy Clone to clone or backup my OSX partition to the external hard drive so if anything happens, I can use it to restore the main OSX partition.

I also have Windows installed along side the OS X. I downloaded the Winclone image file of Windows 7 from thepiratebay.se web site and use Winclone app on Mac OS X to restore the image file to another partition then the partition is bootable too.

NOTE: resizing partition might corrupt your Windows 7 installed even if the partition is not the one you installed Windows on.

Monday, April 4, 2016

How to prevent partition from mounting automatically on OS X Lion

You might have another OS installed a long side OS X and don't want to mount it when starting OS X to avoid modifying it accidentally which can corrupt the OS. To prevent the partition from mounting automatically, you can do as followings:

See which volume you don't want to be mounted automatically from the output of the command below.
> diskutil list

From the following command, note the Volume Name and Type (Bundle) attributes.
> diskutil info /Volumes/<Win7>
   Device Identifier:        disk0s6
   Device Node:              /dev/disk0s6
   Part of Whole:            disk0
   Device / Media Name:      BOOTCAM

   Volume Name:              Win7
   Escaped with Unicode:     Win7

   Mounted:                  Yes
   Mount Point:              /Volumes/Win7
   Escaped with Unicode:     /Volumes/Win7

   File System Personality:  Tuxera NTFS
   Type (Bundle):            fusefs_txantfs
   Name (User Visible):      Windows NT Filesystem (Tuxera NTFS)

Create or edit /etc/fstab file
> sudo nano /etc/fstab
LABEL=Win7      none    fusefs_txantfs  ro,noauto       0       0

Then, reboot machine. That's it.




Problems I solved:
At first, I put ntfs instead of fusefs_txantfs in /etc/fstab file then it didn't work. I changed it to fusefs_txantfs and it worked.