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

Monday, December 15, 2014

Gentoo Stage Manager

    As I already talked in previous post about creating and maintaining a Gentoo Backup, now I've created a script to make it really easy to unpack, mount, umount, chroot and compress any gentoo stage for backup purposes (specially useful to test packages when you don't want to make a live system dirty if something fails)

     It works in command line interface with interactive menus to be easy to use with no parameters added to it as them are usually forgotten by users.

    Also, it will be configured to use a folder you specify, so if you don't try a vital folder, it is 100% safe to use it, as it will not write to anything outside specified folder.

    Currently, it is beta, so it could have some bugs, depite I've tested it and seem to work, for feedback, write to stormbyte at gmail dot com email address and I wil try to help.

    It is available on GitHub with even an ebuild in my Gentoo overlay to install it.Hope this is useful for gentoo advanced users to install and maintain their systems.

Monday, April 06, 2009

Creation and Maintenance of a Gentoo Backup

    This guide will instruct you in create a tarball with a up to date Gentoo system which can be used to save much time when formatting and reinstalling.

First of all, I will call those tarballs as follows (from here on):

  1. stage4→A complete bootable system with kernel, grub but without Xorg, Desktop environment nor anything Xorg related.
  2. stage5→It will contain all from stage4 and it includes too Xorg, Desktop Environment and every application you use.
  3. stage6→It will contain all from stage5 including a full desktop environment (like gnome, cinnamon, etc)

Starting installing Gentoo

    First of all, you need to install gentoo from scratch following Gentoo's Handbooks until the "Configuring Boot Loader" but without reboot nor unmount nor exitting chroot at the end.

Updating Gentoo

    Now it's time to update the base system of gentoo by running: emerge --sync && emerge -uDN world
After update, you can proceed with installation of any non graphical application and config that will be saved: For example, emerge networkmanager and executing rc-update add NetworkManager default

Compress the stage4

    Now it's time to compress the stage4 image to be used in case we need to format and reinstall.
If your idea is to have stage5 instead of stage4, just skip this section, and continue to Install Xorg and Desktop Environment.

    Now type exit in order to exit from chroot, and mount the destination filesystem to store the tarball but keep in mind that it will need to be stored in a partition different than where you installed Gentoo!

    If you followed the gentoo's handbook, you will have Gentoo's root partition mounted at /mnt/gentoo, so change to that directory (cd /mnt/gentoo) and type the following command to save the backup:

tar -cvjpf /stage4.tar.bz2 *

 
    For example, if you want to save the stage4 tarball under /mnt/harddrive, the command will be:

tar -cvjpf /mnt/harddrive/stage4.tar.bz2 *

Now you can reboot your system, and start using Gentoo. For instructions to restore this backup when needed, see Restoring Backup section at the end of document.


Install Xorg and Desktop Environment

    If your idea is to create a full backup of a complete Gentoo System, you must proceed with this method.

    Just emerge everything you need and configure it inside this chroot (propietary display drivers and KDE, for example)


Compress the stage5

    Once finished installing all Xorg and Desktop Environment related applications, it's time to compress the new and full stage5 tarball to have always a DE prepared Gentoo tarballed to be used in a future.
In order to do this, you have to mount the destination partition (must be other than where you installed Gentoo!) and run:

tar -cvjpf /stage5.tar.bz2 *

    For example, if destination partition is mounted under /mnt/harddrive:


tar -cvjpf /mnt/harddrive/stage5.tar.bz2 *

Updating tarball

    In order to keep stages up to date, you can update them in a running environment without the need to format nor modify your current installation.

    In order to do this, you have to unpack your current stage tarball, chroot to it, update system, and repack. Step by step:

  1. Create /mnt/stage
  2. Extract stage to /mnt/stage by executing: tar -xvjpf /stage5.tar.bz2 -C /mnt/stage
  3. mount -t proc none /mnt/stage/proc
  4. mount -o bind /dev /mnt/stage/dev
  5. If you have any system folder in a separate partition, mount them (for example boot partition)
  6. chroot /mnt/stage /bin/bash
  7. env-update
  8. source /etc/profile
  9. After that, just run emerge --sync && emerge -uDN world
  10. Once updated, we need to delete previous stage tarball and recreate. Now exit from chroot and do umount /mnt/stage/dev && umount /mnt/stage/proc
  11. To repack stage tarball, go to Compress the stage* section


