| View previous topic :: View next topic |
| Author |
Message |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Mon Dec 17, 2007 8:02 am Post subject: |
|
|
Lovely set of tips from bssteph, which I'm quoting directly (not put in quotes as it makes it harder to read):
Random incomplete tips for the budding Gentoo user:
* Use a breakbox if you can early on, when you're still getting your Gentoo legs. Put it on something you don't care about too much and go nuts. Even if it isn't your only Gentoo box, have that be the one where you try out an overlay, or switching to ~arch, or whatever.
* Don't plow through big updates. My "rule" is as follows: less than a month, unless the package list is huge, emerge -uDN world is safe. Otherwise, do things in parts, if the system is working fine. emerge -uDN cups, make sure that works, make sure everything works with the new glibc, and then (and ONLY then) move on to KDE or the next thing with 20 or so packages to upgrade. It saves a lot of headache, leaves a system with a better chance of being usable after each step, and makes determining what broke much easier.
* NEVER plow through dispatch-conf (or whatever you use to update your config files). If you can't spend time on each config file immediately after an update, making sure you merge the configs correctly, leave it be and don't reboot/restart any related services until you can get to the configs. NEVER reboot with a dispatch-conf run pending.
* Pay attention to every new package and changed USE flag in an emerge -pvuDN world. A new package here means new deps, obviously. Find out if the deps are optional, see if you should perhaps be using a different (new) package to replace that USE flag that just went away. Trust emerge, but never blindly accept it.
* Clean out your world file every now and then, removing packages that are deps of other packages in world, unless you remember wanting that specific package. (That is, unless you were writing code that used it, you probably don't need libpng in your world file, you only want USE="png".) This can clear up funny problems or point you to better alternatives, especially with virtuals. (Example: I had a FAM library in my world file (I don't even remember the name of it) and it would occasionally spin and take 100% CPU in KDE. One day I did some cleaning and let emerge install gamin, which was the default choice for FAM, which turned out to work much better.)
* Use --depclean. Even if you always --pretend it, just do it to get a sense of things. You may not run the --depclean, but you may still identify some packages you can remove. Look for stuff you don't use anymore when poking around in your world file (or the bold items in emerge output, these days).
* Run one of those cruft scripts, or write your own, for older boxes, but by all means, only if you're perfectly comfortable with it. Verify its output before removing anything.
* Look at /var/log/messages every now and again.
If those points worry you or seem wholly unacceptable, this may not be the distro for you. Sorry. It's a tough thing to say, especially without offending, but in my experience, not being mindful of things like the above will just lead to worse problems later. |
|
| Back to top |
|
 |
bssteph l33t


