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

2012/08/25

Into the Box

Mounting a box account as a file system on gentoo - as root:
  1. unmask net-fs/davfs2-1.4.7 in portage
  2. emerge -av davfs2
  3. gpasswd -a ${your_user} davfs2
  4. mkdir -p /dav/${your_user}
  5. chown ${your_user}:${your_user} /dav/${your_user}
  6. echo 'https://www.box.com/dav /dav/${your_user} davfs rw,user,noauto 0 0' >> /etc/fstab
Then as ${your_user}:
  1. mkdir -p ~/.davfs2
  2. echo "https://www.box.com/dav ${box_username} ${box_password}" >> ~/.davfs2/secrets
  3. chmod 0600 ~/.davfs2/secrets
  4. echo "use_locks 0" >> ~/.davfs2/davfs2.conf
  5. mount /dev/${your_user}
The output from from df is wrong, but whatever... from the davfs2 README:

- If the server does not support RFC 4331 (most servers don't), davfs2 cannot
  calculate the free disk space on the server. ... So davfs can't help but lie. I tried to
  make the numbers look funny, so you will notice they are faked.

2011/11/13

LXC through the looking glass

Checklist for an lxc gentoo (taken from a pre-existing image) container hosted on gentoo:
  1. Start with Diego's static device tarball (to avoid TIOCSCTTY "open /dev/tty failed errors" "could not set controlling tty" from sshd)
  2. To see boot up messages and avoid warnings from /etc/issue add: mknod -m 600 console c 5 1
  3. Remove udev and all other not-relevant services (/etc/runlevels)
  4. The container config should have: 'lxc.tty = 12' and 'lxc.pts = 128'
  5. The container fstab should not have a /dev/pts devpts mount (cf newinstance mount option)
  6. Stop the guest init from running gettys as required.

Then all that is needed is:
  1. lxc-start -n konuk
  2. lxc-console -n konuk
  3. lxc-stop -n konuk

Debug

Useful for debugging are:
  1. List running processes in the lxc: pstree $(lxc-info -n sakc1 --pid | awk '{ print $2 }')
  2. The guest container log when the guest is started with: lxc-start -n konuk -l DEBUG -o /tmp/lxc.log
  3. The guest /var/log/auth.log (configure sshd to report to it - /etc/ssh/sshd_config)
Cherrypick patch from the staging lxc on github:

--- lxc-ps_orig    2012-11-21 21:19:11.000000000 +0000
+++ lxc-ps      2013-01-20 22:24:32.000000000 +0000
@@ -56,7 +56,8 @@
                init_cgroup=${fields#*:}
 
                # Get the filesystem mountpoint of the hierarchy
-               mountpoint=$(grep -E "^cgroup [^ ]+ [^ ]+ ([^ ]+,)?$subsystems(,[^ ]+)? " /proc/self/mounts | cut -d ' ' -f 2)
+               mountpoint=$(awk -v subsysregex="(^|,)$subsystems(,|\$)" \
+                           '$3 == "cgroup" && $4 ~ subsysregex {print $2}' /proc/self/mounts)
                if [ -z "$mountpoint" ]; then continue; fi
 
                # Return the absolute path to the containers' parent cgroup

fstab

sysfs needs to be mounted so that the net scripts can see the various network interfaces are present - they check for entries in: /sys/class/net

Add to the container fstab (note: localmount may not run):

...
sysfs                   /lxc/konuk/sys                  sysfs   defaults 0 0
...

The symptom is:

 * Bringing up interface lo
 *   Caching network module dependencies
 *   ERROR: interface lo does not exist
 *   Ensure that you have loaded the correct kernel module for your hardware
 * ERROR: net.lo failed to start

2011/10/30

Nesting X

The Xephyr kdrive X server for running a more development oriented X11 window manager (xterm's) inside another environment (e.g. kde). For gentoo setting the kdrive use flag will cause Xephyr to be built.

#!/bin/bash
# kde system-settings->keyboard settings->advanced->Alt/Win key behaviour->
#   -> Meta is mapped to Left Win
nest_display=${1:-":7"}
geometry=${2:-"1915x1150"}

nohup Xephyr -ac -screen $geometry -nolisten inet6 $nest_display &

sleep 2

export DISPLAY=$nest_display

delayed()
{
    xrdb ~/.Xdefaults
    setxkbmap ie
    xmodmap ~/.xmodmap
}

(sleep 7; delayed ) &

# -s : only manage the specified display (DISPLAY)
exec tvtwm -s

2009/04/28

push the button Max, err Gunther

Why did I want this in the first case? - but anyway, it seems to work by:

1. Following the tip

2. Download tweetdeck or just:
wget http://www.tweetdeck.com/beta/TweetDeck_0_25.air

For 26.4 (8 July 2009) this changed to:

http://downloads.tweetdeck.com/TweetDeck_0_26.air
3. Running the app with (note slight typo fix for app directory to tip in #1):
/opt/AIR-SDK/bin/adl -nodebug /opt/AIR-apps/TweetDeck_0_25/META-INF/AIR/application.xml /opt/AIR-apps/TweetDeck_0_25
It complains about:
I/O warning : failed to load external entity "/etc/opt/Adobe/certificates/crypt//config.xml"
Unable to parse Document: /etc/opt/Adobe/certificates/crypt//config.xml.
But otherwise appears to run, just with lots of warnings like:
warning: unable to bind to property 'tTextHTML' on class 'Object' (class is not an IEventDispatcher)
warning: unable to bind to property 'tSource' on class 'Object' (class is not an IEventDispatcher)
warning: unable to bind to property 'tUserID' on class 'Object' (class is not an IEventDispatcher)

2008/06/08

Get Smart

smartmontools is a good thing -
  • smartctl -a /dev/sda (dump all the SMART info on the disk)
  • smartctl -t short /dev/sda (run a short self test)
  • smartctl -t long /dev/sda (run a long self test)
  • smartctl -l selftest /dev/sda (list the available self test results)
  • smartctl -s on /dev/sda (to turn on SMART if its not on by default)
Running one long test a week is the suggestion here:
0     8      *   *     0     smartctl -t long /dev/sda >>/var/log/smart.log 2>&1
0 9 * * 0 smartctl -l selftest /dev/sda >>/var/log/smart.log 2>&1
Setting:

SMARTD_OPTS="--interval=3600"

in /etc/conf.d/smartd is the only non default setting I made (for a laptop).

Funnies:
  • One disk didn't have SMART enabled (all the rest did...)
  • One (other) disk didn't list self tests in progress
  • RAID confuses SMART on two servers I tried it on (a test started on one side of a mirror showed up on both

2008/01/03

gentoo recovery

gentoo based rescue disk options - the lwn distributions page is a good starting point:
  1. sabayonlinux - appears to be kept up to date & comes in a mini-edition
  2. the official 2007.0 gentoo live CD is getting on a bit now (SATA) [update 2008.0 beta]
  3. the liveusb path is paved with bitrot.
  4. flashlinux from 2005.
  5. gnap - catalyst based...
  6. sysresccd - catalyst based... USB install instructions look good (and is what I used in the end)
  7. linux-live is a possible for pre-686 hardware
other random reading:
  1. lwn has a good/scary article on gentoo for developers
  2. paludis vs portage article
  3. random blog posts sometimes pertaining to gentoo; drobbins blog

2007/12/02

The hunt for AFK's

qcheck(1) is the key to looking for inconsistencies between what portage installed and a live system: qcheck -aTC

or with nice colour: qcheck -aT

Filtering out python, ... etc false positives (AFK appears to be qcheck code for missing files):

#!/bin/sh
DATE=`date +%Y%m%d`
OUT=${DATE}.log

qcheck -aTC >$OUT 2>&1

filter='/usr/lib/python2.4|/usr/lib/gimp/2.0/python|\
/usr/share/javatoolkit/pym|\/usr/kde/3.5/share/doc|\
/usr/share/icons/hicolor|/usr/share/webapps/phpmyadmin'

grep AFK $OUT | egrep -v $filter | sort >${DATE}-afk.log
grep MD5-DIGEST $OUT | egrep -v $filter | sort >${DATE}-md5.log

Slowly going faster

An old/slow gentoo box:

/etc/conf.d/rc:svcmount="yes"
sticks the service deps into a tmpfs

Filesystem Size Used Avail Use% Mounted on
svcdir 2.0M 188K 1.9M 10% /var/lib/init.d

Any speedup isn't noticable, but its one step closer to running root fs out of a pseudo-SSD
(pcmcia memory card adapter + old SD card). Going ro is painful from quick glance.

Anyway usage rises to 344k on a reasonably well configured box, so 2MB is fine.


tmpfs is a real gain for emerges with an fstab including:

shm /dev/shm tmpfs noatime,size=4G,nr_inodes=200k 0 0

and linking /var/tmp to /dev/shm - 4GB is comfortable for building openoffice.