Showing posts with label macbook air. Show all posts
Showing posts with label macbook air. Show all posts

Sunday, August 4, 2013

Installing Arch GNU/Linux on Macbok air Version 4.2(Late 2011) part 4

Disclaimer: I dont take any responsibility for the damage of your equipment. If you point your ire at me, I will have the last laugh. USE THE INFO AT YOUR OWN RISK.

 So, you have now rebooted to your liberated computing experience and have started loving to being master. Let us continue

WINDOW BORDERS NOT BEING DISPLAYED

add the line below in settings - settings-manager-session and startup-application autostart
/usr/bin/xfwm4 &

SWAP SPACE ON A FILE

Create 8GB swapfile instead of a swap partition(which we did not create while installing)
in the root partition.

dd if=/dev/zero of=/swapfile bs=1024 count=8388608  -- Red hat recommends twice the ram
if you are going to use the hibernate feature. If not you can halve the size of the swapfile
But, I believe that air users would love to use the hibernate feature. With hibernate the
entire ram contents are dumped to the swap partition and is read back when brought back
from hibernation.

swap is responsible for many a hacks on Unix/Linux systems. Restrict permissions
by using

chown root:root /swapfile
chmod 0600 /swapfile

mkswap /swapfile   -- To convert the file to swap file type
swapon /swapfile   -- To start using the file as swap, now.

To use the swapfile at every boot up

/swapfile swap swap defaults 0 0


ENABLE/DISABLE KEYBOARD BACKLIGHT

$su
#echo 100 | tee  /sys/class/leds/smc\:\:kbd_backlight/brightness  --- for full backlight brightness
#echo 00 | tee  /sys/class/leds/smc\:\:kbd_backlight/brightness  --- for backlight off


HARDWARE ACCELERATION

To use it with Arch, you simply need to install the xf86-video-intel package, this has the SNA patch included and should work with the most recent Xorg. It's then a simple case of creating /etc/X11/xorg.conf.d/20-intel.conf and adding:

Section "Device"

Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "sna"

EndSection

check your log to see if SNA is being used with the below command:

cat /var/log/Xorg* | grep SNA


INCREASE LIFE OF SSD

To make all these changes, open up a terminal and run:

sudo nano -w /etc/fstab

Then for all SSD devices in your system remove 'relatime' if present and add 'noatime,nodiratime,discard' so it looks something like this:

/dev/sda   /   ext4   noatime,nodiratime,discard,errors=remount-ro 0 1

SWAP WRITE MINIMIZE

echo 0 > /pro/sys/vm/swappiness

CHANGE THE IO SCHEDULER


    echo noop > /sys/block/sdX/queue/scheduler

Or better, use udev rules to check for rotational media.

#'deadline' is recommended by the author of CFQ for SSDs, replace it with 'noop' if you want.

    Create a file with a name like 10-ssd.rules in /etc/udev/rules.d containing:

# set a larger readahead size
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/read_ahead_kb}="1024"

# set deadline scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"


now, verify the scheduler

$ cat /sys/block/sda/queue/scheduler  -- The output would be. The selected scheduler is indicated in brackets.

noop [deadline] cfq


Replace "relatime" with "noatime" to stop the system from writing the last access times as discussed above. Next, add the following lines to fstab to put temporary and log files in RAM instead of on the solid state drive:

tmpfs   /tmp       tmpfs   defaults,noatime,mode=1777   0  0
tmpfs   /var/log   tmpfs   defaults,noatime,mode=0755   0  0
tmpfs   /var/spool tmpfs   defaults,noatime,mode=1777   0  0
tmpfs   /var/tmp   tmpfs   defaults,noatime,mode=1777   0  0


NEW CONFIG FILES FOR ADJUSTING TIME( from arch wiki )

Comment all time related lines in /etc/rc.conf

HARDWARECLOCK=...

and other time related entered in the previous steps

run   hwclock -w --localtime as root
It will create a file /etc/adjtime
cat /etc/adjtime
you should get some output with LOCAL in the end

Reboot


UPDATED LOCALE/TIME CONFIGS

emacs /etc/locale.gen
uncomment en_IN UTF8

emacs /etc/locale.conf
add the following