Joined: 26 Feb 2003 Posts: 651 Location: Wisconsin
|
Posted: Tue Dec 18, 2007 12:50 am Post subject: |
|
|
Hah! Very nice, I approve. (I thought while writing that maybe hidden in some unrelated thread isn't the best place for them, but looks like you solved that.) Feel free to clean them up or whatever. There are probably dozens of such little tips/headache avoiders floating around, keep threads like this coming. _________________ Website - All sorts of nonsense (some of it actually Linux related) |
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Mon Dec 31, 2007 1:42 am Post subject: Reinstalling python |
|
|
Great post from delta407 on reinstalling python if you're unfortunate enough to lose it (written *ages* ago and still working in Dec 2007 apparently!):
You might be able to reinstall Python using this:
| Code: | # cd
# tar xzf /usr/portage/distfiles/Python-2.2.1.tgz
# cd Python-2.2.1
# ./configure --with-fpectl --infodir=/usr/share/info/ --mandir=/usr/share/man
# make
# make install prefix=/usr
# rm /usr/bin/python 2>/dev/null
# ln -s /usr/bin/python2 /usr/bin/python |
Hopefully this will be enough of Python to let you "emerge python" again.
---
Another in same thread from desultory: (more recent)
If the python interpreter is actually nonfunctional, as opposed to some mishap with configuration or selection, try the following.
Download the package from the tinderbox repository which matches the architecture of the system. Place that file in $PKGDIR on that system. Then unpack that package directly under /, tar xvjf $PKGDIR/python-2.4.4-r6.tbz2 should do it, though $PKGDIR will likely need to be manually expanded as it is not typically present in the environment. Next ln -s /usr/bin/python2.4 /usr/bin/python. Finally, emerge -K dev-lang/python. |
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Sat Jan 12, 2008 8:29 am Post subject: Using a binhost |
|
|
PORTAGE_BINHOST="http://tinderbox.dev.gentoo.org/default-linux/<arch>"
PKGDIR="/path/to/store"
in make.conf; You can browse from: http://tinderbox.dev.gentoo.org/
PORTAGE_BINHOST="http://packages.gentooexperimental.org/packages/<arch-setup>" is another good one, usually more up to date as Patrick does tinderbox runs.
If you do use these, consider donating some money to help the people who provide the binhosts, or they'll get shut down if they use too much resource. For gentoo, it's solar who runs it: I'm sure any help can just go to Gentoo itself, and for gentooexperimental, it's bonsaikitten who you can find in #gentoo-chat on irc.freenode.org.
You can use update with -g or -G for nice support for binhosts over the web. You can also put binHost=1 or binOnly=1 in /etc/update to do this on every run.
edit: no more html url for dev.gentoo.org
edit2: new gentooexperimental address. 3: browse url
Last edited by steveL on Sun Dec 23, 2012 6:26 pm; edited 4 times in total |
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Sun Feb 03, 2008 8:53 pm Post subject: How to get a package stabilised |
|
|
From this post by Coldwind:
You can look through your package.keywords and spot those that annoy you, then you look if they work fine and have been for at least 30 days in ~arch. If those requisites are met, then file a stabilisation bug. That's an easy way to contribute to make stable tree better ;-)
this applies to anybody who is capable of checking the ChangeLog to see how much time was the ebuild in the tree, search bugzilla for related bugs, and file a bug.
A template bug is something like this:
Product: Gentoo Linux
Severity: Enhacement
Summary: Stabilize foo/bar-1.0
Description:
foo/bar-1.0 is in the tree for X time and works fine on amd64.
emerge --info:
<Paste emerge --info output here>
..or something like that. If the maintainer thinks it's fine to stabilize, he'll CC ATs and they'll stabilize the package, if not, the bug will stay open or closed with LATER.
If bug is closed or ATs are not CC'ed, DON'T TAKE IT AS AN OFFENSE, probably there's a reason for not stabilizing the package yet. |
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Thu Apr 17, 2008 10:29 am Post subject: |
|
|
Here's a one line fn to search for a package in any overlay (blame xenoterracide ;), stick it in .bashrc. NB you need to emerge html2text first.
| Code: | | search() { [[ $1 && $1 != *[[:space:]]* ]] && curl -s "http://gentoo.zapto.org/packages/search?description=$1" | html2text -nobs|awk '/results for query/ { i=1 }; (i && $1 != "[Home]") { print }'; } |
Note that it requires network connectivity and thanks to zapto :)
Last edited by steveL on Thu Apr 17, 2008 11:11 am; edited 1 time in total |
|
| Back to top |
|
 |
XenoTerraCide Veteran


Joined: 18 Jan 2004 Posts: 1418 Location: MI, USA
|
Posted: Thu Apr 17, 2008 10:33 am Post subject: |
|
|
it's all my fault  _________________ I don't hang out here anymore, try asking on http://unix.stackexchange.com/ if you want my help. |
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Thu Apr 17, 2008 11:40 am Post subject: |
|
|
Hehe, yup :)
I like your blogs and the ideas xenoterracide, but don't agree with forking Gentoo. Yeah there are some people in it I can't stand, and I think they do a grave disservice to everyone else, most especially the people who provide the software, but I don't care about them. Hopefully they'll leave me alone (and my /ignore list includes all of them;) and it'd be doing the other 99.99% a disservice to tar them with the same brush.
Hopefully things'll get better once the new Trustees sort out the Foundation, the officers and the finances. I don't really expect them to make much of an impact on the social side (which is under their remit and always has been) until they get that done, and I wouldn't want them to shirk it in any way.
In any event I can just go offline for a bit when I get fed up of the trolls: life's too short to let other people spoil the fun ;P |
|
| Back to top |
|
 |
