MacBook Air again in 2021

Previously installed Arch Linux on my wife’s old MacBook Air. Then just recently, due to the need of using Zoom Meeting on a device, I tried to re-use this MacBook Air again.

Sadly, Mac OS X 10.6.8 is not supported anymore. I cannot install latest Google Chrome, latest Firefox, or Zoom. The only solution is running Linux on it.

First of all, I have to update Arch Linux. However, the last update was in November 2019. Due to WiFi driver issue (slow, damn slow!), I just remove all unnecessary packages, such as LibreOffice, Wine, SMPlayer, Audacious, etc, and do the upgrade according to this forum post.

There are two main problems in MacBook Air when running Arch Linux: (1) Wi-Fi and (2) graphic card.

For WiFi, at the end, I blacklist bcma. It is damn slow. For Internet connection, I just solve it by using Android phone USB tethering. That’s far more better than WiFi download speed, which is around 200 kilobytes per second.

The second problem is nvidia-380xx-dkms driver. Since it is old machine, I use linux-lts kernel, which can work smoothly with nvidia-380xx-dkms. However, I am not sure what’s the reason, if running glxgears, the OpenGL fails to work. OpenGL is required for Zoom to run. Luckily, I found that if I restart lightdm, then OpenGL will be able to work, so does Zoom.

Arch Linux update issue

Today, when I updated Arch Linux as usual, then suddenly it brought me to the TTY, which didn’t allow me to change to other TTY (due to NVIDIA graphic card issue which has been attached with my laptop for quite a long time.)

Because I could do nothing, and not sure whether the upgrade was completed, so I made a hard reset.

Then I boot with fallback initrmfs just in case has any error. Luckily, there was no problem to boot.

Then I did a quick check on the database. And found that it was locked. Meaning, I had restarted without finishing the update. This is serious if it happened when upgrading the kernel.

Reading the /var/log/pacman.log, I found that some packages were not updated. Then I just simply did a pacman command, and I got these message,

ldconfig: File /usr/lib/libqca.so is empty, not checked.
ldconfig: File /usr/lib/libQt5QuickTest.so is empty, not checked.
ldconfig: File /usr/lib/libQt5QuickParticles.so is empty, not checked.
...

Read the forum, the solution to re-install the packages that own these files. So I used pkgfile to search fo the owner of these files. Then, re-installed each packages found.

Then I just made sure all the packages were installed properly with

pacman -Dk #previously is testdb

Social media

Different social media usage:

Facebook – Family and friends status.

Google+ – Official tech news or blogs.

Twitter – Celebrities personal status.

Weibo – China celebrities personal status.

Instagram – Celebrities’ photos.

Reddit – Community and specific topic discussion.

WordPress – Nothing but blog posts.

Migrating Arch Linux from 32-bit to 64-bit

These days, I decided to migrate my Arch Linux from 32-bit to 64-bit. There are several reasons that make me to make such decision.

Firstly, in Arch Linux official site, there was an announcement that Arch Linux will drop 32-bit. And in the wiki page, it mentioned that Arch Linux user should use 64-bit if the processor supports.

Secondly, new distros such as KaOS and Evolve OS only support one architecture 64-bit. That means 32-bit is considered less targeted.

Thirdly, my favourite software FreeFileSync has only pre-built 64-bit binary package, though it can be built on 32-bit from source. Moreover, Opera on Linux only active on 64-bit. The current version is 27.0, yet 32-bit is still version 12.16. That means 32-bit OS users do not have the chance to use the latest Opera.

Next, Docker which is officially supported by Arch Linux, is 64-bit only. However, 32-bit can be installed through AUR. I tried Docker 32-bit and pull an Ubuntu image from Docker repository, at the end the image is 64-bit. As a result, the Ubuntu image does not work on my Docker container. And most of the official images on Docker repository are 64-bit, including Fedora. That is why when I was testing Docker on my 32-bit Linux, I had to use “debootstrap” to get the 32-bit Ubuntu then imported to Docker.

