Category Archives: Ubuntu

Ubuntu: Make an iso of your mmc

Well, it doesnt have to be your mmc. It could be anything thats connected to your system.

How to: Make an .iso file from the terminal

Stuff I did:

Ubuntu software center, Google etc. to find a terminal application that would let me do it. Found “cat” from ubuntuforums. Well, i tried it out. Didnt know what it did exactly and i thought i just wrote everything in a file to another file

sudo cat /dev/mmcblk0 > my-iso.iso

This will create an .iso for all practical purposes i suppose. But for a normal user like me, i dont suppose you can transfer it to another os and use it for anything. the default archive manager doesnt open it either.

Found out about “dd” while Google-ing.

sudo dd if=/dev/mmcblk0 of=my-iso.iso

This does the exact thing as cat. But dd is the way everyone does it i suppose.

Solution: mkisofs

mkisofs is what came to myhelp at long last.

mkisofs -0 my-iso.iso /media/mmcname/

This did the trick. It created an iso of all the contents of “mmcname”. The only thing is however, it works only for directories i believe.

Ubuntu: Make a swap file.

The main question why would you need a swap file when you can opt for a swap partition while installing…? Well people like me who normally screw up their hard disks with multiple partitions and formats normally end up not being able to create any more primary or logical extensions to the existing partitions and hence is unable to make a dedicated swap partition. This, or you forgot to set it up. Having a swap is good even when you are not going to use even half your RAM. You might never need it, but if you need it, this is how you do it.

Any way, we at hirir, have solution!!

Problem: Need swap space but cant (dont want to) make a swap partition.

Solution: Make a swap file.

Step 1: Decide location
Well, decide on a location to fix your swap partition. Ive decided on “/home/swap

Step 2: Become root!
This is becoming a habit now.

Step 3: Type into terminal: fallocate -l 4g /home/swap/4g.swap
This will create a file by the name 4g.swap in /home/swap. The file name is immaterial. Im just trying to indicate that Im making a 4GB swap. -l 4g specifies the length of the file 4g.swap. Suffixes like m g t p e are also possible. ie, mb,gb,tb and so on.

Step 4: Type into terminal: chmod 600 /home/swap/4g.swap
Here we are making it non world readable. Just to make sure no-one reads stuff from it.

Step 5: Type into terminal all over:

mkswap /home/swap/4g.swap
swapon /home/swap/4g.swap

Type into terminal: cat /proc/meminfo and see the swap there and cry out “Yippeee”

Step 6: Make it all permanent
To make it all permanent, we edit /etc/fstab
To do that type into terminal

gksudo gedit /etc/fstab

And add into it, at the end, the following line:

/home/swap/4g.swap none swap sw 0 0

All done!!

Type “free” into terminal and you will see swap space that you’ve just allocated.

Reboot and from then on you may hibernate your system. :) which is why I did all this.

Ubuntu: Reboot into the desired OS

I have found it a bit trouble some having to reboot and wait in front of the system for grub to load and select my OS. I will always be running around after setting my system to reboot. And grub boots into my latest Kernel image by default.

I decided to make a tool that would help us boot into our desired one in the grub menu. I even named it “boothis”. After this tide of inventive and inspiring idea, i decide to Google it. And guess what? I found a way to do it!!

Well here is the method:

Step 1: Become root

  • This can be easily done by typing in terminal “su” and then giving the root password.
  • If you do not know how to set a root password, or if you havent set one, goto: Setting a root password
  • Step 2 Changing GRUB_DEFAULT

    • Type into terminal: gedit /etc/default/grub &
    • In the opened file, find GRUB_DEFAULT and set it to ‘saved’.Save it once it looks like this:
      GRUB_DEFAULT=saved

    Step 3: Updating grub

    • Type into terminal: update-grub
      • Step 4: Setting grub default load

        • To set a default selection from the menu always run in terminal: grub-set-default [num]
          where [num] is the position of this entry in the grub menu.
        • eg:”grub-set-default 0″ will set the grub to load the first item in your grub menu.

        Step 5 Finally,we are all set for grub-reboot

        • Type in terminal: grub-reboot [num]
        • This will reboot into the choice in the grub menu which is at position [num].
        • eg:”grub-reboot 5″ will boot into your 4th item in the menu list

        To make it all easier the second time around, you can give

        “grub-reboot 5;reboot” to reboot into your 4th item in the list immediately.

Ubuntu: Terminal transparency issue

Upgraded to Ubuntu 11.10 last month. And i intended to post this back then. But of-course time got the better of me. I kept thinking yesterday was tomorrow. Anyway, lets get on to the issue.

Issue: Transparency in terminal shows the desktop background rather than the window underneath.

SoulMazers Bad terminal
The image above was found in a post by SoulMazer in UbuntuForums.

What i did: Endless Googling for it and looking around in Ubuntu forums is what i did. I even asked the tech guru here for a solution. Tech guru seemed to think it was the Nvidia driver problem. I didnt know where to get it from, so left if for a week. Ubuntu forums kept telling me its the compiz problem.

Finally found my solution at askubuntu.com. Man, i thanked Jonathan a million times(in my mind).

Solution: Paste in terminal: gconftool-2 -s ‘/apps/metacity/general/compositing_manager’ –type bool true