Lang="en_IN.UTF-8"
LC_COLLATE="C"
LC_TIME="en_IN.UTF-8"
export LANG=en_IN.UTF-8

run this command   hwclock --systohc --localtime


sound getting disabled once in a while

Keep using the system for a week/fortnight it will get repaired automatically


BRIGHTNESS OF DISPLAY

If the fn keys stop working for changing the display brightness then,

run the following commands

cat /sys/class/backlight/max_brightness
cat /sys/class/backlight/brightness

enter a value from 0 to max_brightness to change the brightness by

#echo 245 | tee brightness

Increase or decrease based on requirement.

UPDATE: The aboe step is not required. since brightness can be easily adjusted via plugins in xfce.

Frequency driver issues

Linux 2.9 and above are using the newest frequency driver called intel-pstate. This is for newer cpus. Tha macbook air was running hot. So remove it until the previous old processors are supported by this driver.
1. add intel_pstate=disable to the kernel line
2. echo acpi-cpufreq >/etc/modules-load.d/acpi-cpufreq.conf

If you dont like the colored borders behind the names of icons on the desktop do this

 It is possible you may have a .gtkrc-2.0 file already. If so, the
following lines can be added to it. Otherwise you will need to make this
file yourself and paste the below lines in the .gtkrc-2.0 file.

To make the file, just open a text editor and paste the following:

style "xfdesktop-icon-view" {
    XfdesktopIconView::label-alpha = 0
    }
widget_class "*XfdesktopIconView*" style "xfdesktop-icon-view"

So you want to connect your latest android smartphone

 Install packages gvfs gvfs-afc gvfs-mtp for automounting of USB devices
But just remember that mtp sucks on GNU/Linux as well as windows.

Thats it folks!!!. I dont think I have forgotten anything. All the best with your freedom.

Installing Arch GNU/Linux on Macbok air Version 4.2(Late 2011) part 3

Disclaimer: I dont take any responsibility for the damage of your equipment. If you point your ire at me, I will have the last laugh. USE THE INFO AT YOUR OWN RISK.

So, You are not used to being a master. You are used to situations where you adapt yourself to the Operating system(Master) and tells what you should be doing. So, be careful, what happens from now on is different. You tell the Operating system what is to be done and how it is to be done.

Let us begin.

After successful boot u will be logged in as root with the root prompt. Type the commands below as described. Majority of this info has been culled from the Arch wiki.


# nano /etc/hostname
enter your hostname press ^o and ^x to exit


# nano /etc/locale.gen

en_US.UTF-8 UTF-8
en_GB.UTF-8 UTF-8

# locale-gen
# export LANG=de_DE.UTF-8

#wifi-menu
select your wifi connection from the list given. It will prompt for the password. Give the password and you are connected to the public network.

#cgdisk /dev/sda

Be careful here. remember the partition scheme you had decided in the beginning. delete the partition you had created in osx for linux. Now create a partition and select the type as "linux". cgdisk is an ncurses interface for the gdisk tool. I created only one partition. cgdisk manages a GPT parititon table, rather than the traditional MBR-style partitions. If swap is required we can always create swap on a file in the regular file system. Remember the partition number you created. You can always find out the partition number by

#lsblk /dev/sda

format it to your favorite file system

#mkefs.ext4 /dev/sda5

mount the partition

#mount /dev/sda5 /mnt

Since we are on an efi system, we have to mount the first partition

# mkdir /mnt/boot/efi
# mount /dev/sdax /mnt/boot/efi

 Select a mirror

Before installing, you may want to edit the mirrorlist file and place your preferred mirror first. A copy of this file will be installed on your new system by pacstrap as well, so it's worth getting it right.

# nano /etc/pacman.d/mirrorlist

    Alt+6 to copy a Server line.
    PageUp key to scroll up.
    Ctrl+U to paste it at the top of the list.
    Ctrl+X to exit, and when prompted to save changes, press Y and Enter to use the same filename.

If you want, you can make it the only mirror available by getting rid of everything else (using Ctrl+K), but it's usually a good idea to have a few more, in case the first one goes offline.
Tip: Use the Mirrorlist Generator to get an updated list for your country. HTTP mirrors are faster than FTP, because of something called keepalive. With FTP, pacman has to send out a signal each time it downloads a package, resulting in a brief pause.

 Install the base system

