Archive

Archive for September, 2010

Grub2 essentials

September 30, 2010 Leave a comment

A very nice documentation that contains everything you need to know about Grub2: https://help.ubuntu.com/community/Grub2.

Here I will make a brief summary of the most important things.

  • /boot/grub/grub.cfg is the main file, but you are not supposed to edit it! It is generated automatically from some other config files.
  • grub.cfg is updated by running the update-grub command as root
  • grub.cfg is automatically updated with kernel installations/removals
  • /etc/default/grub : this configuration file contains information formerly contained in the upper section of GRUB’s menu.lst and items contained on the end of the kernel line. Modifications in this file will be incorporated in grub.cfg.
  • /etc/grub.d/ : the files in this directory are read during execution of the update-grub command and their instructions are incorporated into /boot/grub/grub.cfg.

Some tasks and their solutions:

Q: How to modify the countdown time at boot up?
A: Open /etc/default/grub and look for the line with GRUB_TIMEOUT. Don’t forget update-grub at the end.


Q: You had Windows and you installed Ubuntu in another partition. Now when you switch on the computer, by default Ubuntu will start up. How to set Windows to start by default?

 

A: First, find out the exact menu entry of Windows. For this, execute the command grep menuentry /boot/grub/grub.cfg . In my case I get this:

...
menuentry "Windows 7 (loader) (on /dev/sda1)" {
...

Now edit /etc/default/grub and modify this line:

GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda1)"

Here I copied the string that I got in the previous step. In your case it can be different, so don’t copy/paste the line above!

This way location in the menu will not matter. Don’t forget update-grub when finished.

If you want to start the first entry, use this line instead:

GRUB_DEFAULT=0
Categories: ubuntu Tags: ,

Update several machines

September 30, 2010 Leave a comment

As the release date of the new Ubuntu is approaching, it’s time to revise how to update several machines without downloading the packages on each machine. There is a simple solution for this:

  • Upgrade the first machine normally.
  • Then copy the .deb packages from /var/cache/apt/archives to the other machine.

Careful, don’t run apt-get clean on the first machine before copying the packages because clean will delete these files. Of course, after copying the .deb files you can run the clean command.

Update script

September 30, 2010 1 comment

For updating my Ubuntu, I use the following script:

#!/usr/bin/bash

# good_shape.sh

sudo dpkg --configure -a\
&& sudo apt-get -f install\
&& sudo apt-get --fix-missing install\
&& sudo apt-get clean\
&& sudo apt-get update\
&& sudo apt-get upgrade\
&& sudo apt-get dist-upgrade\
&& sudo apt-get clean\
&& sudo apt-get autoremove

As it calls apt-get clean, it’ll remove the previously downloaded .deb packages which is usually no problem. If you don’t want that, here is a modified version of the same same script without apt-get clean:

#!/usr/bin/bash

# good_shape_safe.sh

sudo dpkg --configure -a\
&& sudo apt-get -f install\
&& sudo apt-get --fix-missing install\
&& sudo apt-get update\
&& sudo apt-get upgrade\
&& sudo apt-get dist-upgrade\
&& sudo apt-get autoremove

I execute this script every day if I don’t forget that.

Categories: bash, ubuntu Tags: ,

Extract e-mail attachments

September 27, 2010 1 comment

Problem

You have a file that contains not only the e-mail text but the attachments too in encoded form. How to extract those attachments easily?

Solution

One way is to use mpack:

$ sudo apt-get install mpack
$ munpack email.eml

Or, you can also use uudeview:

$ sudo apt-get install uudeview
$ uudeview email.eml
Categories: bash Tags: , , , ,

Intro

September 25, 2010 Leave a comment


I plan to collect my Ubuntu experiences here. When I manage to solve a problem, I will put a note here. Thus next time I won’t have to search the whole Internet again :) On the other hand, you might also find some useful tips here.

Update (20101119): I wanted to dedicate this blog to Ubuntu, but there are several other topics that I’m interested in. Instead of starting a new blog for each, I will post them here. The majority of the posts will be about Ubuntu Linux, but you will also find writings about:

  • Windows
  • PHP
  • Java
  • Python
  • etc.
Categories: Uncategorized
Follow

Get every new post delivered to your Inbox.

Join 73 other followers