Restoring Gentoo from stored stage

    Note: The safest way to restore a Gentoo from image we created, is to boot from a liveCD, format destination partition and unpack image, though replacing running Gentoo should work despite it is not tested.
 
    In order to restore a saved stage when formatting is simple: just unpack it to where you want to install gentoo by doing tar -xvjpf origin/stage5.tar.bz2 -C destination and after chroot to it to update grub install (refer to gentoo's documentation for doing that)

    I hope this guide will save a lot of time to anyone other than me. It isn't something new really, I didn't invent anything, only I wanted to post this for helping others too in restoring a gentoo's installation when something fails.

Wednesday, March 25, 2009

Gentoo Easy Handling

    First of all a brief explanation of how gentoo works (a simplification of http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=3 look for a more extensive explanation).

    Gentoo works with two kinds of software trees: the stable tree, and the unstable one; Gentoo's installer portage works with ebuilds which contains all installation data, and everything gentoo needs to install a package. Inside of it there are one thing of interest: the KEYWORD variable which can determine wheter that package is marked as stable or not.

    Before starting to explain how gentoo works, it is interesting to mention how packages are handled, and how versions are handled first. Gentoo has a particular syntax for a package: "category/packagename", but for mentioning a particular version of a package, an operator is strictly needed, for example media-test/test-4.0.0 is incorrect, it should be something like =media-test/test-4.0.0 (you can use <,>,<=,>=,= or ~ operator, the ~ operator will select all revisions for a particular version, for example ~media-test/test-4.0.0 will select 4.0.0-r1, 4.0.0-r2, and so on)

    On the other hand, we have the keywords values:

  • Stable, is the value (substitute arch with yours, like for example x86, amd64...) and is meant to be tested enough by gentoo developers and users which will not break things (hopefully). For installing stable software, nothing else is required, only to execute "emerge ".
  • Unstable means that the package is not tested enough and may harm your system (other packages depending of it don't work anymore, etc), and it is not advised to install. They are keyworded with <~ARCH> value (for example ~x86, ~amd64, etc). To install this kind of packages you have to include the line category/package ~arch to your /etc/portage/package.mask
  • But there are more, sometimes, there are certain situations a bit more special: when a package is listed in package.mask file, or also known as hard masked. This happens when a package is known to cause severe problems to rest of system or only if it's too new to be tested. To install this software, you must unmask it by adding the line "category/package" to your /etc/portage/package.unmask
  • There are cases where you need to manually hard mask a package to prevent it from beeing installed in an update (usefull when you mix between stable and unstable branches and don't want a conflictive package to be updated). In this case, it is enough with adding category/package to /etc/portage/package.mask
    In order to simplify this task, I've created a script to simplify this task. This script is rather simple to be used, and it is autoinstallable, you just need to copy/paste to a file, and run (as root) ./install.sh arch (substitute arch your your architecture).

    After installing, the usage is: gentoo [keyword/mask/unmask] and it will add the correspondent line to the correspondent file inside your /etc/portage directory.

    I hope it could be usefull to someone else than me :) and maybe I could update it adding functions or correcting bugs.

    Thanks

The Script:

Tuesday, August 05, 2008

KDE 4.1 SpeedUp and Workarrounds

    KDE 4.1 is finally here and thus, everyone can go ahead and try it (I recommend doing so) because it is really improved and it does not have that huge amount of bugs and loss of implementations KDE 4.0 had.

    If you red my last post about the KDE 4.1 MIRACLE, you'll notice I was speaking about a huge performance impact in processing some events. After much research and tests, I've discovered the cause of this huge performance impact I'll try o explain here in order to help anyone having those issues (specially Gentoo's users, since much of this is about compiling some parts with or without some special feature).

    I've discovered two possible causes:
  1. For NVIDIA users, as is listed in so many sites, read and try: KDE 4 and NVIDIA problems.
  2. For everyone (specially Gentoo's users): This is really important! Check out that your distro's maintainers or you, compiled strigi with fam and/or inotify features enabled (in Gentoo, check for fam and inotify USE flag being enabled). In my case, just enabling fam and inotify for strigi made my KDE 4.1 trunk far more stable than it was. If it is your case, just add "app-misc/strigi fam inotify" to your /etc/portage/package.use file if you are using portage, or to your /etc/paludis/use.conf if you use paludis, and recompile at least strigi.
    To finish, I only can say that now, I can say, and prove that KDE 4.1 is really a miracle for everyone's Desktop!

Tuesday, April 01, 2008

UPCOMING GCC 4.3.0

    For people who thinks that wait is over: you are wrong! As flameeyes said in his blog "GCC 4.3 will be a bloodshed", I agree with that, but this needn't to be bad at all!

    Is true that most of pedantic warnings are now promoted to errors, and it is really fine, as that leads in most of cases to runtime errors. For example redefinition of macros: When a project is large enough, allowing redefinition of macros is not so trivial, because it can lead to misunderstanding of a macro's value along source code.

    Other changes are a bit nonsense, like not including by default c libraries, and so, a lot of programs cannot compile now. But despite the impact it is causing, I think it is good, since it forces programmers to write better code and there are already plenty of patches out there, but still is a headache to solve, both Gentoo side, and upstream side.

    There are, however, a huge issue with <kernel-2.6.24.4 triggered by an GCC's internal change. As gcc is still respecting x86/x86_64 ABI despite that change, the problem comes from upstream, >=gentoo-sources-2.6.25 is marked stable, or at least they include a 2.6.24.4 backport of DF Clearing (as you can see in Gentoo's bug #213811).

    Fortunately, this wouldn't be so bad, as this version of GCC will come with some major features and improvements that makes it worth of installing and testing as soon as possible, what leads one to think that this version will be next Gentoo's stable gcc version. To mention some optimizations: for example the core2 optimization for that kind of processors which are getting more and more common in nowadays user's computers or the inclusion of SSSE3 and SSE4 multimedia CPU instructions, as well as other tons of new features and changes. To see the whole list, see GCC's Changelog.