What you have done is enable composting in metacity. This worked for me after the first restart. Hope it does for you too!

Enabling ‘/var/log/messages’ in Natty

Why would you need it? Well, if at all you need it, here it is.

It is disabled in Natty by default. Follow me to get back whats rightfully yours..

This is the file you’re looking for:
/etc/rsyslog.d/50-default.conf

What we will do is copy it elsewhere, rename that as “50-default_backup.conf” as a back up. We will edit a bit in it, and save it as “50-default.conf”. We will then move it to “/etc/rsyslog.d/”. All by just using the Terminal(and gedit because havent yet mastered vi yet)!!! Yes there are easier ways to do it.. But this is better!

Step 1: Ctrl+Alt+T or you can do it the boring way.. Applications> Accessories> Terminal.

Step 2: Type in the following in to the terminal ill explain soon.

$ cp /etc/rsyslog.d/50-default.conf ~/Desktop/
$ cd ~/Desktop
$ mv 50-default.conf 50-default_backup.conf
$ gedit 50-default_backup.conf

The first line there copies /etc/rsyslog.d/50-default.conf to your Desktop. Whats the “~” doing there? it fills in for “/home/your_user_name”.
The next line there is changing your working directory to “/home/your_user_name/Desktop/”.
Next one renames the file. Yes “mv” is move command. but moving a file to a directory already in which it is, if the file names are different,”mv” renames it.
Next line opens up Gedit for you to edit the new renamed file.

What you are looking for is:

#
#*.=info;*.=notice;*.=warn;\
#    auth,authpriv.none;\
#    cron,daemon.none;\
#    mail,news.none        -/var/log/messages
#

Step 3: Remove all the # at the starting in this section of the .conf file and save it as “50-default.conf” in your Desktop. this can be easily done through the GUI.

Step 4: Close gedit and get back to terminal.

Now we need to put our new file into “/etc/rsyslog.d/” directory. Heres how we do that:

Step 5: Type in the following now.

$ sudo mv -f ~/Desktop/50-default.conf  /etc/rsyslog.d/50-default.conf

Key in the password when asked for.
“sudo” lets you move that file into a restricted directory.
“mv -f” is used so that it over writes the existing file.

Step 6: In terminal:

$ sudo restart rsyslog

Viola! We are done.!!

Setting a root password

One of the first things you would want to do after you install Ubuntu (i suppose any Linux distro) is to reset/set root password. Yes you can get around all this using “sudo” command. But it will be a real pain one you start doing a lot of things that need authorization.

Just type “su” into your terminal window and you can become root provided you know the password. In most cases this will not be known to you. Here’s how you can set it..

Step 1: Applications>Accessories>Terminal  (or you can press Ctrl+Alt+T).

You will be prompted with your_name@your_computer_name:~$ . This means you are working in “/home/your_name” and you are you and not root. :) Never mind.

Step 2: Type sudo passwd root. It should look like this:

$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:

And if everything goes well,

passwd: password updated successfully

Thats it. once you type “sudo passwd root” and hit enter, it will ask for your password. Type in the password you want to use for root. I dont have to tell you not to forget it. Retype it and we are done. Yes you wont see anything there while you type. Thats how it is. You will get used to it as we go along.

This works for resetting the password too at a future time. I guess if you are in sudoers list, you can reset anyones password. Instead of “root” after “sudo passwd”, type in the username. Try it out. Reset your brothers password and let me watch him kill you. ;)

Issue No1: Earphone active, system speaker not muting.. Solved!!

I suggest you read the very last line in this post before you read through the entirety of the post, because it might not be what you are looking for..

Issue: Earphone plugged in. Audio from both the headset and the system speaker on my HP Dv6 2171ee..

Simple solution: Change connector option from Sound Preferences window.

If this doesn’t work for you too here is,

Things i did:

Take Applications>Accessories>Terminal and paste this there.

wget http://www.alsa-project.org/alsa-info.sh -O alsa-info.sh && bash alsa-info.sh

This will give you a link. Open it, find your codec information. Just search with in the page “HDA-Intel Codec information !!”..this should help you if the codec is either “Realtek ALC888” or “IDT 92HD75B3X5”

sudo add-apt-repository ppa:ubuntu-audio-dev/ppa; sudo apt-get update;sudo apt-get dist-upgrade; sudo apt-get install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r) libasound2; sudo apt-get -y –reinstall install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r)  libasound2; killall pulseaudio; rm -r ~/.pulse*

This did it for most.. Obviously not enough for my lap..

So, thanks to lidex on ubuntuforums.org and thread http://ubuntuforums.org/showthread.php?t=1751483 i finally did fix it..

Ill let you know what i did next though..

1. In terminal, type the following, to let you edit alsa-base.conf .

gksudo gedit /etc/modprobe.d/alsa-base.conf

2. Now, add this to the end of the file

options snd-hda-intel model=

3. Reboot

4. Open the alsa-base.conf file again and add after the “options snd-hda intel model=” “3stack-hp” now if it is not HP, add from the list available on the forum..(If i was going to direct you to the forum anyway, why read through all this?? hmm… I’m thinking along those lines now..)

5. Now try and change the connector options from the sound preferences window.

This worked for me.. It does mute my system speakers. Only problem is, I’ve to change this every time i plug in the headset..