/proc

In my research job I usually run one program with different input files. In many occasions the processes are started from different directories, within the same (multiprocessor) computer, and approximately at the same time.

Sometimes I want to kill one of these processes, but the ‘usual’ approaches may not work, since they don’t provide enough information to discern which of the currently running processes is the one I want to kill. (The ‘usual’ approaches are ps x, which may give a notion of the order in which they were started, and top, which provides information on the memory resources used by the processes, in addition to the CPU time spent by them).

In these cases, using the abovementioned commands, i get the PIDs (PID=ProcessID) of the problem processes, and I have a look at the /proc/${PID}/ folder for all of them. The /proc directory is quite unknown for many linux users, and that’s a pitty, since you may find very valuable information there: in particular, /proc/${PID}/cwd is a link to the current working directory of the process, and in /proc/${PID}/fd you will find links to all the files and devices the process is using. Using all the information available in /proc I am always able to know what PID to kill.

You may find more information on the /proc folder in many internet linux sites (see, e.g., this), or even in the Wikipedia.

GRUB2 for debianers

GNU GRUB2 setup and management seem to be more complex than those of the old (Legacy) GNU GRUB (GRand Unified Bootloader).

The GRUB Legacy to GRUB 2 transition is a part of the lenny (stable) to squeeze (testing) Debian release upgrade. The transition is not automatic, but it is quite easy to carry out: During the release upgrade (apt-get dist-upgrade) I was presented with the following menu


Configuring grub-pc

GRUB upgrade scripts have detected a GRUB Legacy setup in /boot/grub.

In order to replace the Legacy version of GRUB in your system, it is recommended that /boot/grub/menu.lst is adjusted to chainload GRUB 2 from your existing GRUB Legacy setup. This step may be automaticaly performed now.

It's recommended that you accept chainloading GRUB 2 from menu.lst, and verify that your new GRUB 2 setup is functional for you, before you install it directly to your MBR (Master Boot Record).

In either case, whenever you want GRUB 2 to be loaded directly from MBR, you can do so by issuing (as root) the following command:

upgrade-from-grub-legacy

Chainload from menu.lst? [YES/no]

Obviously I answered the default (yes, why not?), and I also answered yes to the other GRUB-related question that I was presented [just keep the Spanish keyboard and the video mode I like for the data terminals (tty)]:


Configuring grub-pc

The following Linux command line was extracted from /etc/default/grub or the `kopt' parameter in GRUB Legacy's menu.lst. Please verify that it is correct, and modify it if necessary.

Linux command line:

lang=es vga=792

[Ok]

Once the dist-upgrade finished, I rebooted the system and the chainload proved to work correctly, the new GRUB2 menu was completely operational. Then I ran the upgrade-from-grub-legacy command, and the difficult question showed up:


Configuring grub-pc

The grub-pc package is being upgraded. This menu allows you to select which devices you'd like grub-install to be automatically run for, if any.

It is recommended that you do this in most situations, to prevent the installed GRUB from getting out of sync with other components such as grub.cfg or with newer Linux images it will have to load.

If you're unsure which drive is designated as boot drive by your BIOS, it is often a good idea to install GRUB to all of them.

Note: It is possible to install GRUB to partition boot records as well, and some appropriate partitions are offered here. However this forces GRUB to use the blocklist mechanism, which makes it less reliable, and therefore is not recommended.

GRUB install devices:

[ ] /dev/sda (500107 MB, MAXTOR_STM3500320AS)
[ ] - /dev/sda1 (5000 MB, /)
[ ] /dev/sdb (1500301 MB, ST31500341AS)

[Ok]

Then it came to my mind that a computer-savvy colleague messed up his MBR’s a couple of months ago. Why the hell I didn’t think about that until then? What was wrong with GRUB Legacy at the moment (I mean, it is still `stable’!)? After those first seconds of panic, I calmed myself down: I knew the answer, in my computer there is a single MBR, and it is at the beginning of the first hard disk, so the right answer is to only select the first option. Ok, done. I reboot, there is no chainloader and everything goes ok, great.

