Marcus' Gentoo Installation Story
/\

This history provides some tipps for installing a gentoo box on a Via Epia Board. This history began with instaling Gentoo 2004.3 :-). For questions, email me. Last updated on 2006-09.

  1. Boot and mount
    Boot from cd, fdisk your partitions, mount your linux partition.
    Unpack stage1, portage tree.
    Mount extra directories needed for hardware access:
    mount -o bind /proc /mnt/gentoo/proc mount -o bind /dev /mnt/gentoo/dev mkdir /mnt/gentoo/mnt mkdir /mnt/gentoo/scratch mount -o bind /dev/hdc99 /mnt/gentoo/mnt/scratch
    I use an extra scratch partition for portage, building, and later for more less important stuff.

    2005-07, Filesystem consideration: For production usage, I do not recommend reiserfs right now. I tested it over a few months now with kernel 2.6.11-gentoo-r4 and reiserfsprogs-3.6.19 which have shown to leave the filesystem unstable too often. First problem: when unmounting, the filesystem is not in a clean state. This happened several times. Second problems: When the filesystem is being kept running with about 3/4 usage, at some point (some access patterns) the kernel side file system drivers bring the kernel into severe difficulties. They produce lots of hanging (D mode) processes, sound will stop, shells close weirdly, the machine won't shutdown anymore. The triggering process stated some memory allocation error. I could track down the problem like this: It occured within a perl script, sometimes when unlinking, sometimes when reading a directory, that weird stuff began. When used another filesystem doing the same stuff, containing the same files, the kernel ran smoothly. The hardware was pretty new and did not report any problems.

  2. go into new system
    chroot /mnt/gentoo /bin/bash env-update source /etc/profile cd /etc ln -sf /usr/portage/profiles/default-linux/x86/2005.0 make.profile

  3. /etc/make.conf
    Edit your make.conf, use some settings like these : make.conf . These compiler setting are optimized for the Via C3 Nehemia. As you see, I prefer rather kde than gnome. Omit these flags: 3dnow .
    CFLAGS: It is not a good idea to include extra spaces within the CFLAGS value. This will break the packet cyrus-sasl to emerge.

  4. continue installing
    cd /usr/portage/ scripts/bootstrap.sh

  5. /etc/resolv.conf
    This connects to my router and ISP.
    search . nameserver 194.25.2.129 nameserver 194.25.2.130

  6. Do major compiling and install a kernel
    • Now lets start downloading with a script that downloads most of the necessary stuff: down.sh .
    • The script inst1.sh does most of compiling. While it is running, you can continue with the next step: build a basic kernel.
    • Use some genkernel for the first boot, build another advanced kernel later when your desktop is more convenient.

  7. System configuration:
    Some of my values:
    • /etc/conf.d/consolefont
      CONSOLEFONT="alt-8x8"

    • /etc/conf.d/keymaps
      KEYMAP="de-latin1-nodeadkeys" SET_WINDOWKEYS="yes"

    • /etc/conf.d/clock
      CLOCK="local" CLOCK_SYSTOHC="no" SRM="no" ARC="no"

    • /etc/rc.conf
      EDITOR="/bin/nano" PROTOCOLS="1 2" DISPLAYMANAGER="kdm" XSESSION="kde" RC_DEVICE_TARBALL="no" RC_DEVFSD_STARTUP="no"

    • More manual stuff
      echo mymachine > /etc/conf.d/hostname echo mydomain.com > /etc/dnsdomainname nano /etc/hosts nano /etc/rc.conf nano /etc/conf.d/net passwd

    • If you want to be sure that your kde starts up, check /etc/conf.d/bootmisc for the setting
      WIPE_TMP="no"

    • /etc/etc-update.conf
      diff_command="colordiff -uN %file1 %file2"

    • sudo
      emerge sudo
      and add your default user to group wheel

  8. /etc/lilo.conf
    A basic working example.

  9. /etc/bash.bashrc
    just copy this file ... its my favourite aliases and a fancy prompt.

  10. Finalize the system and reboot.
    • When most of compiling is done, use configure the services and your user:
      rc-update add hotplug default rc-update add metalog default rc-update add vixie-cron default rc-update add domainname default rc-update add hdparm boot rc-update add xdm default rc-update add net.eth0 default rc-update add hddtemp default useradd marcus -m -G users,wheel,audio -s /bin/bash passwd marcus cd /home mkdir marcus chown marcus marcus chgrp users marcus echo "source /etc/bash.bashrc" >>/etc/profile

    • Check your boot configuration and reboot the system.

  11. Sound

  12. X-ORG Configuration
    1. First xorg.conf
      This is my current /etc/X11/xorg.conf for my 1600x1200 TFT. The CLE266 VIA chipsets allow hardware mpeg2 decoding of videos. With the unichrome driver you should be able to play a mpeg2 file with as little as 5% CPU usage.

    2. Unichrome (Mpeg2 acceleration)
      • This section relies on a kernel with minimum version 2.6.13.
      • Add these use flags:
        cle266 xvmc xv unichrome
        and that setting:
        VIDEO_CARDS="via"
        in your /etc/make.conf

      • The kernel shall provide these modules: agpgart, via_agp, drm, and unichrome. Do not emerge x11-drm, since we use the modules from the kernel.

      • The module via must be loaded before drm.

      • Then emerge the (still masked) version of X11, which must be manually unmasked.
        echo "=x11-base/xorg-x11-6.8.9*" >> /etc/portage/package.unmask echo x11-base/xorg-x11 >> /etc/portage/package.keywords emerge xorg-x11

      • Modify /etc/udev/rules.d/50-udev.rules, change the permission like this:
        # dri devices KERNEL=="card*", NAME="dri/card%n", GROUP="video", MODE="0666"

      • For first startup, be sure to set your xorg.conf like this:
        # Option "TVType" "NTSC" # Option "TVOutput" "S-Video" Option "ActiveDevice" "LCD"
        Further:
        Section "Device" / Driver "via"
        Section "DRI" / Mode "0666"

      • For reference, a complete xorg log file.
        If you were successful, you see lines like
        (II) VIA(0): 3D Engine has been initialized.
        (II) VIA(0): direct rendering enabled
        (II) VIA(0): [XvMC] Initialized XvMC extension.

      • More help for Unichrome: gentoo-wiki or sourceforge: forum forum
      • ?? TODO :
        You might find when you start X that you get no signal out of the onboard VGA port and your monitor switches to power-saving mode. If you have a PCI card (graphics or TV tuner) and want to get a signal out of the onboard VGA port, reboot, enter the BIOS, select 'Advanced Chipset Features' and set the 'Display Card Priority' to 'AGP'.


    3. Help for Antialiasing:

    4. Miscellaneous tips:
      If your monitor is connected by DVI interface, try this setting:
      Option "ConnectedMonitor" "DFP"


  13. Kernel with sensors
    1. First good version: 2.6.11-r4
      kernel 2.6.11-r4 needs to a patch for the sensors.
      A good manual http://hem.bredband.net/ekmlar/vt1211.html
      cd /usr/src/linux wget http://hem.bredband.net/ekmlar/vt1211.c cp -v vt1211.c drivers/i2c/chips/vt1211.c

      Load these modules automatically: i2c_sensor, i2c_isa, vt1211.

    2. Kernel upgrade: 2.6.12-ck5 with improved scheduling for desktop usage
      Refer to 2.6.12-ck5 documentation . The vt1211 support has still not been integrated into the kernel, so you must insert it manually.
      cd /usr/src/linux/drivers/i2c/chips wget http://hem.bredband.net/ekmlar/vt1211.c
      • My optional proposal: patch the module to get rid of the continually appearing dmesg text for starting the measuring update.
        nano vt1211.c

      • If the site is down, you can use my local copy.

      Edit Kconfig and insert this text into it. Then edit Makefile and insert
      +obj-$(CONFIG_SENSORS_VT1211) += vt1211.o
      Continue as usual with configuring, building, installing.

    3. Kernel Upgrade 2.6.13-ck6
      Refer to http://hem.bredband.net/ekmlar/vt1211.html and the vt1211 patch for the 2.6.13 kernel.
      cd /usr/src/linux wget http://hem.bredband.net/ekmlar/linux-2.6.13-vt1211.patch.txt patch -p1 <linux-2.6.13-vt1211.patch.txt

    4. Next try: 2.6.17-gentoo-r7
      Refer to http://hem.bredband.net/ekmlar/vt1211.html and the vt1211 patch for the 2.6.13 kernel.
      cd /usr/src/linux wget http://hem.bredband.net/ekmlar/vt1211-2.6.17.patch.txt patch -p1 < vt1211-2.6.17.patch.txt

      Some recommendable settings, spice them with your flavour!
      • deactivate General / Auditing
      • Processor family (VIA C3-2 (Nehemiah))
      • No Symmetric multi-processing support
      • activate Module unloading
      • Processor Features / Preemptible Kernel
      • Processor Features / Preempt The Big Kernel Lock
      • Processor Features / activate Local APIC
      • activate Processor Features / cpuid and msr
      • Processor Features / Add support for 4GB memory
      • Power Management: activate Frequency scaling, activate VIA stuff.
      • Character Devices: set 8250/16550 and compatible serial support as module
      • Block Devices: Loopback device , Cryptoloop
      • RamDisk, initrd
      • SCSI: probe all luns
      • Scsi lowlevel: Via SATA
      • activate I20 device
      • Networking / Networking options : activate IRDA subsystem,
      • IRDA lowlevel: activate VIA VT8231/VT1211 SIR/MIR/FIR
      • Ethernet10/100: activate Via Rhine
      • Character devices: activate random number generator
      • Device Drivers / Multimedia / Video for Linux
      • Device Drivers / Multimedia /Device Drivers / Video for Linux / BT848
      • Device Drivers / Char / /dev/agpgart: VIA chipset
      • Device Drivers / Char / /dev/agpgart: / Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
      • activate Device Drivers / Character devices / dev/agpgart / VIA Chipset: VIA chipset
      • activate Device Drivers / Character devices / Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
      • I2C support : activate via stuff
      • I2C hardware: VIA686A
      • I2C debugging messages: deactivate them to keep your dmesg clean
      • Device Drivers / Hardware Monitoring support / VT122 (needs patch from above)
      • Sound: Alsa: choose IA 82C686A/B, 8233/8235 AC97 Controller
      • activate USB Mass storage
      • activate HID input
      • Filesystems: activate SMB file system
      • Native Language Support: add CP850
      • Cryptographic hw: activate via padlock

      Then run
      nice -n9 make bzImage modules && make modules_install


    5. Upgrade some packages
      2.6.13 needs lirc, lm_sensors from testing branch (~x86).

    6. /etc/modules.autoload.d/kernel2.6
      Here is my current file.

    7. Post kernel emerge
      When the new kernel is running and /usr/src/linux points to the corresponding sources, emerge a bunch of other programs:
      lm_sensors lirc alsa-headers alsa-lib


  14. Remote Control
    • When the kernel has compiled with the upper settings emerce the lirc package. The linux sources shall point to the actual used sources. It seems that emerge lirc creates the lirc_serial.ko module.
      emerge lirc depmod -a modprobe lirc_serial
      Now continue by checking with the "mode2" program and the remote control device assignment. My current lircrc here
    • For advice, visit this page http://www.vdr-wiki.de/wiki/index.php/Gentoo_LIRC and follow the instructions.
    • To get it working properly, I use a extra script /root/irexec.sh, that is called at each start from /etc/init.d/local. It fixes the permissions, loads the modules and restarts the lirc daemon.

  15. TV Card
    • lspci
      0000:00:14.0 Multimedia video controller: Brooktree Corporation Bt848 Video Capture (rev 12) Flags: bus master, medium devsel, latency 32, IRQ 12 Memory at e8003000 (32-bit, prefetchable) [size=4K]

    • If you see dmesg lines like those:
      bttv0: timeout: drop=0 irq=1733/1733, risc=0e56001c, bits: VSYNC HSYNC OFLOW bttv0: reset, reinitialize bttv0: timeout: drop=0 irq=1736/1736, risc=29c4b60c, bits: VSYNC HSYNC OFLOW bttv0: reset, reinitialize bttv0: timeout: drop=0 irq=1739/1739, risc=12f5760c, bits: VSYNC HSYNC OFLOW 7 bttv0: reset, reinitialize bttv0: timeout: drop=0 irq=1741/1741, risc=0e56003c, bits: VSYNC HSYNC OFLOW bttv0: reset, reinitialize
      Then I recommend to throw away the kernel configuration, and create a new one, then reboot that kernel.
    • in /etc/tvtime/tvtime.xml
      <option name="MixerDevice" value="/dev/mixer:cd"/>


  16. Various Configuration
    1. fluxbox with xdm
      To get fluxbox to be starded by xdm, edit the file /etc/X11/xdm/xdm-config and comment the line
      ! DisplayManager.requestPort: 0
      . Also see here

    2. py-rrdtool
      To keep py-rrdtool running, I prevent it from being updated. This is my /etc/portage/package.mask :
      >=dev-python/rrdtools-1.2 >=net-analyzer/rrdtool-1.2

    3. Apache: config bugfix + removing /doc/ handler
      Modification for /etc/apache/conf/commonapache.conf to fix this bug . Find this line
      AddHandler type-map var
      and change it to:
      AddHandler type-map !.var

      Then: look for this line
      Alias /doc /usr/share/doc
      It overlays the /doc directory on every virtual host. I was very confused to be able to access all subdirectories of my configured docroot, only /doc was not working. My recommendation: comment it out

    4. nice the background jobs
      nano /etc/cron.daily/slocate

    5. Mysql configuration
      For creating a local database:
      mysql -u root -p create database crappyproject; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON crappyproject.* TO crappy@localhost IDENTIFIED BY 'crappypassword'; quit; mysql -u crappy
      To work around the umlauts problem in dev-db/mysql-4.1.14-r1 and up: edit /etc/mysql/my.cnf and insert into the mysql section:
      [mysqld] init-connect='SET NAMES utf8'
      before inserting table dumps.

    6. Check if the hddtemp daemon is running :
      netcat localhost 7634

    7. KDE startup and baselayout
      If this is set to true, KDE may not start. Therefore, I recommend:
      WIPE_TMP="off"

    8. Start second X server
      Put these lines into a script named secondx.sh or the like:
      #!/bin/bash test -f /tmp/.X1.0-lock && exit -2 export DISPLAY=:1.0 xinit /usr/bin/xterm -- :1.0
      That script will probably not run for the first time. If so, apply changes to the Xauthority file. Run these commands and replace the ??? with the key you see after the list commands.
      xauth list add :1.0 MIT-MAGIC-COOKIE-1 ????????????????????????? exit

    9. Keeping man-pages-de off my system
      echo "sys-apps/man-pages -nls" >>/etc/portage/packages.use


  17. Applications
    1. XMMS
      The post xmms emerge list:
      arts xmms xmms-kde xmms-arts lirc xmms-lirc

    2. mplayer
      If mplayer crashs at init_audio_codec, do these steps:
      • Remove 3dnow from USE flags.
      • add "debug" into USE flags.
      • add "nostrip" into FEATURE flags.
      • build it for debugging:
        ACCEPT_KEYWORDS=~x86 EXTRA_ECONF="--enable-debug=3 --disable-runtime-cpudetection" emerge -pv --newuse mplayer

      • Read here for detailed test procedure.
      • If it doesn't work, continue reading: here here here

    3. Audio Editing
      My opinion on programs for cutting large audio files: Less useful for that purpose:
      • protux : Professional handling, copies audio sources entirely, less useable for cutting large files. insert into the ebuild:
        libtoolize --copy --force

      • glame : I didn't manage playback with ALSA. Needs
        USE="gnome"
        for install the gui.
      Programs I didn't try yet:
      • http://snd.sourceforge.net
      • http://awacs.dhs.org/software/gnusound/
      • http://www.ibiblio.org/pub/Linux/apps/sound/editors/xwave-0.6.lsm
      • http://www.xowave.com/
      • http://www.speech.kth.se/wavesurfer/
      • http://www.informatik.uni-frankfurt.de/~eschenb/cgi/taon.pl
      • http://www.bitwizard.nl/nightingale/
      • http://www.mtek.chalmers.se/~hjormagn/mhwaveedit.html
      • http://www.oli4.ch/laoe/
      • http://gnoise.sourceforge.net/
      • http://kwave.sourceforge.net/index.html
      • http://www.cee.hw.ac.uk/~richardk/
      • http://www.metadecks.org/software/sweep/

    4. Imagemagick and Perl
      Perlmagick is included inside Imagemagick, so you just need to emerge imagemagick. The build process reports intermediately: Perl=no. Be sure to include perl in your USE flags, then the perl support will be installed. See also this bug on that issue.

    5. eterm
      How to start a transparent eterm session:
      kstart --skiptaskbar --type Dock Eterm -x -g 80x16+200+600 --buttonbar=off --scrollbar=off --trans

    6. Mozilla, enigmail, certificates
      How to create your own certificate: read here:
      cd/ CA.pl -newca CA.pl -newreq CA.pl -signreq CA.pl -pkcs12 "My Test Certificate"

    7. I use the Image::Size module for perl

    8. kuickshow
      If kuickshow fails to emerge and complains about libungif.la , do this:
      emerge imlib kuickshow

    9. Firefox
      My preferred extensions: minifoxflat configuration mania adblock

    10. cdrecord
      cdrecord -v -tao -overburn speed=16 dev=ATA:1,0,0 /mnt/scratch/k3b_image.iso

    11. Testing drives for throughput
      time(dd if=/dev/zero of=a bs=1000000 count=5000 ; sync)

    12. List your ssh keys
      ssh-keygen -l -f id_dsa


  18. Todo:
    • Keymaps, I still dont like the style how to input a tilde :-)