With these reasons and the trend, sooner or later, 32-bit software will less likely be supported. And migrating to 64-bit sooner or later must happen.

The way to 64-bit

Arch Linux wiki page offers some methods to do the migration between two architecture, 32-bit to 64-bit or vice versa. I did not use the methods as mentioned, due to the limitation of disk space in partitions. So, I have to use other method.

Since I have two laptops: personal and working. The working laptop is my primary laptop, which is always updated to the latest packages. On the other hand, the personal laptop is old but with good graphic card, Nvidia. In order to do migration, I tried to migrate the personal laptop first, to check whether my method works or not. So that when migrating the working laptop, everything should go smooth.

Firstly, I downloaded the latest Arch Linux installation live media, then created a 64-bit virtual machine using VirtualBox. Then installed Arch Linux 64-bit on the virtual machine. Besides that, I also installed all the packages which are explicitly installed on my working laptop.

Then the next thing I did was retrieving the /var, /opt, and /usr directories from the virtual machine. The reason was that these directories contain binary files to run the OS, and I wanted to preserve all the configuration in /etc, so that less configuration to do after installation. On the other hand, /bin, /lib, /lib64 are all symbolic links only. So, I ignore them, I can make the symbolic links myself.

Then, I used SystemRescueCD to delete all the files in /var, /opt, and /usr and replaced with the files retrieved from virtual machine. Then reboot using Arch Linux installation live media, mount the partition, arch-chroot, and mkinitcpio to generate the initramfs. Then reboot, but failed to load lxdm. After several tries, I concluded that my hypothesis failed. As a result, I decided to re-install everything, but backup /etc so that can refer it later.

Arch Linux is good, but there is a drawback, that is, installation requires Internet connection. Because to install, there is a script called “pacstrap” which will download the necessary packages and install to the partition. The “base” packages are around 150 MB. That means, if we have limited Internet quota, slow Internet, or no Internet, then there is a serious problem. So far, I have not look for any better solution for this.

However, all the other packages such as LibreOffice, Xfce, Firefox, and others, I had downloaded through VirtualBox. I just copied these cache to the /var directory, then installed the packages that I need. As they were cached, most of the packages needed not to be downloaded again. This reduces a lot of time and these packages can be used in the next OS installation.

Finally, /home directory preserved and it works fine. Just the /etc configuration has to be done manually, such as Apache and PHP configuration.

So, using the same method, I successfully installed Arch Linux 64-bit on my working laptop. Yet, there are some more configurations needed.

YouTube automatic captions to .srt subtitle format

If you know how to download the video from YouTube, then you may like to download the automatic captions (in English) as the subtitle. The automatic captions unlike the “closed captions”, “closed captions” can be downloaded using the userscript such as Download YouTube Captions. With the script, we can download the captions as the .srt subtitle format.

However, automatic captions is different. It is created by YouTube based on speech recognition, thus the captions are not very accurate. But I personally feel that it may be a little useful. Therefore, I have done some scripting to solve the problem semi-manually. Semi-manual is because the preparation of the subtitle have to do it manually. I do not spend time to write a userscript to solve it.

In order to convert the automatic captions into the .srt,

  1. Go to the YouTube page of our interested video.
  2. Click the “Transcript” icon which is besides “About”, “Share”, and “Add to”. This will show a frame of English (automatic captions). Now we are going to copy all the text in the frame.
  3. Using web browser’s Inspector by right-click. Then choose the parent HTML element of these captions, then right-click the element to “Copy Inner HTML” and save to a plain text file as HTML file format.
  4. Open the HTML file format with the web browser, this will show the time and subtitles for every two lines. Copy these text to another plain text file.
  5. Finally, use the Perl script below to convert the plain text file.
#!/usr/bin/perl
# Download the auto generated caption (English) from the internet, convert to the text.
# Then this script is to convert the text into the .srt format
use strict;
use warnings;
 