The base system is installed using the pacstrap script.

# pacstrap /mnt base base-devel


 Generate an fstab

Generate an fstab file with the following command. If you prefer to use UUIDs or labels, add the -U or -L option, respectively. It's also a good idea to check it before continuing:

# genfstab -p /mnt > /mnt/etc/fstab
# nano /mnt/etc/fstab


 Chroot and configure the base system

Next, we chroot into our newly installed system:

# arch-chroot /mnt

At this stage of the installation, you will configure the primary configuration files of your Arch Linux base system. These can either be created if they do not exist, or edited if you wish to change the defaults.

 Locale

Locales are used by glibc and other locale-aware programs or libraries for rendering text, correctly displaying regional monetary values, time and date formats, alphabetic idiosyncrasies, and other locale-specific standards.

There are two files that need editing: locale.gen and locale.conf.

    The locale.gen file is empty by default (everything is commented out) and you need to remove the # in front of the line(s) you want. You may uncomment more lines than just English (US), as long as you choose their UTF-8 encoding:

# nano /etc/locale.gen

en_US.UTF-8 UTF-8
de_DE.UTF-8 UTF-8

# locale-gen

This will run on every glibc upgrade, generating all the locales specified in /etc/locale.gen.

    The locale.conf file doesn't exist by default. Setting only LANG should be enough. It will act as the default value for all other variables.

# echo LANG=en_US.UTF-8 > /etc/locale.conf
# export LANG=en_US.UTF-8

Note: If you set some other language than English at the beginning of the install, the above commands would be something like:

# echo LANG=de_DE.UTF-8 > /etc/locale.conf
# export LANG=de_DE.UTF-8

To use other LC_* variables, first run locale to see the available options. An advanced example can be found here.
Warning: Using the LC_ALL variable is strongly discouraged because it overrides everything.


Timezone Available time zones and subzones can be found in the /usr/share/zoneinfo// directories.

To view the available , check the directory /usr/share/zoneinfo/:

# ls /usr/share/zoneinfo/


Create a symbolic link /etc/localtime to your zone file /usr/share/zoneinfo// using this command:

ln -s /usr/share/zoneinfo/Asia/Calcutta /etc/localtime

Daemons

A list of available services (and their running status) can be found using the command:

# rc.d list


 Hostname

Add your hostname in /etc/hostname:

# echo myhostname > /etc/hostname


Wireless

     Install the required packages:

# pacman -S wireless_tools netctl

If you use WPA/WPA2 encryption, install:

# pacman -S wpa_supplicant wpa_actiond
#pacman -S dialog(for using wifi-menu it is a dependency)

initrd will be generated automatically during the install

