Showing posts with label gentoo. Show all posts
Showing posts with label gentoo. Show all posts

Sunday, February 5, 2012

Installing Gentoo from a LiveCD (SystemRescueCD)

This is a guide for you to install Gentoo Linux in a much easier way than using the Minimal Installation CD (install-x86-minimal-<release>.iso). By using this way, you can skip the first three parts and start with part 4 in the "Installing Gentoo" section of Gentoo Linux Handbook. (The link is for the x86 architecture. For other archs, refer here.) I'm going to aware on installing Gentoo by using SystemRescueCD live cd by this blog post.

Why I choose to use this method? Firstly, because I didn't know that it's this easy. The other one is I was stuck at setting up a WPA protected Wifi connection via command-line. Believe me when I tell you that configuring a WPA protected WiFi network via command-line is a nightmare. The net-setup only support WEP, and no WPA. You have to use wpa_supplicant for that. While I'm thanking for the hard work of wpa_supplicant developers, they really should think on automating this or at least writing a good documentation. After couple of hours of trying I got fed up. Someone from #gentoo IRC suggested me to use SystemRescueCD. With this you don't have to worry about setting up network connection. You can simply use the live cd's internet connection. NetworkManager takes care of all the needed details. You just need the SSID (The wifi network name), and the WPA password. Here,

SystemRescueCD is also a Gentoo based live cd, and provides enough graphical user interface to do the installation. It has XFCE Desktop Environment with shortcuts to the most needed apps (GParted, networkmanager, Terminal, Firefox etc.) in the bottom panel.


  • First, download it from http://www.sysresccd.org/Download
  • Now, burn it to a CD, or make a bootable USB-stick. The choice is upto you. In this case, I preferred CD because I believe that this will be useful in future too.
  • Do the needful, and boot from your SystemRescueCD. Choose the default (first) option when it asks on what kernel to boot. The interface looks almost like GRUB. See the screenshot.

  • Just wait until it provides the command prompt. What? No GUI? Yes, there is. Make sure you read the message just above the prompt as well. Now use one of the following commands to load the UI.
wizard
startx 
Both of these worked for me.
  •  Now, you will see the xfce desktop getting loaded. Now, setup the network connection via NetworkManager ui client. It's at the bottom-right side. For wireless connections, right-click on it -> 'edit connections' -> wireless tab -> press 'Add' -> Provide SSID (the network name), and set password if necessary. Save and close it. Click on NetworkManager. Click on your connection. You should be connected to the network now. \yay/  

  • Then, just load the Terminal, and you may proceed with part 4 in Gentoo handbook as I told you before. There are very few changes to the commands with this approach. Those are listed under Installation from non-Gentoo LiveCDs. I will brief those here too.
  • To make your life further easier - For part 4, "Preparing the Disks" you may just use GParted that comes with System Rescue CD. Which is in my opinion, highly reliable because if you made mistake with the commands, you may gonna get screwed.
  • At the end of it, make sure you install a desktop environment like GNOME or KDE too. Otherwise you will end up in a Gentoo command prompt anyway. The good news is you can always boot in to the system rescue cd, and continue the installation later on. I learned that I have to install a DE this way ;-). You wanna know how to do this "continuation" after a machine a reboot? Read on.

Changes to the commands

Following is just for the sake of future reference for me.

Mounting of /proc should be done at part 6, not part 4.

When you're ready to unpack the stage tarball in part 5, you will need to use a different tar command to ensure that proper group IDs are enforced on the unpacked stage:


# tar --numeric-owner -xvjpf stage3-*.tar.bz2

Now, when you are asked to mount /proc system in part 6, issue the following command instead:

# mount -o bind /proc /mnt/gentoo/proc

Once you're ready to chroot into your unpacked stage in part 6, you will need to use a different chroot command sequence. This ensures that your environment variables are properly setup.

# chroot /mnt/gentoo /bin/env -i TERM=$TERM /bin/bash
# env-update
# source /etc/profile
# export PS1="(chroot) $PS1"

That's it. Other commands in the handbook should be the same. 
Following section describes you how to continue/resume a Gentoo installation in case you are in need of it. 


Resume/Continue a Gentoo Installation

Say, you've run started Gentoo installation, and run past part 6.  Up to this level, your changes will be persisted such that you can easily restart the installation. But in part 6, you chroot to the new environment, and do the changes there. Gentoo installation takes time. In case a power failure occurred after this step or you missed to do one step in the handbook that you remembered just after rebooting the system, or any other case you may need to get back to the installation where you stopped, and resume from there.

With Gentoo, it's far easier to do this. Do mind that this guide is tested only for installing Gentoo via a live cd only. I haven't tested other scenarios but your may give it a try.

Before starting the work from where you left, you need to do following things. Get to a terminal by booting the live cd. For SystemRescueCD case, use the xfce terminal.
Now, mount your root partition.

  # mount /dev/sda3 /mnt/gentoo

