Cleaning yaourt old files


I have a habit to backup the files. As a result, using the yaourt (Arch Linux pacman helper), I have saved a lot of files in a directory. From time to time I need to clean up the directory manually by deleting old files, because the size is increasing gradually.

So, I finally wrote a script to clean the old files in the directory.

It is available here.

Advertisements

Arch Linux upgrade, downgrade, and rollback


One of the reasons, I recently consider to switch from Arch Linux to Debian which is famous in stability. However, I am very reluctant to do so, because of the greatness of simplicity in package management of Arch Linux, especially creating packages in AUR. Debian, though famous, there is much manual work in packaging such as preparing the “control” file (may be there are some other tools I not yet explored, because I used Ubuntu and Linux Mint before for only a short period). Besides that, Debian does not have the repository like AUR. Installing the packages such as TrueCrypt and XnViewMP in Debian is not as easy as Arch Linux. That is why I am hesitated to migrate.

Today, upgrading Arch Linux causes me fail to run Java applications, such as Eclipse. This is possibly caused by upgrading the dependent libraries, which results the runtime library cannot load the functions properly. This is troublesome, because I need to use the application in urgent, I cannot wait for the next update of the related packages which will solve the library dependencies problem.

Normally, whenever there is such problem, I will solve it with a tool, “downgrade“. If “downgrade” cannot solve, and if the application is not that important, I may wait until the application next update. Since this is emergency, I can only do a manual downgrade. The problem of the tool “downgrade” is that it cannot solve the dependency properly. Such as to downgrade “gcc”, “gcc-lib” cannot be resolved; but to downgrade “gcc-lib”, it is required by “gcc”. As a result, I found a manual solution. That is to solve it by “pacman -U” manually. If the older files not exist, “downgrade” can help to download the packages from the server. Using pacman to install older packages can solve the dependency problem.

If there is a built-in rollback system in Arch Linux and also other distribution, this will be great.

Arch Linux manual recovery


Though SystemRescueCD is powerful, if it is system specific, then it cannot work. With the recent changes of the Arch Linux filesystem, I made a mistake that I cannot start Arch Linux after a careless reboot.

The instruction from the official site mentions,

1) Fix any non-official packages with files in /bin, /sbin or /usr/sbin to put those files in /usr/bin.

The term “fix” does not give me too much solution about the packages. These packages mostly come from AUR. What can I do to “fix” them? There is no much hint for me. Thus, I ignore this part, though I can list those packages.

So, I followed the instructions until the step “pacman -S filesystem”. This shows the conflict because of the /usr/sbin. Therefore, I assumed that reboot may “solve” the problem. But this is the cause of the problem.

As a result, I cannot boot into the system anymore. And I know that, this is the package installation error. Even if I use SystemRescueCD, it cannot help for package installation, because it does not have pacman. Luckily, I have a bootable pendrive with Arch Linux installation image. So, I can only recover with this pendrive.

Fortunately, Arch Linux now has wifi-menu (from netctl package), which is so useful that I can access WiFi with text-based interface. WiFi connection by commands is exhaustive. After connection, then I use the elinks to browse the related pages. I am so happy that the pages like Wiki is working gracefully with the text-based web browser.

I tried chroot, but it does not work. Finally, I mount the partitions, move the /usr/sbin to another location, then use the pacstrap as in the Wiki to install the base packages. Now, reboot, everything work fine. Then I moved the sbin just now to the /usr/sbin again.

So, if you don’t have desktop environment, don’t worry. Firstly, we need to know how to switch the TTY with Alt+F1 (or F2, F3, F4, …). This is helpful just like we switch the windows with Alt+Tab. By using this, we can have a screen to read the webpages with elinks, a screen with manpage of a command, and a screen with the commands that we are going to perform.

Secondly, we need to know how to access internet from command-line, especially the WiFi. The wifi-menu from Arch Linux simplifies a lot of work. Else we need to know the commands like “ip”, “iw”, “dhcpcd”, and so on.

Thirdly, we need to know how to use some text-based applications, especially “elinks” or “links” as web browser. The text editor such as “vim” or “nano” is useful. To view the file, “cat” with “less” is useful. Furthermore, “man” or “info” is helpful to understand how to use certain commands.