XenoTerraCide Veteran


Joined: 18 Jan 2004 Posts: 1418 Location: MI, USA
|
Posted: Thu Apr 17, 2008 11:59 am Post subject: |
|
|
| Quote: | | but don't agree with forking Gentoo |
The nice thing is, you don't have to .
Honestly though, I hope it doesn't come down to that. I hope new council/trustees whatever do better, than what has been happening. But something just seem to be in grid lock (in other words the people making the decisions don't seem to care). Like I said though, I hope that a fork isn't the solution.
| Quote: | | I like your blogs and the ideas xenoterracide |
Thanks, hopefully enough like them to actually implement them. _________________ I don't hang out here anymore, try asking on http://unix.stackexchange.com/ if you want my help. |
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Sun Aug 24, 2008 4:20 am Post subject: DEBUG build: the officially approved method ;p |
|
|
Something like this is how we do phase hooks; this is in bashrc, but you can do similar stuff in an /etc/portage/env/cat/pkg file by just using the function and not the surrounding if.
| Code: |
DEBUG_PKGS='sys-libs/glibc some-other/thing'
if hasq "$CATEGORY/$PN" $DEBUG_PKGS; then
pre_pkg_setup() {
local x
for x in installsources splitdebug ; do
if ! hasq "$x" $FEATURES; then
elog "bashrc is adding $x to FEATURES for $PN"
FEATURES+=" $x"
fi
done
if ! hasq -ggdb $CFLAGS; then
elog 'bashrc is adding "-ggdb" to CFLAGS for '"$PN"
CFLAGS="$CFLAGS -ggdb"
fi
}
fi
unset DEBUG_PKGS
|
Many thanks to zmedico for this, and ofc for the excellent package manager that we know and love, which has built every Gentoo system out there ;-)
Bear in mind the earlier post on the first page; I'd use this for supporting libs/apps, and add -g3 (CFLAGS) and -gdb (LD) for stuff we actually follow. wrt splitting, it's not an issue for stuff compiled via gcc (including C++, Fortran..) but would be for any other compilation system afaik. If you're on 32-bit, you'll want to strip -fomit-frame-pointer (it doesn't have any effect on 64-bit aiui) as in the previous post. |
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Sat Sep 06, 2008 1:36 am Post subject: Getting cron jobs to run as a service |
|
|
Running a cronjob as a service which isn't allowed to login will give pam errors. Casshan shows how to use the apache user's crontab:
| Code: | | crontab -u apache -e |
|
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Wed Oct 17, 2012 5:53 pm Post subject: FEATURES="buildpkg" / PKGDIR |
|
|
Make sure you set FEATURES="buildpkg" in make.conf. Portage will then build a binpkg every time it compiles a package, so you can roll-back to any version of anything ever installed on your system (til you eclean the binpkg, or otherwise delete it.) If you do that, you'll never again have a problem you can't recover from using what you've already built.
PKGDIR is the base directory where portage will save packages it builds, (see man make.conf), which defaults to /usr/portage/packages. The packages will be in category sub-directories underneath that.
I use: PKGDIR="/var/pkg" in /etc/portage/make.conf since /var is the namespace for this sort of thing (the directory is root:root, not portage here, as I don't want users to be able to write to it.) So my packages are in directories like /var/pkg/sys-apps.
Obviously you have to make the directory (as root) first:
or:
| Code: | | mkdir -p /usr/portage/packages |
You can also drop packages from binhosts, or set a binhost as above, in the category sub-directory under PKGDIR, should you need to download one to recover with (eg if your backup is bad too.) eg:
| Code: | | emerge -K =sys-apps/gawk-3.1.8 |
See man emerge for --usepkgonly option. |
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Sun Oct 21, 2012 10:32 pm Post subject: Inspecting initscript dependencies |
|
|
Here's what I use to inspect initscript dependencies.
It's my /root/.bashrc but you can stick it into /etc/bash/bashrc or your own ~/.bashrc ofc. I wrote it to be POSIX-sh compliant, so it should work in busybox too (apart from the first line, which is nothing to do with the functions, but just testing that the shell is interactive: a case construct would be used in POSIX sh.)
| Code: | [[ $- = *i* ]] || return
## init.d functions
# you can add other directories (space-separated) in here
readonly INIT_D_DIR='/etc/init.d'
# show a function from initscript/s (and/or glob/s eg 's*')
ifunc(){
local d f r s=$1 fn="^[[:blank:]]*$1"'\(\)' br='[[:blank:]]*\{'
shift
for d in $INIT_D_DIR; do
for g; do
for f in "$d/"$g; do
[ -f "$f" ] || continue
r=$(sed -En "/$fn($br)?/,/^}/{/^}/q;/$fn$br/n;/$fn/{N;n;};p}" "$f")
[ "$r" ] && printf '%s\n%s\n' "$f: $s" "$r"
done
done
done
}
# convenience wrappers for the common funcs
idepend(){
ifunc depend "$@"
}
istart(){
ifunc start "$@"
}
istop(){
ifunc stop "$@"
}
ireload(){
ifunc reload "$@"
}
icheckconfig(){
ifunc checkconfig "$@"
}
# show the functions defined by an initscript/glob, or all if no args
ishow(){
local d f
for d in $INIT_D_DIR; do
if [ "$*" ]; then
for f; do
[ "$f" ] && _ishow "$d/$f"
done
else _ishow "$d/*"
fi
done
}
_ishow(){
grep -H '^[[:blank:]]*[[:alpha:]_][[:alnum:]_]*()' $1 | {
curr=
while IFS=' :' read -r fname func _; do
[ "$curr" = "$fname" ] || {
[ "$curr" ] && echo "${curr##*/}:$f"
curr=$fname f=
}
f+=" ${func%%'()'*}"
done
[ "$curr" ] && echo "${curr##*/}:$f"
}
} |
I knocked the above up while I was updating my udev initscript after the last udev upgrade. I wanted udev to start as soon after localmount as possible, and to do that I needed to inspect the dependency tree. Here are some examples:
| Code: | $ idepend xdm
/etc/init.d/xdm: depend
need localmount xdm-setup
# this should start as early as possible
# we can't do 'before *' as that breaks it
# (#139824) Start after ypbind and autofs for network authentication
# (#145219 #180163) Could use lirc mouse as input device
# (#70689 comment #92) Start after consolefont to avoid display corruption
# (#291269) Start after quota, since some dm need readable home
# (#390609) gdm-3 will fail when dbus is not running
# (#366753) starting keymaps after X causes problems
after bootmisc consolefont modules netmount
after readahead-list ypbind autofs openvpn gpm lircmd
after quota keymaps
before alsasound
# Start before X
use consolekit dbus xfs |
To see what functions are in an initscript, use ishow:
| Code: | $ ishow xdm
xdm: depend setup_dm vtstatic start stop |
And ifunc to see what a script-specific function does:
| Code: | $ ifunc vtstatic xdm
/etc/init.d/xdm: vtstatic
if [ -e /etc/inittab ] ; then
grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab
elif [ -e /etc/ttys ] ; then
grep -q "^ttyv$(($1 - 1))" /etc/ttys
else
return 1
fi |
Note that these take standard shell parameters, so you can check multiple initscripts at a time, eg idepend xdm udev and istart /usr/local/etc/init.d/web*.
They also take globs if you quote them so the shell doesn't expand them as files in the current directory. For example ireload 'sys*' here shows me here that out of sysctl, sysfs and syslog-ng, only the last has a reload function, which is ofc what we'd expect, and what that function does. So the last example above would be better handled by putting the directory in the INIT_D_DIR variable at the top and using: istart 'web*' instead. |
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Sun Oct 21, 2012 10:43 pm Post subject: Viewing an ebuild by name |
|
|
I use this function to quickly look up ebuilds that have come up when I'm running update; sometimes you want to review the actual ebuild itself. It uses the wonderful eix command to find the ebuild that emerge would install, if I don't give a full version. (This is needed because we might not have the package installed, and even if we do, we really want to check whichever version is current, for our configuration.)
| Code: | # vebuild pkgname | cat/pkg | cat/pkg-version
vebuild() {
local f c=${1%/*} p=${1#*/} cp=${1%%-[0-9]*}
if [[ $p != "${cp#*/}" ]] && [[ $1 != "$cp" ]]; then
f=/usr/portage/$cp/$p.ebuild
[[ -f $f ]] && {
echo "$f">&2
if [[ $DISPLAY ]]; then
xdg-open "$f"
elif [[ $EDITOR ]]; then
$EDITOR "$f"
fi
return 0
}
fi
[[ ${FUNCNAME[1]} = $FUNCNAME ]] && return 1
local a=$(eix -e --format '<bestversion:NAMEVERSION>' "$1")
[[ $a ]] && $FUNCNAME "$a"
}
|
edit: Thanks to Swoon for the lovely xdg-open command which makes the above use your preferred gui editor.
Last edited by steveL on Sat Oct 27, 2012 6:01 pm; edited 1 time in total |
|
| Back to top |
|
 |
Swoon n00b

Joined: 21 Jun 2003 Posts: 10 Location: Germany
|
Posted: Thu Oct 25, 2012 7:29 pm Post subject: Re: Viewing an ebuild by name |
|
|
| steveL wrote: | | Code: |
...
kwrite "$f" &
... |
|
I would suggest using kde-open or xdg-open. These programs would trigger the prefered editor, so you can change the editor without changing any scripts. Actually, they open the application that is specified for the file's type. And since ebuilds appear as "text/plain" files, it should open your default editor.
kde-open is part of kde-base/kioclient and xdg-open belongs to x11-misc/xdg-utils (which is a dependency of kdelibs).
I personally have an alias "open" that maps to kde-open. Hence, I can open folders from terminal via "open /etc/", edit files "open file.txt", view images "open image.jpg"… |
|
| Back to top |
|
 |
steveL Veteran

Joined: 13 Sep 2006 Posts: 1706 Location: The Peanut Gallery
|
Posted: Sat Oct 27, 2012 6:11 pm Post subject: Re: Viewing an ebuild by name |
|
|
| Swoon wrote: | I would suggest using kde-open or xdg-open. These programs would trigger the preferred editor, so you can change the editor without changing any scripts. Actually, they open the application that is specified for the file's type. And since ebuilds appear as "text/plain" files, it should open your default editor.
kde-open is part of kde-base/kioclient and xdg-open belongs to x11-misc/xdg-utils (which is a dependency of kdelibs). |
Thanks, Swoon, that was excellent advice: I never knew about xdg-open, and it is perfect: no need to worry about backgrounding as it returns pretty quickly after forking off the editor. Plus it's not tied to a DE :-)
I modded to detect whether under X: it's practically at the stage I can use it in update directly :-) [I'll just change it to use PORTDIR, but I don't want the bashrc function to do any kind of lookup for it.] So thanks again, in that respect.
| Quote: | | I personally have an alias "open" that maps to kde-open. Hence, I can open folders from terminal via "open /etc/", edit files "open file.txt", view images "open image.jpg"… |
That sounds handy. I'd want to alias xopen=xdg-open personally, since I'd rather make it explicit that it's tied to X. (I'm a little bit uneasy about clash with open(2) as well, which has a very different semantic. A command like wait has pretty much the same meaning as wait(2).) Any reason you prefer kde-open to xdg-open? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|