The installation of a new kernel adds two new entries in the Grub menu. I have set the default selected entry to something different from the first item, so each time a new kernel is installed, the default entry points to the wrong menu item. Using update-grub will automatically update all Grub2 configuration files, and that's when the kernels present in the file system are automatically detected (Grub2).
I want to remove the old kernels, which I won't need anymore. There are several ways to do it. I'll show how to do it on the command line. First, let's list the installed kernels
dpkg -l | grep linux-im
ii linux-image-2.6.32-23-generic 2.6.32-23.37 Linux kernel image for version 2.6.32 on x86
ii linux-image-2.6.32-24-generic 2.6.32-24.38 Linux kernel image for version 2.6.32 on x86
ii linux-image-generic 2.6.32.24.25 Generic Linux kernel image
Here, we see package names and package version numbers. The syntax to completely remove packages is "apt-get purge packagename". Let's remove the unwanted kernel image, which is 2.6.32-23.37. The string used after "purge" is a regular expression. I don't bother to escape it.
sudo apt-get purge .*.2.6.32-23
All packages matching this regular expression will be completely removed. This operation must be done with caution. Fortunatly, before packages are removed, a confirmation will be displayed (in Japanese in my local environment):
以下のパッケージは「削除」されます:
linux-headers-2.6.32-23* linux-headers-2.6.32-23-generic*
linux-image-2.6.32-23-generic*
アップグレード: 0 個、新規インストール: 0 個、削除: 3 個、保留: 0 個。
この操作後に 184MB のディスク容量が解放されます。
続行しますか [Y/n]? Y
This shows that three packages will be removed. That's what I was expecting. After accepting the changes, the Grub configuration will be automatically updated ! No need to update it yourself.
Running postrm hook script /usr/sbin/update-grub.
Generating grub.cfg ...
...
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-24-generic
Found initrd image: /boot/initrd.img-2.6.32-24-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Microsoft Windows XP Home Edition on /dev/sda1
Found Windows NT/2000/XP on /dev/sda3
done
Voila ! The unwanted kernels should be gone from the file system and from the Grub menu.
Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts
Friday, July 23, 2010
Friday, July 9, 2010
Preventing services to startup at boot time in Ubuntu
After installing Tomcat6 via the Synaptic package manager, Tomcat is automatically started at boottime. This was fine, until I started playing with Grails. Without changing any configuration settings, Grails will start its own web server instance at the default http port, 8080, the same as Tomcat's default. This results in an error when trying to start a Grails application :
grails run-app
Server failed to start: java.net.BindException: Address already in use
There are different ways to avoid this error. Make Grails use Tomcat's instance, change either Grails or Tomcat's default http port, or don't start Tomcat at boot time. I decided to remove Tomcat's automatic startup. How do we do that in Ubuntu ?
Init scripts are in /etc/init.d, and symbolic links to these scripts are separated in runlevels, each residing in /etc/rcX.d/, where X is the runlevel. We could remove them by hand, but this can be done easily with one single command : update-rc.d
sudo update-rc.d tomcat6 disable
update-rc.d: warning: tomcat6 start runlevel arguments (none) do not match LSB Default-Start values (2 3 4 5)
update-rc.d: warning: tomcat6 stop runlevel arguments (none) do not match LSB Default-Stop values (0 1 6)
Disabling system startup links for /etc/init.d/tomcat6 ...
Removing any system startup links for /etc/init.d/tomcat6 ...
/etc/rc0.d/K20tomcat6
/etc/rc1.d/K20tomcat6
/etc/rc2.d/S20tomcat6
/etc/rc3.d/S20tomcat6
/etc/rc4.d/S20tomcat6
/etc/rc5.d/S20tomcat6
/etc/rc6.d/K20tomcat6
Adding system startup for /etc/init.d/tomcat6 ...
/etc/rc0.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc1.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc6.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc2.d/K80tomcat6 -> ../init.d/tomcat6
/etc/rc3.d/K80tomcat6 -> ../init.d/tomcat6
/etc/rc4.d/K80tomcat6 -> ../init.d/tomcat6
/etc/rc5.d/K80tomcat6 -> ../init.d/tomcat6
There are a couple of warning because I used the disable command without any parameters. These can be ignored. As the man page says : "If no start runlevel is specified after the disable or enable keywords, the script will attempt to modify links in all start run‐levels.". Enabling back the service at bootime is as simple (same warnings):
sudo update-rc.d tomcat6 enable
update-rc.d: warning: tomcat6 start runlevel arguments (none) do not match LSB Default-Start values (2 3 4 5)
update-rc.d: warning: tomcat6 stop runlevel arguments (none) do not match LSB Default-Stop values (0 1 6)
Enabling system startup links for /etc/init.d/tomcat6 ...
Removing any system startup links for /etc/init.d/tomcat6 ...
/etc/rc0.d/K20tomcat6
/etc/rc1.d/K20tomcat6
/etc/rc2.d/K80tomcat6
/etc/rc3.d/K80tomcat6
/etc/rc4.d/K80tomcat6
/etc/rc5.d/K80tomcat6
/etc/rc6.d/K20tomcat6
Adding system startup for /etc/init.d/tomcat6 ...
/etc/rc0.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc1.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc6.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc2.d/S20tomcat6 -> ../init.d/tomcat6
/etc/rc3.d/S20tomcat6 -> ../init.d/tomcat6
/etc/rc4.d/S20tomcat6 -> ../init.d/tomcat6
/etc/rc5.d/S20tomcat6 -> ../init.d/tomcat6
To disable the running service without having to reboot:
sudo /etc/init.d/tomcat6 stop
* Stopping Tomcat servlet engine tomcat6 [ OK ]
After that, Grails applications will be happy to run:
grails run-app
Welcome to Grails 1.1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/lib/grails-1.1.1
Base Directory: /home/kuriqoo/eclipse/workspace/hubbub
Running script /usr/local/lib/grails-1.1.1/scripts/RunApp.groovy
Environment set to development
Running Grails application..
Server running. Browse to http://localhost:8080/hubbub
Tomcat can be manually started using :
sudo /etc/init.d/tomcat6 start
* Starting Tomcat servlet engine tomcat6
Using CATALINA_BASE: /var/lib/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /tmp/tomcat6-tmp
Using JRE_HOME: /usr/lib/jvm/java-6-openjdk
Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar [ OK ]
grails run-app
Server failed to start: java.net.BindException: Address already in use
There are different ways to avoid this error. Make Grails use Tomcat's instance, change either Grails or Tomcat's default http port, or don't start Tomcat at boot time. I decided to remove Tomcat's automatic startup. How do we do that in Ubuntu ?
Init scripts are in /etc/init.d, and symbolic links to these scripts are separated in runlevels, each residing in /etc/rcX.d/, where X is the runlevel. We could remove them by hand, but this can be done easily with one single command : update-rc.d
sudo update-rc.d tomcat6 disable
update-rc.d: warning: tomcat6 start runlevel arguments (none) do not match LSB Default-Start values (2 3 4 5)
update-rc.d: warning: tomcat6 stop runlevel arguments (none) do not match LSB Default-Stop values (0 1 6)
Disabling system startup links for /etc/init.d/tomcat6 ...
Removing any system startup links for /etc/init.d/tomcat6 ...
/etc/rc0.d/K20tomcat6
/etc/rc1.d/K20tomcat6
/etc/rc2.d/S20tomcat6
/etc/rc3.d/S20tomcat6
/etc/rc4.d/S20tomcat6
/etc/rc5.d/S20tomcat6
/etc/rc6.d/K20tomcat6
Adding system startup for /etc/init.d/tomcat6 ...
/etc/rc0.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc1.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc6.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc2.d/K80tomcat6 -> ../init.d/tomcat6
/etc/rc3.d/K80tomcat6 -> ../init.d/tomcat6
/etc/rc4.d/K80tomcat6 -> ../init.d/tomcat6
/etc/rc5.d/K80tomcat6 -> ../init.d/tomcat6
There are a couple of warning because I used the disable command without any parameters. These can be ignored. As the man page says : "If no start runlevel is specified after the disable or enable keywords, the script will attempt to modify links in all start run‐levels.". Enabling back the service at bootime is as simple (same warnings):
sudo update-rc.d tomcat6 enable
update-rc.d: warning: tomcat6 start runlevel arguments (none) do not match LSB Default-Start values (2 3 4 5)
update-rc.d: warning: tomcat6 stop runlevel arguments (none) do not match LSB Default-Stop values (0 1 6)
Enabling system startup links for /etc/init.d/tomcat6 ...
Removing any system startup links for /etc/init.d/tomcat6 ...
/etc/rc0.d/K20tomcat6
/etc/rc1.d/K20tomcat6
/etc/rc2.d/K80tomcat6
/etc/rc3.d/K80tomcat6
/etc/rc4.d/K80tomcat6
/etc/rc5.d/K80tomcat6
/etc/rc6.d/K20tomcat6
Adding system startup for /etc/init.d/tomcat6 ...
/etc/rc0.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc1.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc6.d/K20tomcat6 -> ../init.d/tomcat6
/etc/rc2.d/S20tomcat6 -> ../init.d/tomcat6
/etc/rc3.d/S20tomcat6 -> ../init.d/tomcat6
/etc/rc4.d/S20tomcat6 -> ../init.d/tomcat6
/etc/rc5.d/S20tomcat6 -> ../init.d/tomcat6
To disable the running service without having to reboot:
sudo /etc/init.d/tomcat6 stop
* Stopping Tomcat servlet engine tomcat6 [ OK ]
After that, Grails applications will be happy to run:
grails run-app
Welcome to Grails 1.1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/lib/grails-1.1.1
Base Directory: /home/kuriqoo/eclipse/workspace/hubbub
Running script /usr/local/lib/grails-1.1.1/scripts/RunApp.groovy
Environment set to development
Running Grails application..
Server running. Browse to http://localhost:8080/hubbub
Tomcat can be manually started using :
sudo /etc/init.d/tomcat6 start
* Starting Tomcat servlet engine tomcat6
Using CATALINA_BASE: /var/lib/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /tmp/tomcat6-tmp
Using JRE_HOME: /usr/lib/jvm/java-6-openjdk
Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar [ OK ]
Labels:
ubuntu
Sunday, May 9, 2010
Ubuntu 10.04 breaking old habits
I updated Ubuntu to the latest 10.04 and the first thing I noticed is that the minimize/maximize/close window buttons were moved from the upper right corner, to the upper left corner. At first, I thought this was not a big deal. But after a few hours, it happens to be really annoying. How can I suddenly break a more than 10 years old habit ? No matter what, I keep looking for these buttons in the upper right corner. I definitely had to put them back to where they belong. How do we do that ?
- Open the gconf-editor (Alt+F2 and type gconf-editor)
- Search for the apps/metacity/general/button_layout key
- Double click it and change it to menu:maximize,minimize,close
- Click Ok, and the buttons should be back to the upper right
Labels:
ubuntu
Monday, April 19, 2010
IDE under Ubuntu
I had Ubuntu 9.4 for a while on my laptop, but I was not using it much. I can't tell why. Recently, after spending some time trying to remember which password I was using, I decided to go back to it. I upgraded to 9.10, installed Compix Fusion and Awn, and start playing with all sorts of configurations. Compix is crazy ! If you decide to install Ubuntu, you have to try it. Ubuntu is a lot of fun, and it's fast ! Booting is fast, launching applications is fast. I can't come back to Windows without getting frustrated by the time I have to wait until I can launch an application.
Until now, I was using both IntelliJ and Eclipse on Windows. The first thing I did was to install both on Ubuntu. After setting a few environment variables, I started IntelliJ. It worked. It worked very well. I made a new Griffon project, and started some coding. I like IntellJ's Griffon view, with the Model, View and Controller folders. It was fun... until the focus cursor went wild. No more focus. No matter where I clicked, the window was not responding to the keyboard anymore. After restarting IntelliJ, everything was back to normal. But then the focus cursor went wild again. I searched the web for similar problems, and it seems that many people have this problem on Ubuntu. After wasting some time trying some of the suggestions I read, I gave up, and turned back to Eclipse.
Eclipse Gallileo works like a charm. CTRL+Space was already mapped to the Input Method Editor(IME), so I just had to change the IME settings and remove CTRL+Space from the hook list. Apart from that, I haven't encountered any particular inconvenience yet.
Until now, I was using both IntelliJ and Eclipse on Windows. The first thing I did was to install both on Ubuntu. After setting a few environment variables, I started IntelliJ. It worked. It worked very well. I made a new Griffon project, and started some coding. I like IntellJ's Griffon view, with the Model, View and Controller folders. It was fun... until the focus cursor went wild. No more focus. No matter where I clicked, the window was not responding to the keyboard anymore. After restarting IntelliJ, everything was back to normal. But then the focus cursor went wild again. I searched the web for similar problems, and it seems that many people have this problem on Ubuntu. After wasting some time trying some of the suggestions I read, I gave up, and turned back to Eclipse.
Eclipse Gallileo works like a charm. CTRL+Space was already mapped to the Input Method Editor(IME), so I just had to change the IME settings and remove CTRL+Space from the hook list. Apart from that, I haven't encountered any particular inconvenience yet.
Subscribe to:
Posts (Atom)