With these knowledge, then system recovery should have no much problem.

Change a computer but preserve the OS (Arch Linux) and data


This is interesting. Previously, if I want to change a computer, I will (re-)install the OS and other software on the target computer. Then only move the data.

Since Arch Linux is a minimalistic distro, and installation only available with network connection. This will be exhaustive to install the OS on the target computer. Not only wasting time downloading, but also setup the configurations, such as web server, FTP server, hibernation, power save, etc. User’s configurations are easier, because I can just copy all the files in /home/$USER directory to the target computer. The only problem may be the differences of the owner ID and group ID. But that is not really a big deal. So, the main problem is the root (/).

Cloning the partition is not a good solution. Firstly, the target computer is different, I wish to preserve the original OS. If cloning the partition, the target computer needs to have extra space for the cloned partition. Secondly, configuration such as GRUB, fstab, and other partition related configuration will not work. To fix them, I need to find all these configurations, but how do I get them?

Luckily, Arch Linux is a minimalist distro, which has its great advantage. So, this is what I did.

Firstly, I get the latest installation ISO. Then, partition the target computer with SystemRescueCD. (I tried with LVM, but at the end failed, because the first partition is started at sector 63. Installing GRUB where the /boot is in the LVM requires larger partition space.)

Then, boot into the Arch Linux live media, and follow all the installation steps as in the official installation guide. As expected, the installation of the “base” requires network connection. It is around 100+ MB. (I really hope that, if it is possible, Arch Linux official installation ISO will contain at least “base” group, so that it is possible to install a minimal OS without network connection.)

After installing everything, I made sure that the original OS and Arch Linux are bootable through GRUB.

Then the essential part is transferring the whole data from old computer to new computer. Firstly, I need to transfer the data from old to an external harddisk. Thus, I used the following command in old computer (based on this page),

tar -czpvf backup.tar.gz --one-file-system --exclude=/backup.tar.gz \
--exclude=/dev --exclude=/tmp --exclude=/sys --exclude=/proc \
--exclude=/mnt --exclude=/media --exclude=/boot \
--exclude=/etc/{hostname,fstab,localtime,locale.conf,vconsole.conf} /
#exclude any folder that we don't want

Tar is the best solution (for me) to preserve all the file permission and ownership. Besides that, tar also allows to compress the data (with gz). If the size doesn’t matter, we can omit the “-z” flag and the file can be named as “backup.tar” without “.gz” suffix. So, several directories (folders) are excluded, because these may be computer dependent. The /boot must be excluded, because the partitions of the computers are different. And finally some files in /etc needs to be excluded. These files are actually the files which we need to edit during the installation of the Arch Linux, especially fstab. (That is why I said luckily Arch Linux is minimalistic.) Then, use the same method to backup the /home and any other data.

Next, to extract the data from the tar, I didn’t use the Arch Linux in the new computer itself. This is because I afraid that overwriting some of the files (especially the running process) are not allowed or causing damage of the system. Thus, I use SystemRescueCD and mount the root partition of Arch Linux, Then,

tar -xzpvf backup.tar.gz -C /mnt/arch --numeric-owner

Then, I also use the same way to extract other data.

Finally, restart. Everything work fine. The only thing I need to reconfigure is the /etc/suspend.conf from uswsusp-git because of the partition differences. Besides that, I also reset the pacman-key as mentioned here.

Dream LiveUSB: ArchPup


Recently, I found that Puppy Linux has a higher (visits of page) ranking than KNOPPIX in DistroWatch. Furthermore, Puppy Linux is also well-known for its old computer support. This is interesting.

Previously, I tried KNOPPIX, which I liked most is that it is able to save the user session. That means, if you installed any package or save the files in $HOME, reboot the KNOPPIX in the USB, those settings are still preserved. This is a feature which I didn’t found in other Live Media. I tried KNOPPIX because it is a distro targets on Live Media.

Yet, there is something I don’t like. That is the Debian repository. That is why, KNOPPIX is using Iceweasel instead of Firefox. And some of the packages are not cutting edge.

So, I tried Puppy Linux. It has the exact feature like KNOPPIX, i.e. saves the session. The next thing I found about Puppy Linux something interesting is the term “Slackware-compatible” and “Ubuntu-compatible” from the community site. A Linux distro which has different built with different compatibility. As a result, I discovered ArchPup which is based on Arch Linux.

