Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

2013-04-02

Failed escape

I've been using Ubuntu since the spring of 2005, that is for over 8 years. I appreciate the Debian underpinnings, predictable releases, general fit and finish. However, now I'm using Gnome Shell instead of Unity and I feel that there's not much value provided to me in over plain Debian Testing. Moreover, I'm unconvinced in the general direction of Ubuntu is taking for the past couple of years, the "Not Invented Here" mentality of developing competitors to other Open Source projects (Unity, indicatorors, Mir). So I decided to switch.

I downloaded a Debian Testing (wheezy) netboot 23 MB mini.iso image, set it up to boot with GRUB from a USB flash drive, made a copy of my system partition, and rebooted. Long story short, the installer failed on the base system install stage, something about unable to authenticate the busybox package. I've spent a couple of hours fumbling around trying to get past the error, downloaded a different version of the wheezy netboot image, to no avail. I also tried the 200 MB mini-CD image, but that failed with "Could not mount the CD-ROM" being booted off a flash drive.

After a while I just restored the backup, updated the new root FS UUID in /etc/fstab and /boot/grub/grub.cfg and went on with life. On Ubuntu. I'm still on Precise, probably worth trying an upgrade to Raring. I'll keep the backup of the Precise system partition, though.

2011-11-09

Ubuntu Oneiric FTW :(

I was used to having uptimes in the order of weeks on the laptop. A couple of suspends, resumes every day, hooking up and disconnecting from the external monitor. Everything worked without a hitch on Ubuntu during the last couple of years. I was being conservative and used Gnome 2 without compositing most of that time. But Ubuntu 11.10 Oneiric is different. Gnome 3 used to crash 5 times a day, Unity has a ~50% chance of surviving a day or two. Most often things seem to crash after the screensaver has kicked in. Yay Ubuntu. Might be time to look elsewhere. Linux Mint or good ole Debian.

2011-10-15

Make use of the Caps Lock key

So, there is this Caps Lock key on all keyboards, sitting untouched in polite society. Why not put it to good use? Here are the commands that map the Find symbol to the Caps key on Linux. Stick them somewhere in the X session startup:

xmodmap -e 'remove Lock = Caps_Lock'
xmodmap -e 'keycode 0x42 = Find'

Then I map the key to the keyword completion command in Emacs like this. The second command is needed for Emacs in a terminal window:

(global-set-key [find] 'dabbrev-expand)
(global-set-key "\M-[1~" 'dabbrev-expand)

2011-09-19

Updating Samsung Galaxy S SCL GT-I9003 to Gingerbread in Ubuntu


So, I came across the news on the net that Android Gingerbread 2.3.4 update has been made available by Samsung to GT-I9003 phones. Apparently, it was being rolled out on a country or region basis via Samsung's Kies application. First I tried updating the phone with Kies in Virtualbox, but that didn't quite work, I could not get Kies to connect to the device. (Might be the reason was that the phone was not in Kies USB mode). Then I tried booting the OEM Windows Vista on the laptop. Vista had worked after I copied the partition from another hard drive, but now it refused to boot. Apparently, system could come up from hibernation, but depended on the hard drive unique ID in order to boot. Some web browsing, several reboots and trials later, I repaired the Vista boot configuration with the help of a warez Vista DVD. The laptop's recovery partition is useless -- basically it offers restoring from an external backup made earlier or a "factory reset". No Windows recovery, no command prompt.

So, turns out Samsung Kies sucks on real Windows as much as it does on Virtualbox. Granted, it did connect to my phone, but I could get more out of it than a backup of the 7 contacts in my phone's memory (the rest are synch'ed with Google). But backing up the 300 photos I have made Kies show a progress bar for 15 mins and then choke. And worst of all, there was no update of any kind offered! I wasted about 10 minutes staring at progress bars waiting for it to install, and then some 30 more minutes staring at progress bars waiting for the backups to fail.

So then I looked again at flashing the phone myself. I got the firmware from samfirmware.com, found the instructions for flashing with the leaked proprietary Samsung Windows flasher called Odin, got the Open Source flasher Heimdall (Debian packages worked fine), found an encouraging blog post on how to use it.

The firmware from Samfirmware is a RAR archive (password: samfirmware.com) containing a tar:

-rwxrwx--- 1 alga alga 191658005 2011-09-19 01:23 I9003XXKPH_I9003XXKPH_I9003SERKPH.rar
-rw-rw-r-- 1 alga alga 353699840 2011-08-10 09:53 I9003XXKPH_I9003XXKPH_I9003SERKPH_HOME.tar

Inside the tar, there are the firmware images:

$ tar xvvf I9003XXKPH_I9003XXKPH_I9003SERKPH_HOME.tar
-rwxr--r-- jonghoon/na-cdma-sw 262144 2011-08-09 15:19 boot.bin
-rwxr--r-- jonghoon/na-cdma-sw 1310720 2011-08-09 15:19 Sbl.bin
-rwxr--r-- jonghoon/na-cdma-sw 618496 2011-08-09 15:19 param.lfs
-rwxr--r-- jonghoon/na-cdma-sw 5787648 2011-08-09 15:19 normalboot.img
-rwxr--r-- jonghoon/na-cdma-sw 324751360 2011-08-09 15:19 system.rfs
-rwxr--r-- jonghoon/na-cdma-sw 12582912 2011-08-08 06:23 modem.bin
-rwxr--r-- jonghoon/na-cdma-sw 8378368 2011-08-09 15:20 cache.rfs

Apart from these, you need a partition table image (*.pit, latona_20110114.pit in my case), that can be downloaded from the Samfirmware site, too.

The phone needs to be placed in download mode. Everyone on the internet says this can be done by holding down Volume Down, Home, and Power buttons at the same time, but this did not work for me. An alternative is to use adb:

$ adb reset download

Then the flash command is as follows:

$ heimdall detect
Device detected
$ heimdall flash --pit latona_20110114.pit --primary-boot boot.bin --secondary-boot Sbl.bin --normal-boot normalboot.img --cache cache.rfs --modem modem.bin --param param.lfs --system system.rfs

About 2 tense minutes of progress counters uploading these files, a long reboot, and presto! The phone boots up into Android 2.3.4 Gingerbread!

The heimdall flash command can be run with the --repartition flag or without it. Repartitioning is needed if the partition layout is different, or, as one forum post suggests, a filesystem type changed. However, it seems that the partition layout is the same for all GT-I9003 versions (Samfirmware suggests the same pit file), so just flashing the partition images is OK.

Looking at other firmware archives, it looks like the number of images and their names vary. You just need to match up the files you have with the heimdall option flags (in other words, partition names of your phone). The heimdall print-pit can be useful here, it prints out the actual partition layout of the device.

The nice thing about flashing Android updates is that none of the user data was overwritten -- the system lives on separate partitions from installed programs and their data. Although, of course, there is a risk that something goes wrong, so it's wise to back up data before flashing.

Now, speaking of Gingerbread, it seems that most of the goodies added in it Samsung had already forward-ported in their Froyo firmware. I hope that they fixed the stability issues. My phone used to crash often with a black screen on Froyo when sitting idle.

2010-10-11

Freeing up some space on Ubuntu

I tried upgrading to Ubuntu Maverick Meerkat, but, as it often happens, the upgrade manager brushed me off saying I need to clear up about 970 MB of disk space on the root filesystem.
Time to buy a new hard drive, but in the meantime I still want to upgrade with what I have.

apt-get autoremove freed up some space, but more than an order of magnitude less than the gig I needed to find.

deborphan has always been a great tool to seek out the unneeded packages that use up disk space. If you run it without any arguments, it reports the libraries that are not required by any application. So you can safely remove every package deborphan reports unless you know you need it (for your own development, proprietary software you installed manually, etc.). When deborphan reports nothing, it's time to lax up the requirements:

deborphan -anz | sort -n

This lists all packages that are not required by other packages, even if they aren't libraries, and sorts them in a descending order by size. Old kernel images show up in this list near the bottom. There's usually more low-hanging fruit at the end of the list that can help you free up several hundred megs of space. Here you need to be careful not to delete something that you need from the system, as with these flags deborphan lists even packages that are apps rather than libraries, and even includes those that are suggested or recommended by other packages.

We're still several hundred megs short, but there are no obvious large packages to remove. The space is taken up by hundreds of relatively small ones. An effective technique I have found for this situation is start up Synaptic, order packages by origin, then go through restricted, multiverse and universe, sort packages by install status and size, and remove all the small packages you know nothing about, and various utilities you installed and used once. Sometimes it will threaten to remove a program that you need, then you need to back out. After you apply the changes, it's a good idea to close Synaptic and let apt-get autoremove and deborphan have a go again. If you're still not there, start up Synaptic again and prune Universe some more.

Presto! I got my gig (and more!) of free space by removing old kernels (480 MB), sacrificing Flightgear, QCad parts library, and lots of small utilities from Universe (900 MB).

2009-10-12

The Future

Nokia N900

I've touched it. Nokia N900 is awsome. The shape and size is that of a large phone, like the early Symbian smartphones. But it is very slick and is packed with features. It has a slide-out keyboard, a camera with a sliding cover, a leg to stand on the table, a Micro USB connector for power and data, a hardware key lock, several hardware buttons, etc.

The software side, Maemo 5, is also awesome. Looks very slick, feels responsive and ergonomic. And polished. But it's an open platform, based on Linux, X11, QT, GTK+, D-Bus. It looks like head-on competition to iPhone. Reminds me that companies the size of Nokia have the resources pull off almost anything. But it's really great that Nokia is doing it right -- in a way that is Open Source, community based, and iterative.

2008-06-22

The joys of Linksys WRT 54GL

On Friday there was a thunderstorm. Usually during the storms the surge protection in my radio link antenna's power-over-ethernet power supply trips up and needs to be reset by disconnecting the PSU from the mains for around 10 minutes. This time the usual measure didn't suffice. The lights on the adapter came up, but still there was no connectivity. I reported the problem to the ISP's tech support. The next day the engineer rang up and said that he can connect to the dish at my side.

I connected a laptop directly to the uplink cable, configured the static IP address. Lo and behold, the pings go through. Apparently the uplink Ethernet port on my OpenWRT router got fried.
Luckily, this router does not just have an uplink port and four lan ports, it has a programmable switch and an open firmware (OpenWRT 7.09 "Kamikaze") lets me tap into it.

I looked at /etc/config/network, and found the following lines at the top:

#### VLAN configuration
config switch eth0
option vlan0 "0 1 2 3 5*"
option vlan1 "4 5"


vlan0 is the internal lan, 0-3 are the external lan ports, and 5 is the host port. vlan1 connects the uplink port (4) to the router (5). The asterisk probably means packet tagging. As the router internally has just one physical ethernet port, the internal and external interfaces are virtuals employing the same physical interface. Their packets are distinguished by tags.

So, I changed the config thus:


#### VLAN configuration
config switch eth0
option vlan0 "0 1 2 5*"
option vlan1 "3 4 5"


I rebooted the router and plugged the blue uplink cable into the first LAN port (the numbering of the holes on the router is backwards). Tada! Here's my Internet connection again!

2008-06-19

Huawei E220 USB HSDPA modem on Linux

Tested on Ubuntu Hardy. When you plug the modem in, things happen:


[ 1872.829603] usb 5-2: new full speed USB device using uhci_hcd and address 11
[ 1872.988741] usb 5-2: configuration #1 chosen from 1 choice
[ 1872.998189] usb-storage: probe of 5-2:1.0 failed with error -5
[ 1872.998226] airprime 5-2:1.0: GSM modem (1-port) converter detected
[ 1872.998441] usb 5-2: GSM modem (1-port) converter now attached to ttyUSB0
[ 1873.006403] usb-storage: probe of 5-2:1.1 failed with error -5
[ 1873.006437] airprime 5-2:1.1: GSM modem (1-port) converter detected
[ 1873.006615] usb 5-2: GSM modem (1-port) converter now attached to ttyUSB1
[ 1873.057365] scsi30 : SCSI emulation for USB Mass Storage devices
[ 1873.058803] usb-storage: device found at 11
[ 1873.058810] usb-storage: waiting for device to settle before scanning
[ 1876.078727] usb-storage: device scan complete
[ 1876.082294] scsi 30:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
[ 1876.117573] sr0: scsi-1 drive
[ 1876.117674] sr 30:0:0:0: Attached scsi CD-ROM sr0
[ 1876.117754] sr 30:0:0:0: Attached scsi generic sg1 type 5


As you can see, we get two serial ports and a CD-ROM drive. The second serial port and the CD-ROM drive can be ignored. PPP works straight away with the following config:


noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/e220"
debug
/dev/ttyUSB0
230400
crtscts
defaultroute
noipdefault
user ignored
remotename whatever
ipparam whatever
usepeerdns


Here's the e220 chatscript (put in into /etc/chatscripts, replace the "****" with your pin code, replace "omnitel" with your provider's APN):


# Chat file for Huawei E220 HSDPA USB modem
ABORT BUSY ABORT 'NO CARRIER' ABORT 'NO ANSWER' ABORT DELAYED
'' AT
OK AT+CPIN="****"
OK ATX3
OK 'AT+CGDCONT=1,"IP","omnitel"'
OK ATDT*99***1#
CONNECT ""

2008-04-30

Seasonal headache: ABBYY eFormFiller 2.5 on Linux

The beginning of May (May 6 this year) is the deadline for income tax declarations in Lithuania. Our tax inspection accepts paper forms, has a lame web interface, and offers a Windows program that looks nice, calculates all the derived values for you, and has validation. There are some problems with running it on Wine. Last year I tried getting it to run for a couple of hours, then gave up and booted Windows on one of the laptops.

This year around, I made an effort and finally got it to run. Here are the commands that made the cut for me (Ubuntu Hardy, Wine 0.9.59):


mkdir /tmp/formfiller
cd /tmp/formfiller
wget -nv http://deklaravimas1.vmi.lt/eFormFiller25v6_2008_03_06.zip
unzip eFormFiller25v6_2008_03_06.zip
wget -nv http://kegel.com/wine/winetricks

export WINEPREFIX=~/.wine-eFF/
wineprefixcreate

sh winetricks dcom98
sh winetricks win98
sh winetricks riched20
sh winetricks vcrun6
sh winetricks wsh56

wine setup.exe /q

wine $WINEPREFIX/drive_c/Program\ Files/ABBYY\ eFormFiller\ 2.5/FormFillerLight.exe


I hope it will be useful to somebody.

Update: naaaah, it works with the last year's income tax form, but doesn't with this year's. Time to boot Windows again :(