Ok, now let’s do something with the new GRUB. The dist-upgrade installed a new kernel (2.6.32), it seems to be working flawlessly, and the oldest one is no longer compatible with the new nvidia module, so I can safely remove it. First I remove the packages (apt-get --purge remove linux-image-2.24-amd64 and some other related ones), and now I should update the GRUB menu. The old command for this was update-grub, the new one is… the same, great! The remaining kernels are correctly found, so I reboot the system and everything goes ok again. Great.[*]

Before I upgrade the system I usually increase the seconds that the computer stops at the GRUB menu before booting the default option. It takes a few seconds to change this setting, and when I have run into problems with the upgrade it has proven useful. In these situations you may try different kernels, or run in single-user (safety) mode, usually in console mode. You may spend quite a lot of time discovering new technicalities (aka wasting your time) and using different approaches to try to solve some problem. So when you reboot, you cannot type, and I have a tendency to stretch then my legs a little, stretch my arms, don’t look to the screen for some seconds… and oh damn, I forgot to run the non-default GRUB entry that I wanted to test, I’ll have to reboot again! Increasing the time that GRUB pauses in the menu makes it more probable that you notice that you must type something (or if not you’ll have to reboot again). Once I check that everything is ok with the new system, I reduce that time to a couple of seconds, so that the load is fast but I may still have enough time to choose a non-default option in case it is necessary.

In GRUB Legacy this timeout change was implemented by just editing one of the lines of the /boot/grub/menu.lst file


## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 5

However, this file, which also contains all the GRUB menu entries and options, is invisible to the new GRUB 2, and has only been kept back for safety and as a backup of old settings. There’s a new file in the /boot/grub folder, grub.cfg, but its first lines are very clear:


# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub

The timeout option can be set in the /etc/default/grub file:


# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_TIMEOUT=2
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="lang=es vga=792"

The file is quite self-explanatory (although the non-technical user still won’t have a clue of what the GRUB_DEFAULT is), and, as it clearly states, now you have to run update-grub after you change any of its settings so that they have any effect in the booting.