Previously, I tried to built my dream LiveCD or LiveUSB based on Arch Linux and ArchBang but failed. Several reasons. One of the reasons is the difficulty to load the packages I want.  Even I successfully built the LiveCD, the startup in the X Windows is not satisfying. Furthermore, difficult to test the LiveCD and waste a lot of time to build the LiveCD. The building script provided was not working well.

Now, this ArchPup, it is using pacman (package manager), which I am familiar with. After creating the archsave.4fs (save session), reboot it, then I can install any packages I like. However, the repository used is not the official Arch Linux repository. Thus, one may not get the latest package. Furthermore, Linux kernel and some libraries are ignored. As a result, there is no upgrade of these libraries. (I think the archsave.4fs is compatible with the newer version when it is released, thus I don’t mind there is no upgrade of the kernel.)

So, I installed all the important packages as much as possible, especially utilities for rescuing, such as ddrescue, gparted, chntpw, etc.

Now, the only problem I face is the size of the archsave.4fs. The size can be changed by replacing it with another file. I did it manually using some commands.

ArchPup (Puppy Linux) is really awesome.

(Skip the following for those who are not interested.)

Technical part

I was very interested on how the save session works on Puppy Linux. I knew the SquashFS. It is read-only. And I know that is is possible to save the files in $HOME. This can be done by mounting a file or partition on /home with read-write. That is why archsave.*fs can be ext2, ext3, or ext4. But when I use the pacman to install the packages, the packages are not saved in /home but in root and other directories.

After some studies, then I only know that, there is something called union mount, which can be done by unionfs or aufs. This is the component that used by both Puppy Linux and KNOPPIX.

By doing this, both the ext2/3/4 and squashfs can be mounted in union. As a result, whatever changes to the “/” (root), this will affect the read-write mount. And this effect is happened directly to the archsave.*fs. So, we need not to do some thing like “save on exit”.

Resize save session manually

Actually it is not resizing. The following is what I did. Firstly, create a filesystem using “dd”,

dd if=/dev/zero of=archsave.4fs bs=1024 count=1M
#1 mega of for block size 1024 will produce 1 gigabyte file
#1000 x 1024 

Then, format the file.

mkfs.ext4 archsave.4fs

Now, mount the archsave.4fs in a directory, eg, ~/new/. And we also need to mount the current archsave in the USB in another directory, eg, ~/old/.

Then, we copy from old to new,