#modprobe dm-mod



     Connect to the network with wifi-menu (optionally checking the interface name with ip link, but usually it's wlan0), which will generate a profile file in /etc/network.d named after the SSID. There are also templates available in /etc/network.d/examples/ for manual configuration.

# wifi-menu



GRUB



For 64-bit aka x86_64 UEFI firmware:

# pacman -S grub-efi-x86_64


The UEFI system partition will need to be mounted at /boot/efi/ for the GRUB(2) install script to detect it:

# mkdir -p /boot/efi
# mount -t vfat /dev/sdXY /boot/efi

Install GRUB UEFI application to /boot/efi/EFI/arch_grub and its modules to /boot/grub/x86_64-efi (recommended) using:

# modprobe dm-mod
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug
# mkdir -p /boot/grub/locale
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo


While using a manually created grub.cfg is absolutely fine, automatically generating one is recommended:
Tip: To automatically search for other operating systems on your computer, install os-prober before generating it:

# pacman -S os-prober

# grub-mkconfig -o /boot/grub/grub.cfg

After all this a .efi is installed in /dev/sda1/EFI/arch_boot/
This will read the grub.cfg in /boot/grub/grub.cfg

#passwd    change the root password


pacman -S xorg xorg-apps xorg-drivers xorg-fonts



#mkdir /home/vanisri
#useradd vanisri
#passwd vanisri
#chown  -R  $USER:$USER  $HOME

reboot

Hold the option button. This will choose the previous working refit screen. Here select osX. Once in osX re-install refit.
reboot
Hold the option button and see everything is fine.
reboot
Now you will get back the old refit which you have been using previous to installing arch. This is required since the step to install grub discussed above installed grub to the efi partition thereby overwriting the previous refit and you boot directly into grub instead of refit.


pacman -S xfce4 xfce4-goodies
pacman -S gstream.....
pacman -S firefox
pacman -S flashplugin
pacman -S alsa_utils alsa_oss ffmpeg alsa_plugins libva-driver-intel ttf-dejavu
#cat /etc/group
#gpasswd -a vanisri audio (Like this add yourself to the other groups)

pacman -S lightdm

pacman -Syu


#emacs /etc/rc.conf
HARDWARECLOCK="localtime"
TIMEZONE="Asia/Kolkata"

To display the correct time.

To check whether time is set properly

run the commands below
# hwclock --show
$ date

Both the commands should show the same time. Else run the following

# hwclock --hctosys

Now check the two commands above. They should be the same.


That completes a near 90 percent of Arch GNU/Linux installation on the Macbook air. Little more tips/adjustments/betterments in the next post.


Installing Arch GNU/Linux on Macbok air Version 4.2(Late 2011) part 2

 Disclaimer: I dont take any responsibility for the damage of your equipment. If you point your ire at me, I will have the last laugh. USE THE INFO AT YOUR OWN RISK.

To start, let me make a very strong statement about the state of support for the hardware of this version of Macbook air. The Linux kernel has "Out of the Box" support for all the hardware on this version. So, If you choose any distro which has excellent efi support and the latest bleeding edge Linux kernel you are good to go and try any distro.

I have gone with Arch GNU/Linux and I am loving it. The capability of hand tuning what you want on your laptop or desktop with Arch GNU/Linux is awesome. Coming from Debian GNU/Linux, where there is "flowing" installer where you chose all the options and then finalize the installation, it was different when my arch installer just dropped me to the root prompt and stood there blinking for my command. The exact way how a computing experience should be, You, the user, is the master.

Please go through all the resources I have linked in the previous post. Form your own procedure then You can fine tune it with any gotchas you find in my writeup. Let me be clear here that majority of what I have written here is verbatim copy of the Arch wiki. All the gratitude/thanks/kudos go to the Arch community of devs and users.

Preparation

    Download the most recent archboot ISO
    Write the ISO to a USB stick using dd or unetbootin(hugely recomended) or burn it to a CD/DVD.
    Prepare hard drive in OSX: (shrink your OSX partition in Disk Utility)

Download refit.dmg(the image file for a mac). Install it on the mac osx
reboot the air and hold the option(alt)key on the keyboard when u hear the start up sound.Boot into osx and reboot two to three times in the same way.
Now plugin the usb stick created and reboot(I would suggest you to get hold of an external dvd r/w, Yes, U can use any USB external dvd r/w. Because I have heard users comment that the dd method is not the best for efi based systems).

Reboot the air and press the option(alt) button at the startup sound.
Wait for a few seconds while refit loads and shows all the bootable files on the air. You will have two images whose logo will be that of a cd disc. One will be named windows and the other will be something like efi.. with the same logo(only the recent arch images have two options)
Select the image with the efi.. on it. Dont do anything on the terminal, wait for 6 seconds, arch will bootup and give you the root prompt and wait for its master's commands.

Be Carful here, Dont select the windows one as suggested in the above guides. There will be some extra steps since grub doesnt play well with efi.
Allow arch to boot.

Now go here https://wiki.archlinux.org/index.php/Beginners%27_Guide/Preparation#Preparation

GNU/Linux on Apple Macbook Air 4.2 (Late 2011) part 1

 Disclaimer: I dont take any responsibility for the damage of your equipment. If you point your ire at me, I will have the last laugh. USE THE INFO AT YOUR OWN RISK.

This post is my continuation of my earlier post where I drooled over the hardware implementation of Macbook air. After that post I have seen all the notebook manufacturers try to make a clone and majority have failed except for the samsung versions which have better connectivity options compared to the Air. But Macbook air is still the king in lightweight laptops. Why do I drool over the Airs being a hardcore freedom software evangelist? Hardware, exquisitely crafted hardware.

Let us get down to freeing the Macbook air from propreitory software it is running. I have chosen Arch GNU/Linux as my GNU OS of choice having read reports of it running beatifully on Mac hardware and not interested in running the Microsoft of the windows world, Ubuntu GNU/Linux.
Coming from Debian GNU/Linux, I saw that the ncurses interface for installing the basic OS is very similar. There was a shocker waiting for me. After downloading the latest x86_64 build, I connected the external DVD drive borrowed from my friend and booted it. What happens, The installer starts and dumps me into a root prompt. Thats it. I have installed slackware GNU/Linux and Debian GNU/Linux with neat installers though still ncurses based.

Time to search the public network. Now I see that the ncurses installer has been done away with. You have to install everything manually. Ofcourse there are lot of tools provided by the Arch GNU/Linux project to make the process simple and straight forward. At this juncture I would like to mention about the Arch WIKI. This is one of the most detailed wiki documentation I have gone through seconded or equalled only by the Gentoo GNU/Linux wiki.The wiki is written beautifully and is very easy to comprehend by anybody with a basic GNU/Linux background. In the process, I chrooted to another GNU/Linux installation for the first time and the raw power of the UNIX philosophy hit me on my face. KUDOS to all the "freeedom" developers.





Here are the links/resources/works/efforts I made use of in liberating my Macbook Air.

http://d.goodlad.net/articles/arch_linux_on_mba_42/

http://blog.billsdon.com/2011/12/triple-boot-13inch-macbook-air-4-2-2011-model/

http://www.billsdon.com/2011/12/install-linux-mint-12-lisa-13inch-macbook-air-4-2-2011-model/

http://plopez.nfshost.com/2011_macbook_air_pure_efi_dual-boot

http://calummacrae.blogspot.in/2012/06/control-freaks-macbook-air-introduction.html

http://maketecheasier.com/install-dual-boot-ubuntu-in-macbook-air/2012/08/27

http://www.linuxbsdos.com/2012/10/10/dual-boot-windows-7-and-ubuntu-12-04-on-a-pc-with-uefi-board-ssd-and-hdd/

The next post will be having all the gory details of installing Arch GNU/Linux on the Macbook air.


Tuesday, October 9, 2012

Freedom and Macbook air(AKA, "opposites attract")

I would loathe the Macbook pros and see that they were whitey, clumsy, heavy and awkward looking compared to the other notebooks in the industry. Of all the notebooks I liked the HP TX1301au for three reasons

1. It had an AMD Turion x2 processor( A processor developed with notebooks in mind )
2. It had a touch screen
3. It could be converted into what is called a "tablet" today by folding the display over the keyboard.

I saw this lappy being used by many users. HP had a very good concept but did not follow up on this( Just exactly what happened to one of the first professional looking GNU/Linux based touch phone, the motoming or a1200. It was a beautiful phone with a flavor of linux called the montavista linux, It was my first smartphone ). But I was happy with my lappy since It played good with GNU/Linux. Debian GNU/Linux ran on this beauty flawlessly. It was light compared to other laptops. It was smaller at 12" compared to other laptops. I went on and succesfully booted Debian GNU/HURD also on this lappy, but after the initial boot screen It was difficult. In summary, my lappy was free of all propreitory software, except for the nvidia driver(I know, I know, RMS is angry)

 It was the "apple" of my eye until Apple released their Macbook air. OMG what piece of hardware. I was drooling all over it. That was the best piece of notebook hardware I had set my eyes on. It was "gorgeous", "drop dead", "Awesome"........ All of a sudden "Light", "Small" and "Air" had a new meaning for me. I just compared the weight of my lappy with the air, it was shocking. I compared the looks, It was like comparing it with Mona lisa and the cave paintings. Evolution took a long time, as we all agree. But the "Air" was a "Revolution". A revolution which all others are trying to digest and cope up. I have still to see notebooks come anywhere near to the air(There have been a few and as Linus torvalds put it, others will catch up. But they will "catch up")

If we observe the Macbook air from its first iteration, nothing much has changed. The basic chasis is still the same. Changes occur when there are competitors and are forcing you to a corner. As of now the air leads the lot and others are catching up.

1. Yes, I know, RAM is soldered ---no upgrade
2. Backpanel is locked by propreitory shaped screws  --not to be opened by ordinary users.
3. No DVD drive --watching movies, opening presentations/documents at office on cd/dvd not possible(I dont know how many still do....).
4. Only two usb ports --Nowadays, I dont know what is the right number of USB ports required.
5. Runs on proprietory software  --A simple bios upgrade can disturb any custom OS on the device.
6. Hard drive capacity limited  --Though on a mid 2011 macbook air, we can still change the hard drives capacity, since it is not soldered.
7. Battery -- can be changed but at an apple store.

Oh, so many negatives. Let us get to the positives.

1. Incredibly thin/light/compact/portable
2. Unibody aluminium chasis  --No creaking
3. Awesome multi-touch touchpad(A very large one)(Clickpad, to be more precise) --The feeling of crossover between a tablet and a notebook with an additional "click" action throught the touchpad
4. Full sized keyboard --Completely relaxed position of the hands while typing, not to be disturbed by the touchpad. The touchpad can be made to respond to only the physical "click", that is, pressing the touchpad down(like clicking a mouse)
5. Lid opened with one hand only --The hinge tightness is just right to open with one hand and perfect enought to hold the display upright.
6. Keyboard backlight -- Intensity of the keyboard light can be changed via shortcut keys on the keyboard. Makes using it in dark environments a breeze(something from the smarphones, especially my sony ericsson mini pro). It is the right place to give sony, credit for the chiclet keyboard.
7. Magsafe charger --I liked the design of the charger, where it gets pulled(magnetic) to its charging point as it is brought near to the charging port(A deft touch, that).
8. Display --The 13.3" screen is just right at 1440 X 900 resolution. It is not the best out there, but ample enough.
9. Except the fan, No moving parts --It is "silent" most of the time. I noticed the fan rev up when flash enabled sites are visited. And the exhaust of the fan is let out at the hinge(I loved this piece of engineering). So your lap is kept as cool as possible.
10. The icing on the cake is an i7 processor clocking at 1.8Ghz with ondie graphics core and 4GB DDR3 RAM.

As a whole, I am just awed by the device hardware. All this comes to a standstill when you will see that it runs Mac osX, which is as propreitory an OS can get over a community developed code. It does make me happy(My happiness is nothing compared to that of the Freebsd community which prides itself whenever its code is being used for propreitory or "freedom" purposes) that it is using contributions from the free software community by using freebsd code and the mach kernel code for the core OS and using other nifty tools like the webkit code from the KDE project. At the same time, the user is completely locked by the propreitory layer of UI and graphics libraries. It is difficult to imagine that the worlds most profit making company is making profits by leveraging community code and returning near to nothing to the source.

So, how do we "Free" this awesome hardware from the clutches of propreitory software?

Run windows on it, ha? Installing windows on a macbook air is a breeze. The drivers are available from apple. Install the OS and install all the drivers. Thats it. Windows runs beautifuly on this device. Hey, wait, now we have locked both the windows and dooors. The ultimate lockin.

No, we are not even considering it. What are the options we are left with? GNU/Linux, GNU/BSD, GNU/MINIX, ANDROID..... I chose GNU/Linux for the obvious.

1. It runs beautifully well on x86 hardware.
2. It is my favorite OS for the past 11 years.
3. I know my way around.
4. Awesome community.
5. Thriving developer base.
6. Strong Ethics
7. Ever increasing user base.

Now, GNU/Linux comes in many flavors. My favorite flavor has been Debian GNU/Linux, the universal operating system. In its goal of becoming a universal operating system Debian cannot cater in particular to a very small group of elite users having the capability of buying mac hardware(I do not mean that they wouldnt do it, But it would not be worth, taking the entire world into consideration). I tried the latest testing build and failed terribly. But, do not go by my experience. There are people who have succesfully installed Debian GNU/Linux on a macbook air. Just search them on the public network.

Come on, then, Let us "free" up this awesome piece of hardware...........................................