Rich0's Gentoo Blog

Archive for the ‘linux’ Category

Quick systemd-nspawn guide

leave a comment »

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

KDump on Gentoo

with 6 comments

I’ve been trying to learn a little more about kernel debugging (part of my quest to learn a little more about btrfs), and I figured I’d post a quick howto on getting kernel crash dumps captured on Gentoo.
Read the rest of this entry »

Written by rich0

November 11, 2011 at 9:45 pm

Posted in gentoo, linux

First Experiences with the Chrome OS Netbook

leave a comment »

Just got a nice surprise in the mail on Thurs – a CR-48 Google Chrome Netbook! Here are some of my first impressions from it.

I have given Chrome OS a test drive or two over the last year, either in virtual machines or using USB drive packages of it. My impression at that time was that this had some potential, but my experience was fairly marred by the low performance of USB flash or virtual machines, and of course the touted benefits like battery life and fast boot don’t really work out well in that kind of environment.

With the Netbook, those particular features stand out – and they do make a big difference. Granted, perhaps my experience with laptops in general has been marred by my employer’s tendency to load their standard image up with junk, but I’ve never found laptops to be “instant-on” in real life, and they struggle with battery life. With Chrome OS I tend to just let it sleep most of the time and I get real instant-on, and if I do power it down the 10 second boot time is VERY realistic – perhaps even pessimistic. Login time – oh, about two seconds. I haven’t tested the full battery life though others have – in my heavy use in the last few days I haven’t gotten the thing under about 85%.

Since I use Chrome as my day-to-day browser I basically was up and running about two minutes after turning the thing on. This is touted as another benefit of Chrome – any device is basically interchangeable with all the cloud syncing. I could see this being useful for an employer – just have a pool of laptops and let employees grab one and use it, rather than having a 1:1 assignment. Provisioning new units of course would be a snap as well.

Performance of the unit is fine – a few webpages that run slowly in Chrome on my desktops run slow on the netbook, but really I see nothing to complain about here.

So, let’s talk about the downsides to the hardware. I’ve always struggled with trackpads. This one doesn’t have hardware buttons, it is purely gestures, and it has two levels of sensitivity (though I’d appreciate if the hard-press required SLIGHTLY less force). I’ve disabled tap-to-click, as perhaps I’m ham-handed, but I find that I constantly bump it and mess up whatever I am typing. Perhaps some intelligence would help here – ramp down the sensitivity when I’ve just typed 500 consecutive characters with no mouse use (hmm, maybe this is a good use for that send-feedback button). Without a hardware button to hold, click-and-drag is difficult except for very short drags, and that complicates things. Also, I’ve found the right-click and middle-click gestures to be unreliable, sometimes causing navigation I don’t want to happen which of course tends to slow me down and possibly lose work.

Click-and-drag is a problem for me, because of the way I manage email. I am a big Thunderbird user, and I used to use SquirrelMail for those times I needed remote access via the web. I just switched to Roundcube which is a little nicer if you have to live with nothing but web, but that app is short on keyboard shortcuts (sounds like another feature request coming on – n for next would be nice, and a delete shortcut as this thing has no DELETE key). I have been browse over search kind of guy with emails for years, and I’m finding that sorting mail into folders with this netbook is pretty painful. I suspect that I’ll need to change over to more of a search mentality to cut down on my need to browse. Gmail really is a better model for limited UI experiences, and I’m wondering if much of that time I spend micro-managing my email is a value-add.

I’m still on the fence about drinking the cool-aid and switching to Gmail entirely, at least as my primary mail interface (perhaps with an archive being sent to my server for safety). Right now I’m hosting my own email, and I really like not having to deal with quotas/etc, and the security of not having it all out on the cloud. I guess if I want to be really trusting I may be able to just have Gmail be an IMAP client to my server. It would be really nice if I could figure out a way to easily just have an IMAP-only password for my account – I’m sure with a little hacking I could get that working, and my email is backed up daily so not too much could go wrong there.