my $file = $ARGV[0];
 
my @time,my @subtitles;
 
open(FILE,$file);
while(<FILE>) {
    my $line = $_;
    $line =~ s/^\s+|\s+$//g;
    if($line =~ /^(\d+:\d+)/) { #Updated (thanks to Daniel)
        push @time,$1;
    }
    elsif($line =~ /(.+)/) {
        if(length($1)) {
            push @subtitles,$1;
        }
    }
}
close(FILE);
 
for(my $i=0;$i<@subtitles-1;$i++) {
    print "00:$time[$i],000 --> 00:$time[$i+1],000\n";
    print $subtitles[$i],"\n\n";
}
 
my $next = $time[@subtitles-1];
if($next =~ /((\d+):(\d+))/) {
    my $temp = $3+5;
    $next = "$2:$temp";
}
 
print "00:$time[@subtitles-1],000 --> 00:$next,000\n";
print $subtitles[@subtitles-1],"\n";

The steps 1-4 are done manually. It is possible to convert the above steps using JavaScript (userscript). But it is too time consuming for me.

2010 in review

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads This blog is on fire!.

Crunchy numbers

Featured image

A helper monkey made this abstract painting, inspired by your stats.

A Boeing 747-400 passenger jet can hold 416 passengers. This blog was viewed about 2,100 times in 2010. That’s about 5 full 747s.

 

In 2010, there were 55 new posts, growing the total archive of this blog to 216 posts. There were 10 pictures uploaded, taking up a total of 735kb. That’s about a picture per month.

The busiest day of the year was August 3rd with 41 views. The most popular post that day was Installing CVS on Ubuntu 10.04.

Where did they come from?

The top referring sites in 2010 were sourceforge.net, facebook.com, userscripts.org, sites.google.com, and twitter.com.

Some visitors came searching, mostly for ubuntu 10.04 cvs, cvs ubuntu 10.04, ubuntu 10.10 hp mini, install cvs ubuntu 10.04, and ubuntu 10.10 hp mini wireless.

Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

Installing CVS on Ubuntu 10.04 June 2010
1 comment

2

Upgrade to Ubuntu 10.10 on HP Mini October 2010

3

Huawei E1552 on Ubuntu August 2010
3 comments

4

Review of Wubi input method and Cangjie input method August 2010

5

Password Cipher July 2010
4 comments

Java version Prayer Clock

After a long time for studying Java, I finally successfully port the Prayer Clock to Java version. It is available in my Google Site. I not yet try the JPrayer Clock in Ubuntu or other OSes. But it works in Windows.

I am learning Java to build cross-platform applications in the future. Since I would like to develop application using Linux.

And I use the native system look and feel theme. Because I don’t like the Metal look.

Bookmark and Share

IRC helps a lot

We always search the information from Internet with the search engine. The search engine crawls from web to web through hyperlinks. Then the search engine will index the keywords of the websites. Then we search the information based on the keywords.

When we face some problems, and there is no website provides sufficient solution, then we can go to a forum and post our questions. Wait for several days, someone might respond to the questions. The forum is normally a website. Thus, when we search through the search engine, we will also get the results from the forum. Currently, there are services like Yahoo! Answer and WikiAnswers help a lot to solve our problem.

But there is another channel from Internet, that is IRC (Internet Relay Chat). It is not a website. So, we cannot search the information from the result of IRC. But this is a really good channel for us to get the instant solution. For example, when I was doing the GTK+, and have some difficulties about the usage of the library. Searching around from Internet did not get the answer. Then, search for the IRC channel of GNOME. Run an IRC client, connect to IRC server, join the channel, and ask the question. Finally, get the solution. Not only that, when I was trying on Ubuntu, I also asked the questions through IRC. Though I didn’t get the solution, but I got some good information about Ubuntu. Besides that, IRC also allows file sharing, I used to download files from IRC.

Bookmark and Share