Categories
Linux

Do more with your old MacBook

Have you got an old MacBook that Apple doesn’t support any more? Can’t install the latest and greatest version of Mac OS X on it because the CPU is too old? You’re probably seeing a warning from Chrome that Google has discontinued support for Mac OS X 10.5.3 or whatever is on that ancient beast? It’s the same with Firefox.

Flash isn’t updated either and when you go to Youtube to watch a video Chrome shows you an ugly warning that it’s outdated. Frustrating isn’t it?

What’s more, you’re probably leaving yourself open to exploits by nasties on the Internet. Problems and bugs are found in Flash all the time. Browsers and operating systems are the same too but if that software isn’t actively updated then you’re out of luck. I discovered Opera browser is still built for these old machines and it’s fast but Flash was still a problem and I needed a better solution.

As unlikely as it may seem on an Apple computer, it’s Linux that came to the rescue!

I didn’t think I could put Linux on the MacBook as there was no Bootcamp to dual boot the machine. Thanks to I found the MacBook help pages for Ubuntu which pointed me towards rEFIt, a “boot menu and maintenance toolkit for EFI-based machines like the Intel Macs.” Even on an old MacBook 4,1 I could install Linux!

Installing rEFIt was simple enough, just run the package installer when I mounted the .dmg file. However the boot menu didn’t appear, even after several reboots until I pressed down ALT while rebooting.

Partitioning was a problem. I used the command line diskutil tool as suggested here but ran into problems because it couldn’t do a live resize. It would report that it ran out of space or there were too many deep links. Luckily the Ubuntu install CD comes with Gparted and after booting into the live CD I ran that and freed up 40GB of space for my new Linux install. A couple of reboots later to verify everything was working and then on to Linux!

Thankfully I didn’t run into the problems a recent Ars reviewer of Ubuntu Linux 12.10 came across. Linux installs are getting simpler and simpler. I told it to install alongside Mac OS X and let it set up partitions.

The WIFI adaptor in the Macbook requires a proprietary driver and after hooking the laptop up to an ethernet cable I started updating packages. While doing that I looked in the System settings and discovered that Ubuntu had installed the right driver without my prompting! I’m not sure when that happened but WIFI has been rock solid since.

Time to install Opera, the restricted packages (mp3 and dvd playback, etc), Java for Minecraft and finally Minecraft. Getting a Minecraft icon for Unity was a pain and I can’t find the script I used now but some quick Google-fu will find it.

Linux on the MacBook is nice and fast, even with Unity on there. I may replace that with a lighter window manager if it becomes a problem but it’s much improved on older releases. If you have an old MacBook and you don’t need some proprietary software that isn’t available for Linux then you should definitely put Linux on there. You’ll have the security of using updated software and a nice new desktop and apps to play around with!

Categories
Linux

Bash: compare two directories

In Unix based systems like Linux and Mac OS X there are a number of ways of comparing two directories. The simplest way is to use diff:

diff –brief -rb directory_1 directory_2

This command compares each file and reports if they differ. You can find the meanings of the options in man diff.

Diff is fine if you’re on a fast drive, if there aren’t many files or the files aren’t big. The command compares the contents of each file so it can take quite some time on a slow external drive.

If you just want to know which files are in one directory and not in the other directory it’s overkill. This little bit of Bash scripting does that however:

diff <(cd dir1 && find | sort) <(cd dir2 && find | sort)

It still uses diff, but compares the file listing of each directory instead of the files. It’s much faster and perfect for figuring out what files are out of place on my 2 relatively slow USB drives. (source)

Categories
Linux

Where does Nautilus store it’s folder share info?

Using a GUI is nice and all but sometimes I want to know where configuration data is stored.

The Gnome file manager, Nautilus, allows Linux users to share folders on a Windows network. Users of other operating systems will find this hard to believe but before this it was difficult to do as you needed to be an administrator and edit a configuration file called /etc/samba/smb.conf (Users of other desktop managers use similar tools).

This was convenient but I wanted to know where Nautilus puts this configuration data. I searched my home directory, I looked in /etc/samba/ (just in case) and eventually found this page:

I located the config files.

It appears as though /var/lib/samba/usershares holds a text file for each share that has been created.

The usershares directory is owned by root:sambashare and the files inside are owned by the user sharing the folder, so I guess it’s a compromise between a system process (Samba) and users wanting to configure it.

Editing those files is simple, and I guess I could use “net usershare” too. I had to restart Samba too which probably wouldn’t be needed if I had use the “net” command.

Categories
Linux

Mount box.net drives in Linux

I was one of the lucky few to receive a 50GB upgrade from box.net, (or box.com where they now live, marketing fail?) when I installed their Android app. I don’t have a use for that much storage on my phone but on my desktop machines? Oh yes!

This forum post describes in detail how to mount a Box drive on a Debian/Ubuntu machine although the instructions will mostly apply to other systems too as long as they have the davfs2 package.

There is a gotcha. Instead of using http://www.box.net/ you can use https://www.box.com/ which is a good gotcha. Also, I’m not the only person to notice that the mount point has a lot less storage than I thought it would have. It should be 50GB total but this is what I see from df -h:

https://www.box.com/dav 26G 13G 13G 50% /mnt/box.net

It’s enough for my needs. I’m going to copy snapshots of my local email there every night.

PS. Are you a Windows user? Sync any folder with Google Drive using the instructions here (but it uses “hardlinks” which have limitations, read the comments for more).
Actually, forget what it says in that post. Copy your files to your Google Drive and then place a symlink on your local drive to the copied files or folders using mklink. Make sure you run cmd.exe as an Administrator. I found this worked perfectly to sync the Pictures folder after I had copied it to my Google Drive:

cd c:\Users\USERNAME\
mklink /d Pictures “c:\Users\USERNAME\Google Drive\Pictures”

Any files copied into the Pictures folder are copied to the Google Drive now!

Categories
Android Linux

Install Ubuntu on your Android Phone

With this app you can install Ubuntu on your Android phone. It has to be rooted obviously and it’s definitely not this.

It looks like this installs Ubuntu in the same way as in the video above. It’s an app that runs in the background and you use a VNC client to connect to it. You could of course use VNC on a local desktop machine to connect to it too making it more useful but I think this is more a curiosity for those who like to tinker with their phones …

Pity he couldn’t get WordPress running on that Ubuntu install. That would have been fun to see!

Categories
Linux

Howto: Install XFCE in Ubuntu 11.10

You realise how spoiled you are by the ease at which software can be installed in Linux only when you’ve done the same in Mac OS X or Windows. apt-get or aptitude will install a wide variety of software and in the case of aptitude will remove the software and all it’s dependencies afterwards.

Yeah, I’m saying goodbye to Unity and embracing XFCE (for the moment at least. Choice is good!)

# aptitude install xfce4 xfce4-goodies
The following NEW packages will be installed:
desktop-base{a} exo-utils{a} gtk2-engines-xfce{a} hddtemp{a} libexo-1-0{a} libexo-common{a} libexo-helpers{a} libgarcon-1-0{a} libgarcon-common{a} libkeybinder0{a} libtagc0{a} libthunar-vfs-1-2{a}
libthunar-vfs-1-common{a} libthunarx-2-0{a} libtumbler-1-0{a} libxfce4ui-1-0{a} libxfce4util-bin{a} libxfce4util-common{a} libxfce4util4{a} libxfcegui4-4{a} libxfconf-0-2{a} lm-sensors{a} mousepad{a}
orage{a} ristretto{a} squeeze{a} tango-icon-theme{a} thunar{a} thunar-archive-plugin{a} thunar-data{a} thunar-media-tags-plugin{a} thunar-volman{a} tumbler{a} tumbler-common{a} xfburn{a}
xfce-keyboard-shortcuts{a} xfce4 xfce4-appfinder{a} xfce4-artwork{a} xfce4-battery-plugin{a} xfce4-clipman{a} xfce4-clipman-plugin{a} xfce4-cpufreq-plugin{a} xfce4-cpugraph-plugin{a}
xfce4-datetime-plugin{a} xfce4-dict{a} xfce4-diskperf-plugin{a} xfce4-fsguard-plugin{a} xfce4-genmon-plugin{a} xfce4-goodies xfce4-mailwatch-plugin{a} xfce4-mixer{a} xfce4-mount-plugin{a}
xfce4-netload-plugin{a} xfce4-notes{a} xfce4-notes-plugin{a} xfce4-panel{a} xfce4-places-plugin{a} xfce4-power-manager{a} xfce4-power-manager-data{a} xfce4-quicklauncher-plugin{a} xfce4-screenshooter{a}
xfce4-sensors-plugin{a} xfce4-session{a} xfce4-settings{a} xfce4-smartbookmark-plugin{a} xfce4-systemload-plugin{a} xfce4-taskmanager{a} xfce4-terminal{a} xfce4-timer-plugin{a} xfce4-utils{a}
xfce4-verve-plugin{a} xfce4-volumed{a} xfce4-wavelan-plugin{a} xfce4-weather-plugin{a} xfce4-xkb-plugin{a} xfconf{a} xfdesktop4{a} xfdesktop4-data{a} xfwm4{a} xfwm4-themes{a} xscreensaver{a}
0 packages upgraded, 82 newly installed, 0 to remove and 0 not upgraded.
Need to get 40.9 MB of archives. After unpacking 144 MB will be used.
Do you want to continue? [Y/n/?] y

Once installed, logout and select XFCE from the login menu.

XFCE has it’s own quirks and gotchas but it feels lighter and more responsive than Unity. The most difficult part was making the top menu bar autohide. I had to remove the “running programmes” list to get at the panel preferences. Only later did I notice the “Panel” item when you right click some of the menu widgets. The full screen mode in Gnome Terminal gets me back the extra 2-3 lines of terminal I missed. So winning all around as a certain actor once said …

Installing Gnome 3.2 is just as easy and looks gorgeous!

aptitude install gnome-shell

Categories
Linux

Open large files in Vim with care

If you want to load a large file in Vim you should disable the swap file to speed things up. It’s simple to do as well:

Vim -n file.txt