(You may need to mount /boot too. I didn't needed that because I didn't use a separate partition for /boot. # mount /dev/sda1 /mnt/gentoo/boot )

 # mount -o bind /proc /mnt/gentoo/proc
 # mount --rbind /dev /mnt/gentoo/dev

Following set commands are just the chroot procedure:

# chroot /mnt/gentoo /bin/env -i TERM=$TERM /bin/bash
# env-update
# source /etc/profile
# export PS1="(chroot) $PS1"

You are good to go now. Enjoy the ride!

==========================================

You may try the following if you are using Gentoo minimal cd. I haven't tested this, so I can't be sure that this works. Let me know in the comments how it goes?

 # mount /dev/sda3 /mnt/gentoo
 # mount /dev/sda1 /mnt/gentoo/boot

 # mount -t /proc none /mnt/gentoo/proc
 # mount --rbind /dev /mnt/gentoo/dev

Following is the chroot procedure:
 # chroot /mnt/gentoo /bin/bash
 # env-update
 # source /etc/profile
 # export PS1="(chroot) $PS1"

Much like to hear about your experience regarding this. Did my blog help you at least a little?

Thursday, October 20, 2011

Gentoo Maven Integration - Progress Report

Here's my progress report for the first phase of Gentoo Maven Integration project for 
finishing the work under Google Summer of Code and starting move in to 
a voluntary position. 

The goal of this project was to build maven and it's huge number of 
dependencies from source, and then facilitate the packagers for 
packaging maven-based Java packages. There are two eclasses which will 
facilitate bootstrapping maven along with building maven-based 
packages, and packaging Maven plugins. These eclasses address some 
fundamental issues of incompatibilities between Gentoo build system 
and Maven build system. 

There were two main goals for the project. One is building 
maven-from-source. It is now completed and has been thoroughly tested. 
There are around 40+ ebuilds that are direct dependencies of Maven 
which were packaged/bumped during the project period. General users of 
maven can have the full benefit from this package now. Please file 
bugs at https://bugs.gentoo.org/ if you find any. 

The second phase was a lengthy process and the scope wasn't fit for 
one and half months time. But with mentors' blessing, I've made a 
quite a big progress and was able to emerge a minimal package built 
via native Maven. 

Let me describe the surface details of the second phase. The idea was 
to facilitate the packagers to package maven-based packages. This has 
been a long-time blocker for Gentoo-Java (which extends to more than 
3-4 years). For this phase, we needed several requirements including 
dependency management issues and rewriting of pom.xml to match 
Gentoo's needs. One requirement in it was the need to have a mechanism 
to use the installed system jars instead of downloading the jars from 
maven repos. One another is that pom needs to respect the Gentoo SLOT 
system. Further, configuration details needed to be added to tell the 
JDK and JRE versions needed for building (ie need to add config bits 
to maven-compiler-plugin section in the pom). And, then it needs 
several maven plugins to build packages. There were enormous amount of 
plugins available that most of them need special attention separately. 
For the second phase, the hard part is over. And, as I said, I was 
able to emerge a minimal maven-based implementation. Maven isn't much 
cooperative when it comes to dependency management, but our solution 
worked well. 

Along with that, the first iteration of work is complete. I'm hoping 
to be the maintainer for Maven under Gentoo Java herd for the 
foreseeable future. And, I'm eagerly waiting to wear the Gentoo 
Developer hat one day. I'm interested in knowing the generic plan for 
recruiting developers who come via Summer of Code as well. 

There are few things to be done to bring the use of the Maven 
integration to it's full potential. These are more like plug-ins to 
the core base, and beautifying the process. I need to make new plans 
for these with help from Java herd. 

 * There's only five maven plugins has been packaged. Have a fresh 
look at maven-surefire-plugin. Needs to add all other plugins. 

 * Currently, when MAVEN_PARENTPOM_UNIQUE_ID is set to rewrite 
<parent> node of the pom, it rewrites all the poms in the project 
including sub-modules. The most probable usecase is that rewrite the 
parent element of the top-level/aggregator pom. The configuration bits 
needed are already there (-w option), but the implementation needs to 
be done. 

 * Merge the separate ebuilds of  maven-2.2.1 maven-2.2.1 release in 
to one. There are around 20+ ebuilds dedicated for this. These ebuilds 
probably won't be needed separately so it's ok to merge these 
together. Need to evaluate possibility of issues of having all these 
together. 

Here are some references if you are interested in getting deeper in 
Maven in Gentoo. Feel free to contact me if you like to extend your 
helping hand for the project. I'm at kasunbg +spamfree at gmail.com
 
 * The wiki 1 - Developer and User guide for Maven in Gentoo - 
https://overlays.gentoo.org/proj/java/wiki/Maven_Integration
 * The wiki 2 - Manpage for java-maven-2 eclass - 
http://overlays.gentoo.org/proj/java/wiki/Maven_Eclass_Manpage
 * Repository 1 - gsoc-maven-overlay - 
https://overlays.gentoo.org/svn/proj/java/gsoc-maven-overlay/
 * Repository 2 - Branch for Javatoolkit - 
http://overlays.gentoo.org/proj/java/browser/projects/javatoolkit/branches/kasun/
       * TracBrowser view - 
http://overlays.gentoo.org/proj/java/browser/gsoc-maven-overlay/