cp -a ~/old/* ~/new/

Replace the file in pendrive. Boot and you will get extra space.

Arch Linux and Canon PIXMA iP1600


I tried to escape from the Windows dependency problem. Wishing that all my devices can work without problem with Linux. But one of the greatest problems is that Canon PIXMA iP1600 does not have driver for Linux, except using iP2200 which is compatible.

Previously, I solved this problem with the virtualisation. This work perfectly to do my printing. However, it is still depending on Windows. Without Windows, the virtualisation is almost useless.

Looking for several internet solutions, I found that iP2200 driver is mentioned to be compatible with iP1600. I tried it before, but it didn’t work in Arch Linux. Furthermore, the Linux driver for iP2200 is in the RPM (Red Hat Package Manager) format. As a result, I decided to use virtualisation with Linux distro based on Red Hat and installing iP2200 driver, hoping that the driver will work without error.

RPM based Linux distro

There are several RPM based Linux distros. Based on lifehacker.com, I chose OpenSUSE instead of Fedora, though Fedora is more popular than OpenSUSE. This is because Fedora is cutting edge distro, and support for free and open source software, thus no proprietary license is supported. Therefore, I chose OpenSUSE which I think it is more stable and general.

Booted into OpenSUSE through VirtualBox, then I downloaded the driver. When I wanted to install it, it showed some errors with missing package dependency, “libxml”. I tried to search “libxml” in the repository, it was not found in OpenSUSE. This made me feel a little disappointed to OpenSUSE.

Then I was looking for other repositories which may contain “libxml”. I expected there is something like Arch Linux AUR. Yet I found none, maybe I am too new to OpenSUSE, don’t know how to get the old library.

Back to Arch Linux

As a result, I tried to solve it again with Arch Linux. Based on some forums (such as this one), in order to install iP2200 driver, there are two packages needed: cnijfilter-common and cnijfilter-ip2200. cnijfilter-common can be found in AUR. But there is no cnijfilter-ip2200. So, I made one.

However, after the installation (not the current one in the AUR), I failed to print anything as usual. This is because I didn’t have libxml. Yet it can be found in AUR as well. After installing libxml, the printer still could not work. So, I think there might be some missing libraries like libxml. So, I used the following commands to find out what are those libraries.

for i in `pacman -Ql cnijfilter-ip2200|cut -d ' ' -f 2|grep bin` ; do ldd "$i" |grep 'not found' ; done

(This is why I like command-line.) This command lets me check what shared objects (shared libraries) which are not found. By this, I added all the packages that are missing into the PKGBUILD dependencies.

Re-installed the package, and tried to print again. Yeah! Now it can print.

Imperfect

Now, I can do the Canon iP1600 printing using Linux without any Windows. But it is not yet perfect. The Linux driver of iP2200 does not have grayscale printing. I failed to print the the light colour document. It is always black and white.

I tried adding the grayscale option based on other PPD files, yet it does not work also. Though I can get the option to choose grayscale printing after modifying PPD, the result is still the same.

May be I will try using printuiip2200 command next time. But I don’t think it will work well.

Reasons to install and not to install Arch Linux


Preface

I am Arch Linux fan. Recently, I discovered a distro, Fuduntu, which stated that it is optimised for laptop and netbook use. This increases my interest due to battery draining problem for my old netbook. Though my old netbook was installed with Arch Linux using LXDE, the battery can only last for only 1 hour. That is why, I think I am going to switch to Fuduntu. However, after installation of Fuduntu, then I found some problems like missing the packages FreeFileSync and VisualBoyAdvance, and also failed to install Wine because of dependencies error. This made me regret to uninstall Arch Linux from my netbook, because installing Arch Linux is really exhaustive.

When I wanted to re-install Arch Linux to my netbook, to made it easy, I tried to install ArchBang. However, at the unsquashfs stage, there was something like kernel panic. Finally, I give up ArchBang and install in the proper way with Arch Linux.

I found that Fuduntu contains a package Jupiter Applet. So, I tried to install it in my netbook hopefully make the battery last longer.

I always think which distro is better. Now, I have some conclusions why I am Arch Linux supporter. The following are the reasons to install and not to install Arch Linux.

Reasons not to install Arch Linux

  • Your computer does not work.
  • You don’t like command-line, or you don’t have good typing skill, or you hate typing.
  • You have the problem with network connection. You don’t have wired network connection, and the wireless device is incompatible to the Arch Linux installation LiveCD, make you impossible to install Arch Linux.
  • You don’t know any or only know little about commands such as: cd, mount, pwd, ls, less, cat, nano, vi, …
  • You don’t want to spend any time to customize your OS.
  • You don’t want to waste your time to install.
  • You don’t want to waste your time learn to install.
  • You only want GUI installation.
  • You want something pleasant to see after installation, such as beautiful wallpaper, cute icons, awesome cursors, interesting boot splash, user friendly themes, attractive animation effects, etc.

Reasons to install Arch Linux

  • You don’t have any problems with the reasons above.
  • You want to use the latest packages as soon as they are released.
  • You want to try out a lot of packages, such as Ubuntu One, FreeFileSync, XnViewMP, …
  • You want to try out different DE (desktop environment) or WM (windows manager) with only one OS: Xfce4, GNOME3, KDE, LXDE, OpenBox, and may be other experimental DEs.
  • *You want to create your own packages easily from any source.
  • You want your computer OS has a lot of possibilities to do anything.
  • You want to learn more about Linux or computer.

Yes, create own packages (refers to *). I tried to create debian packages before. Comparing to makepkg and PKGBUILD, it is too troublesome. The beauty of Arch Linux is simplifying a lot of works. Not in the way that simplifies the works for the end users by complicating the works of the developers. It makes the developers’ work much more easy, to deploy the packages, no need spending too much time on the GUI, because most of the things are bash scripts. For the end users, what they need is to read the documents and follow some commands. Yet the commands are also simplified just like installing the packages with makepkg, installing the OS with pacstrap.