If a file is over 4096K or so and I have enough system RAM (not usually a problem) I’ll do it this way as it avoids Vim creating a potentially huge .swp file.

Categories
Linux

Ubuntu: ALT TAB between browser windows?

I’m still using Ubuntu’s Unity desktop, which is saying a lot as I switched back to Gnome within a week or so of the previous release of Ubuntu.

One of the remaining bugbears I had with Unity was the window or task switcher. It was impossible to switch between Chrome browser windows. I had to click on the Chrome icon in the Unity sidebar and select the window I wanted. It felt like Ubuntu had tried to emulate what Windows 7 did with their taskbar, but Windows did it better because the window previews are close to the taskbar.

I’m not the only one to have this problem. You can either change window switcher in CCSM (oh oh, watch out when using CCSM!) or use ALT-`. That character is the tick character which normally sits above the TAB key on UK/English/US keyboards but may be elsewhere on other locales. I now need to get used to it like I did with Mac OS X.

Categories
Linux

Ubuntu 11.10: Be wary of Compiz Config Settings Manager (ccsm)

Have you recently installed Ubunty 11.10 and are you marvelling at the Unity Desktop? Not many are. Marvelling at the desktop that is, but it’s growing on me. I said that last time too so we’ll see how it goes.

Anyway, the point of this little rant is to tell you to avoid or be very careful with CCSM, or “Compiz Config Settings Manager” as it’s known to it’s enemies. This little app allows you to edit practically everything related to Compiz settings. Literally everything!

Unfortunately it can also lead to a world of pain. After fiddling around with it I went into the preferences and clicked on the “Plugins” link at which time my desktop froze and I couldn’t even CTRL-ALT to a different session. Forced reboot was the other of the day.

When I finally got back in my external monitor wasn’t detected and I was left with a 1024×768 display. I spent a few hours trying to figure out what the hell had gone wrong. I deleted .config/monitors.xml and tried editing it but nothing worked. Eventually I rebooted a few times and suddenly my monitor was recognised again!

Then it was on to the workspace switcher. It didn’t work the way it used to. I hesitantly fired up ccsm and dug into the settings in Viewport switcher, then in Rotate Cube, then Desktop Wall. It was then I discovered I couldn’t deselect “Desktop Cube”. ccsm would segfault every time. Switching workspaces using the cube was painful as my hardware just isn’t up to the task. Open windows would flicker slightly after I rotated the workspace. Eventually I discovered that I could take drastic action to restore normality. First I had to login as a different user and then go into my home directory and then move some configuration directories out of the way.

mkdir bak
mv .gconf .gconfd .gnome .gnome2 bak/

After logging in again I fired up ccsm and Desktop Cube was disabled! I usually switch between workspaces using CTRL 1-4 and I was able to configure Viewport Switcher to do just that with a minimal sliding animation.

After looking in the bak directory it appears that Compiz stores it’s configuration data in various compiz directories in .gconf/apps/. I suspect it’s enough to remove them rather than all the Gnome configuration files.

I like Ubuntu 11.10 so far, I’m getting used to Unity but the top menu bar feels to me like it’s crowding out the screen. The lack of Unity themes included is troubling too as there are only 4 (2 of which are for visually impaired users by the looks of things). I’ll have to go look for some more.

Categories
Linux

How open is Android?

The Android Wikipedia page is quite a read. I’m particularly taken with the research into how “open” it is (not really, compared to other projects) as I’ve never seen a commit log or discussion of patches for it.

Moreover, our findings suggest that Android would be successful regardless of whether it is an open source project or not, to the extent that the vast majority of developers working on the project (the platform itself) are actually Google employees.

The section on Linux is intriguing too. Linus Torvalds says that Android and Linux would come back to a common kernel but that presumes Google will open it’s development and “innovate” in the open. I’ll just leave this here to check back on in 5 years time..

Meanwhile, there’s the Replicant project, an effort to make a completely Free Software version of Android. They want to remove proprietary device drivers and discourage the use of Google Market. Their list of supported phones is limited but I was surprised to see the iPhone listed there!

I did wonder what the difference was between Replicant and CyanogenMod. Various posts I’ve read on the XDA forums have stated over and over again that the project was more interested in open source solutions rather than using proprietary software but this thread on LWN shines some light on the issue.

Found the official line:
“CyanogenMod does still include various hardware-specific code, which is also slowly being open-sourced anyway.”

So, they’re being realistic about their efforts. They’ll use proprietary software when necessary but they’ll work towards replacing that software. At the rate that handset hardware changes I applaud them for taking this pragmatic route. The only phone the Replicant project fully supports is the relatively ancient HTC Dream. Yes, open source drivers should be released by manufacturers but that won’t happen.

Android isn’t really that open in terms that an Open Source advocate would understand. The traditional public CSV or SVN repository and a daily changelog is nowhere to be seen. It’s definitely developed in a cathedral rather than a bazaar. Does it matter to the vast majority of its users? Probably not, but I for one am happy it is Open Source and the code is out there. Without the (admittedly late) release of source code it would be much more difficult to use other after-market firmwares on Android phones.