This change is to some extent an improvement. The old menu.lst file was a little strange, since it had uncommented lines, commented lines (lines starting with a #) and doubly-commented lines (##). Some options like the timeout were set in an uncommented line, but some others (like the default kernel options kopt) were set in commented lines, and were applied to the menu entries by running update-grub. Other commented lines were just comments, as were all doubly-commented lines (pseudo-titles of file sub-sections as well as explanations and examples of settings to be defined in commented lines).

However, with the new GRUB version you have to run the update-grub command after you change anything. This makes the process longer, and you may forget to run the update, but at least you know that you must always run the update, not only sometimes.

This particular detail is just showing what reportedly is a global change in GRUB (from Legacy to 2): the new system is truly better structured, but it is also much more complex (some may even say cumbersome) than the old one.

[*] You may update-grub before the upgrade-from-grub-legacy, but then you will only be updating the chainloaded GRUB (2) menu, not the chainloader GRUB (Legacy) entries.

debian-multimedia

It only has taken me 190 days to notice that Christian Marillat created a non-free section in his debian-multimedia repository.

After adding it to my sources.list, apt-get update; apt-get upgrade has updated all my acroread-related packages. This seems to have finally solved my acroread-iceweasel problems (frequent crashes) in the amd64 arch.

OMG…

Yahoo! cerrará Geocities

Yahoo anunció ayer que cerrará Geocities durante este año.

geocities-will-close

Miles de bloggers explican estos días cómo hace más de una década Geocities ya permitía construir páginas web personales de forma gratuita, así como agruparlas en comunidades con nombres de ciudades. Unas primitivas redes sociales, en html, sin 2.0, sin AJAX, sin apenas Flash (por suerte), y con muchos menos usuarios (un par o tres de órdenes de magnitud). Con 2MB de espacio para la web personal, y una cuenta de correo de la época

  • Mail left on the server over 7 days will be deleted. Please configure your Netscape browser to remove mail from server.
  • All accounts are limited to 500kB of mailbox space at one time. This should be plenty for everyone, as long as mail is downloaded and removed from the server on a regular basis.

Netscape browser… Aún pienso en él (en sus versiones muy posteriores) cuando abro el Iceape…

Un par de capturas rescatadas del Internet Archive (sigo después):

geocities-1996what-is-geocities-1996

Webs optimizadas para pantallas CRT de 640×480 (VGA), porque aún eran pocos los elegidos con SVGA’s (800×600).

Qué tiempos aquellos…

Yahoo! compró Geocities en enero de 1999 por 3600 millones de dólares, antes de que estallara la burbuja de las dot-com. El resto de la historia os la podéis imaginar, y si no, leedla en la Wikipedia.

We’re Linux

And the winners are…

What Does It Mean to be Free?

What does it mean to be free?

The Origin

The origin

Linux Pub (with subtitles)

Linux Pub

/.

You know you are a nerd when…

  • You read a news post about a Vim version that you know that was released half a year ago, just to enjoy the umpteenth battle of the editor war. Then you remember old times, when people from the Church worked harder. You think their arguments against Vim, although completely false, used to seem better than now. Then you go back to edit your code, and press i.

  • You read that Scientists Harvest Nano-Power From Hamsters, and you think that posting about it in your blog is the best way to remember to tell it to your nanoscience colleagues tomorrow morning.

  • You read that False Fact in Wikipedia Proves Itself, and you are not surprised at all. You expected it. Since causality concerns information, there’s no problem with Wikipedia not being causal. Although you hate it being like this, because you enjoy reading and editing it. But there are too many editors that don’t really understand what primary sources (like you) are.

  • You read that Intel Moves Up 32nm Production, Cuts 45nm, you know what this means and the benefits of the change without reading anything but the title, hope Intel’s bet is successful, and enjoy reading comments like Do you know how much CPU it took to fucking land someone on the moon? Why does it take 200 times that just to browse the web? or —Why would even watching a video on youtube need a 16-core processor?—You clearly underestimate how much Flash sucks. And you think you should not begin criticising Flash now if you want to sleep before tomorrow morning.

  • You read that Microsoft is being accused of squandering billions on R&D (and follow a couple of links), you learn how the R&D investments of Microsoft + Big Blue compare to the (already known) totals of your (supposed-to-be-developed) country, and ask yourself why things cannot change at home, at once.

Slashdot. News for nerds. Stuff that matters.

Server names

Some days ago I read an article on personalities and the names of servers.

If you can’t remember the IPs of your computers, what kind of root you are?

Querer no siempre es poder

Llueve. Voy a trabajar un rato.

$ ping ns.ecm.ub.es
PING ns.ecm.ub.es (161.116.81.151) 56(84) bytes of data.

‑‑‑ ns.ecm.ub.es ping statistics ‑‑‑
6 packets transmitted, 0 received, 100% packet loss, time 4999ms

Esto, en Harvard, me parece que no pasa.

Hello world!

Welcome to WordPress.com. This is your first a post. Edit or delete it and start blogging!

Amazon order

Today I didn’t go to class. I’ve been having a sore throat for some days, and today it was specially painful when I woke up, so I stayed in bed for all the morning.

In the afternoon I felt some kind of guilty, since during the last two weeks I couldn’t go to even half of the classes I should. I hope this gets balanced somehow by spending some time ordering the books for the semester from Amazon. Here goes the list:

Yes, they are a lot of books, and some of them are quite expensive… So I must show my deepest gratitude to my parents, who made this possible!

I spent the rest of the day relaxing and playing the piano.

P.S.: Today I somehow faced the two main cons of stopping relying on my parents next year: the money for the things I enjoy and my piano.

Seguir

Get every new post delivered to your Inbox.