Right now the number of apps that work offline is fairly limited – mainly just notepads/etc. For the most part I’m using my Cr-48 around the house, which doesn’t make that a big problem. In fact, it is pretty rare for me to be completely without network, and my android phone really covers those kinds of remote situations well already. The Cr-48 does have 3G with Verizon, with 100MB free per month for two years. I’m not sure how much I’d even need to use that, but this really would be all I need for the rare email check on the road.

App selection for Chrome is still pretty limited. I’d really like to see:

  • Offline Email Client
  • NX Client
  • SSH Client (better than the crosh one which works in a pinch)
  • Offline Google Docs (ok, now I’m dreaming)
  • Decent Media Player and File Browsers for external storage

One thing I have found is that you really need to use it for a day or two before passing judgment. Some of the things that drove me craziest passed as I got used to doing things differently. However, I’m still not sure I’m ready to do away with home/end/pgup/pgdown/delete (I never use insert).

I’m sure there will be more to follow. I’d be interested in the impressions of others as well.

Written by rich0

December 18, 2010 at 8:41 am

Posted in chrome, linux

Control Over Application Distribution

leave a comment »

I was giving some thought to something that flameeyes wrote regarding quality control and application distribution, and rather than a condensed comment I thought I’d elaborate a little on my thoughts.

Before reading on, I’d encourage you to read what he wrote, as I think he gets a lot of things right.

However, where I’d like to add something is where we get into providing a complete platform vs providing a particular user experience built on a platform. What is the difference? Well, let’s take android as an easy example.

Android is a platform, which is open source, although developed arguably in a less than open manner. The Google branded phones are a particular user experience built on the Android platform. There is a certain tendency for users to confuse the two, which is what leads to shouts of “foul” when Google does something to their Market.

The Google Market is not part of Android, so in a sense their control over the Market is part of improving the user experience, and doesn’t reflect a lack of openness on the platform.

The problem with this is that if you look at the platform as ONLY being Android, then the platform turns out to be fairly lacking. Android actually has no package distribution and management system at all. That means that absent the Market all you have is some odd 3rd party clones of the market or the ability to do a one-time install of apks from a website/etc, none of which are really filling the need for a package manager.

How do other platforms handle this? Well, let’s look at Ubuntu, which delivers both a platform, and a default user experience built upon it. In their case, the user experience is really nothing more than a particular default configuration of the platform. In Ubuntu (and most popular linux distros, certainly including Gentoo) the package manager is part of the platform – not the experience. The package manager is open source, and while Ubuntu controls access to their repository, they do not control the package manager. If users want to use another repository (or create their own) they need only add a URL to their package manager, and the new repository gets seamlessly merged into the package database – perhaps with even greater priority than Ubuntu’s official repository if so configured.

If Google’s market operated in the same manner, then it would be part of the platform, and the experience is the quality assurance they provide to it. I think we’d see fewer complaints in this case. The problem is that Google does not allow users to configure their market to include apps published from alternate sources, which means that since Android doesn’t provide a package manager that users effectively have no way to address this capability gap.

Then if you look at the fact that many phone distributors disable parts of the platform, such as the ability to install apps via sources other than the market, you compound the issue.

I see the situation with mozilla in the same way. As long as a mozilla product user can install an extension from any number of sources and receive automatic updates of this extension, then I have no issue with mozzila providing a default experience that has a level of QA. If, on the other hand, mozilla designs their products so that you can only install extensions from their site, or only extensions from their site receive automatic updates/etc, then they’re essentially limiting their platform to intentionally constrain users to have a particular experience.

This is a debate that has also raged on the Gentoo mailing lists. Different people have different attitudes towards QA, and as a result we have a plethora of overlays in Gentoo that provide levels of QA that are different from the official policy. This has the downside of fragmenting development work, and the upside of taking advantage of the flexibility of the platform.

What do you think? What is the best way to provide the best of both worlds? How can a platform provide a “just right” level of QA filtering appropriate for every end user?

Written by rich0

July 20, 2010 at 10:57 am

Posted in linux

Follow

Get every new post delivered to your Inbox.