Rich0's Gentoo Blog

Archive for the ‘linux’ Category

Quick systemd-nspawn guide

with 14 comments

I switched to using systemd-nspawn in place of chroot and wanted to give a quick guide to using it.  The short version is that I’d strongly recommend that anybody running systemd that uses chroot switch over – there really are no downsides as long as your kernel is properly configured.

Read the rest of this entry »

Written by rich0

July 14, 2014 at 4:31 pm

Posted in foss, gentoo, linux

Quick EC2 Backups with Duplicity

leave a comment »

I’ve been doing online EC2 backups on my Gentoo box for a while, but switched to Duplicity a few months ago and have been very happy with the results.  Setting this up took some trial and error, so I figured I’d share my config in case others find it useful.  But first, here’s why I switched… Read the rest of this entry »

Written by rich0

February 4, 2014 at 5:07 pm

Posted in foss, gentoo, linux

btrfs and snapper with portage on Gentoo

with 4 comments

This is just a quick share-a-recipe post to introduce snapper to anybody who hasn’t heard of it, and explain how to use it.

Snapper is a utility that manages btrfs snapshots.  One of the nice features of btrfs is that snapshots are cheap (virtually instant, and consume space only as changes accumulate), and easy to access.  Snapper allows you to automatically create and manage them based on time, events, manual action, etc.

Once snapper is set up you can display a list of snapshots.  I have 10 hourly snapshots, 10 daily snapshots, and snapshots from before/after each emerge.  I can diff them, browse them, etc.  Btrfs snapshots can be browsed right from the filesystem, so if I nuke /etc/passwd I can always do a cp /.snapshots/1875/snapshot/etc/passwd /etc/passwd to restore one from a few hours before (though I do also have /etc in a git repo).

Snapper is currently available in the sunrise overlay – I won’t spend time on how to set that up/etc.  Also, I’ve had time-based snapshots running for a while now and my memory is hazy as to whether I had to do anything to get those working – it just requires sticking some scripts in /etc/cron.*/ and creating a config file containing your policies.

What I did want to post is a recipe for getting pre/post-emerge snapshots working.  All you need to do is add some lines to /etc/portage/bashrc:

case "${EBUILD_PHASE}" in
        preinst) 
                DESC="${CATEGORY}/${PF}"
                NUMBER=`snapper create -t pre -p -d "${DESC}"`
                ;;
        postinst) 
                snapper create -t post --pre-number $NUMBER -d "${DESC}"
                ;;
esac

One of these days I might clean this up a bit and move it to portage.

Written by rich0

November 26, 2013 at 3:52 pm

Posted in foss, gentoo, linux

The Balance of Power in Gentoo

with 8 comments

The recent concerns with the request to re-populate QA have re-opened a debate that is a few years old now. I’ve already made some specific recommendations on the lists, but I wanted to step back and explain why I feel the way I do.

Gentoo’s system of governance has some internal ironies – ones which occasionally even lead to calls to establish a benevolent dictator position. I think the mistake that Gentoo makes is that the problem is perceived as being democracy, when in reality the problem is with competing governance bodies with differing constituencies…

Read the rest of this entry »

Written by rich0

November 17, 2013 at 11:39 am

Gentoo EC2 Tutorial / Bootstrapping

with 4 comments

I want to accomplish a few things with this post.

First, I’d like to give more attention to the work recently done by edowd on Bootstrapping Gentoo in EC2.

Second, I’d like to introduce a few enhancements I’ve made on these (some being merged upstream already).

Third, I’d like to turn this into a bit of a tutorial into getting started with EC2 as well since these scripts make it brain-dead simple.

Read the rest of this entry »

Written by rich0

September 24, 2012 at 10:20 am

Posted in foss, gentoo, linux

A Quick Dracut Module

with 6 comments

Since the general trend on many linux distros is towards requiring /usr to be mounted at boot time, I figured I’d see what it would take to get it working using dracut.

I’ve been messing with dracut for a while, and for some reason it stubbornly refuses to detect my raid devices. The kernel autodetection works fine, but this is disabled when booting from an initramfs. Dracut would timeout and drop me to a dash shell, and if I just typed mdadm -As followed by exit it would boot just fine.

Dracut is using udev to set up raid devices, and obviously that is not working.

Beyond this, I’d like to get my /usr mounted pre-boot, and there is a module called usrmount that purports to do just this. However, it isn’t working in my case because /usr is a bind mount to a subdir on an lvm volume, and it just isn’t figuring that out (it doesn’t even run lvm in the first place despite having the module installed, let alone figuring out what to mount in what order – I suspect the lvm module only works if root is on lvm).

My solution to both problems is to build my own simple dracut module. If you want to try it out:

  1. cd /usr/lib/dracut/modules.d/
  2. mkdir 91local
  3. cat > 91local/module-setup.sh
    #!/bin/bash
    # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
    # ex: ts=8 sw=4 sts=4 et filetype=sh

    check() {
    return 0
    }

    depends() {
    return 0
    }

    install() {
    inst_hook pre-trigger 91 "$moddir/mount-local.sh"
    }

  4. cat > 91local/mount-local.sh
    #!/bin/sh
    # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
    # ex: ts=8 sw=4 sts=4 et filetype=sh

    mount_local()
    {
    mdadm -As
    lvm pvscan
    lvm vgscan
    lvm lvscan
    lvm vgchange -ay
    }

    mount_local

Then run dracut to build your initramfs, and it should let mdadm and lvm auto-detect everything before it gets to mounting stuff. You can then use the fstab-sys to mount whatever you need to mount user. However, in your fstab.sys if you’re configuring a bindmount be sure to prepend /sysroot/ before the source directory.
Example fstab.sys:
/dev/vg1/data /data ext4 noatime,user_xattr,barrier=1 0 0
/sysroot/data/usr /usr none bind 0 0
/sysroot/data/var /var none bind 0 0

Hopefully this helps somebody out – the dracut documentation is pretty sparse. In fact, if somebody connected to dracut stumbles upon this I’d be open to a better way of hooking my script – pre-trigger just doesn’t seem right – I’d rather let udev try to do everything first. However, I couldn’t find any way to hook after udev runs but before it bombs out not finding my root device. Suggestions welcome.

Written by rich0

January 21, 2012 at 4:28 pm

Posted in gentoo, linux

Another MythTV Update

with 11 comments

Agreeing with some advice on gentoo-dev, I’m going to post this as a blog entry instead of a Gentoo news item. The quick version of this update is expect to see 0.24.1 in portage in a few days. The long version follows…
Read the rest of this entry »

Written by rich0

December 14, 2011 at 10:06 am

Posted in gentoo, linux, foss, mythtv

Follow

Get every new post delivered to your Inbox.