with cache.actiongroup(): # apt.Cache 'cache'
for package in my_selected_packages:
package.mark_install() # New PEP 8 names, previously named markInstall()
Posted in Debian, Ubuntu 
I've had a few enquiries from my blog post
about trying to control dumb USB-powered lights.
I thought I'd just write something up to save myself replying to any more
emails.
Yes, it's doable. Finding a USB hub that will do it is another story. From
my own research, I found someone else who was doing something with
USB-powered devices (I can't remember what now), and he had been using
a what is now a Linksys
ProConnect USB 4-Port Hub USB 2.0
I'd first tried a couple of random cheap hubs from Fry's with no success
(fortunately I was able to return them) before I determined that the Linksys
one would definitely work. The downside of the Linksys hub is it requires
external power. It was also one of the more expensive USB hubs on the
market.
One of my co-workers, who is an Electrical Engineer by education, said that
the USB spec requires the functionality that I wanted, but most chip
manufacturers had cut a corner in the interests of cost saving. The Linksys
hub uses an NEC chipset. Every other hub that I could get my hands on had a
Genesys Logic chipset, and did not work. You can tell if you've got a winner
by the output of lsusb -v. If the hub characteristics include
"Per-port power switching", you're in business.
To do the actual port powering on and off, I'm using a setuid-root hub-ctrl,
wrapped with a small shell script, which has the USB ID of the hub and the
port number the lights are plugged into hard-coded in it.
In my searching, I found also that it may
be possible to do with Python, but I did not invest the time trying to
find out.
In the spirit of Thomas Limoncelli's Time Management for System Administrators, this is my checklist for setting up a new Debian system. I have added a few notes to the original list to justify their existence and to provide some background information.
Whilst you should avoid performing repetitive interactive configuration and defer to the multitude of tools designed for this task, constructing and sharing a checklist can still be an instructive step. It can also be useful in situations where a machine has already been partly configured for you.
/etc/apt/sources.list
Disable installation of Recommends:
echo 'APT::Install-Recommends "0";' > /etc/apt/apt.conf.d/90recommends
Ensure we are up to date security-wise:
apt-get update && apt-get dist-upgrade
Setup and configure locales first to avoid annoying Perl warnings. Don't choose All locales; you almost certainly don't want that.
apt-get install locales dpkg-reconfigure -plow locales
Install some essential utilities:
apt-get install vim-nox ntp openssh-server screen most tree bzip2 unzip moreutils dnsutils htop pwgen telnet manpages manpages-dev vrms acl gawk strace curl tcpdump
Before we create any real users, we configure PAM to reject weak passwords. Custom banned passwords can be added to the dictionary by editing /usr/share/dict/cracklib and running update-cracklib.
apt-get install libpam-cracklib sed -i -e 's ^password # \0 ' /etc/pam.d/common-password echo 'password required pam_cracklib.so retry=3 minlen=6 difok=3' >> /etc/pam.d/common-password echo 'password required pam_unix.so use_authtok nullok md5' >> /etc/pam.d/common-password(Edit: Please read this response from Steve Langasek regarding this modification on squeeze and Ubuntu 8.10)
Configure sudo. I prefer to create a new group instead of re-using adm as that is already used by logfiles.
addgroup rootusers adduser myuser adduser myuser rootusers apt-get install sudo echo 'User_Alias ROOTUSERS = %rootusers' >> /etc/sudoers echo 'ROOTUSERS, root ALL=(ALL) ALL' >> /etc/sudoers
First, install the mail packages:
apt-get install exim4-daemon-light bsd-mailx dpkg-reconfigure exim4-config
During the Exim configuration, choose Internet site and follow all the defaults, ensuring that you only listen on 127.0.0.1 and you are not relaying mail for any other domains.
We then configure forwarding to another email address so we don't have to continually poll this machine for issues:
echo 'root: you@example.com' >> /etc/aliases newaliases
Finally, we test mail delivery:
echo "Test 1 from $(hostname)" mail root -s "Test 1 from $(hostname)"
Stop Emacs creating backup files everywhere:
mkdir -p /etc/emacs/site-start.d echo '(setq backup-inhibited t)' > /etc/emacs/site-start.d/10no-backup.el
Configure Munin:
apt-get install munin-node echo 'allow ^123\.123\.123\.123$' >> /etc/munin/munin-node.conf /etc/init.d/munin-node restartFor baroque network configurations, you can generate the regular expression line with this script.
Configure molly-guard, a tool for preventing accidental shutdowns. As molly-guard cannot detect shutdowns initiated within a combination of GNU screen and SSH, we configure it to always query the hostname:
apt-get install molly-guard echo "ALWAYS_QUERY_HOSTNAME=true" >> /etc/molly-guard/rc
Monitor disk S.M.A.R.T. attributes:
apt-get install hddtemp smartmontools sed -i 's ^#start_smartd=yes start_smartd=yes ' /etc/default/smartmontools /etc/init.d/smartmontools start
Setup backups - I'm quite partial to backupninja because it automates most of the tedious SSH configuration. I adjust the time of the backup to when I'm likely to be around to fix issues and cut down on email noise by not reporting successful backups:
apt-get install backupninja hwinfo debconf-utils rdiff-backup sed -i -e 's ^when = everyday at 01:00 when = everyday at 9:30 ' /etc/backupninja.conf sed -i -e 's ^reportsuccess = yes reportsuccess = no ' /etc/backupninja.conf ninjahelper
Filesystems
Reboot. You should be prompted by molly-guard before your computer restarts.
So, the latest buzz on the web is all about Google Wave. I would urge everyone developing stuff for the Internet and technological people depending on the Internet for their daily work, to watch that introductory video. The concept is frankly mind-blowing. If this is done right and embraced by all the right people, Google Wave could be the new platform concept that could be used to create new generation of email, instant messaging, collaboration software (CMS, wiki, Sharepoint, workflow, ), blogging software and forum software and do all that while integrating back with current technologies, like Twitter and RSS feeds.
It remains to be seen what parts will be open source and federated and what parts will remain Google-only services. For example, I am convinced that Spelly the spellchecker bot and Rozy the automatic translation bot will be hard to impossible to federate. This being Google, it is practically a given that the code will be good, but a bit hard to understand and contribute to. Management of the free software community and proprietary community relations will likely be the key to the success of this technology.
I love the technology itself - imagine that you have a web blog. The blog software makes each your blog post a wave. When people leave comments on the post, these comments show up in your email inbox. You can reply to people right from there. By default your replies will show up on your blog and also show up in the email inboxes of the commenter, but you also have the option to mark your reply private and only send it to the commenter. Also it looks to be possible to choose to host all the data yourself or to make Google host all your blog and comment data and make your blog just be a frame where this data is displayed in, possibly allowing you to use very, very minimal system resources to maintain the blog even in a case of Slashdotting. I hate blogs without comments, let s replace them all.
I would also love to see replacements to Microsoft Exchange and Microsoft Sharepoint be built using Wave technology with a full support to ODF if possible. Imagine collaborative document editing in OpenOffice using this technology in the backend. It would be one huge project, but it should be possible. Companies currently pay hundreds of thousands of dollars to set up MS Exchange+Sharepoint+Active Directory to be able to simply share documents in their Intranet and see who edited a document (no live editing, no change tracking). It is possible to make a much better product with ODF and Google Wave and it is possible to earn a bunch of money supporting such a product for companies that need support contracts. If it would be possible to licence spellchecking and translation services from Google in a way where a box is installed in customers data centre and the data to be spellchecked and translated never leaves that data centre, then I believe that people would be willing to pay for this superior spellchecking and translation experience.
We need open source products that people can depend on. We also need ways for business people to sell services with an easily visible added value so that they can make money and contribute their developer work hours back to the open source projects. We (the free software community) have great ways to get a positive feedback loop with users that can develop software, but when our users have no interest in developing anything, the feedback loop breaks and free software growth slows down. There is a lot of untapped potential in this area - we just need to find a way to convert needs and demands of non-developers into code.
I m gonna stop this rant before it diverges even further off topic, but the main point is - go watch the Google Wave demo, read the tech specs and think how you could integrate that into your free software project.
Useful wave discussions (will update as I find more):
An old friend is ranting about localization.
I first considered not really reaction to Joey's post, mostly because
he has very true points...and particularly when he has about the same reaction than mine about a recent post in ou mailing lists.
So, I will stick to react to one part of Joey's post...the one I consider really inaccurate.
"everyone uses the software in English anyway"
Really, Joey, really, that's completely untrue.
Of course, I do live in a country that very well known (or at least that has the reputation) for being deeply ignorant in English language. But, really....*all* computers I see around me, both in my personal life *and in my professionnal life* are nearly completely localized.
It's probably now well know that I spend most of my professionnal
time....providing desktop systems (or managing the people who provide
them) to users in ONERA, "the French Aerospace Lab". That means about 2000 users in a scientific environment where the use of English is much more developed than the average environment. Most of these users speak a fairly decent English and are perfectly able to understand that language in some way.
About 80% of these systems are Windows-based and 20% are
Linux-based. Probably more than 95% of them are localized in
French. Even on Windows systems, we mostly integrate free
software. And for *each* of them, the most important feature we need,
besides software being free, is it to be localized in French.
I bet our friends from Extremadura can say the same. The success of Linux-based free systems there also happened because the software is available in Spanish. And, of course, there are tons of similar stories and counter-examples (M nchen, Bhutan, Venezuela, etc.).
So, really, please don't spread out that idea. Oh, yes, geeks *do* use their software in English (and, even here, I need to be convinced if I remember well what I saw at conferences in Germany or Spain, for instance). And, yes, it's very well widespread among geeks that using software in English is "better" or "easier". Which I indeed always fight and will fight until I die..:-).
We certainly agree that these l10n needs put a high load on
development and sometimes slow it down. and, for sure, we sometimes
need to make a balance and I really thank you for giving me the credit
to try doing that balance.
Anyway, all this (including your rant) had to be said and it's
interesting to have that small discussion (I just should not start writing down a blog entry at 23:00...:-))
See you soon, hopefully, Joey !
Last night, I heard a Spanish pun that I particularly liked, having to do with my sister s dog, Shorty who is an odd creature (being a mix of Pit Bull, which is for certain, and legend goes, Chihuahua) will be as of the end of the day > sinbolico. I bet the Spanish speakers know what is happening to Shorty today. Anyone want to take a guess?
Puns, I would say, represented a human being s pent-up need for ambiguity. That a word could signify two things at once! And these double meanings could be simultaneously understood! What a relief from the flat-line understanding of a programmer s conversation with the machine! p. 59
Last night, I heard a Spanish pun that I particularly liked, having to do with my sister s dog, Shorty who is an odd creature (being a mix of Pit Bull, which is for certain, and legend goes, Chihuahua) will be as of the end of the day > sinbolico. I bet the Spanish speakers know what is happening to Shorty today. Anyone want to take a guess?
Puns, I would say, represented a human being s pent-up need for ambiguity. That a word could signify two things at once! And these double meanings could be simultaneously understood! What a relief from the flat-line understanding of a programmer s conversation with the machine! p. 59
This weekend I implemented an idea I had some weeks ago: sending regular mails with the translation status and the contents status of debian-edu-doc to the Debian Edu mailinglist, in the hope this would motivate people to finish the documentation and its translations. Currently the package contains four different manuals, translated in up to 6 languages: the old Debian Edu etch manual, the new Debian Edu lenny manual and manuals for teachers using Rosegarden and Audicity. All four are being written on wiki.debian.org, then exported to Docbook, then .po files are created with the great po4a tool suite. Those .po files are kept in svn of the the debian-edu-doc package, for translators to edit. Detecting missing or half finished content is done by putting the string "FIXME" plus a description what to fix in the wiki text. Then a small script is run by cron every 2nd and 4th sunday of the month, which outputs the translation status and greps for FIXME and formats this nicely. The result looks like this: The (translated) debian-edu-lenny manual as PDF or HTML is available at http://maintainer.skolelinux.org/debian-edu-doc/
To understand this mail better, please read /usr/share/doc/debian-edu-doc/README.
This mail is automatically send by a cronjob run by Holger Levsen every two weeks. Please send feedback, suggestions, flames and cookies via this list.
debian-edu-lenny-manual.de.po: 545 translated messages, 193 fuzzy translations, 220 untranslated messages.
debian-edu-lenny-manual.es.po: 85 translated messages, 204 fuzzy translations, 669 untranslated messages.
debian-edu-lenny-manual.fr.po: 447 translated messages, 279 fuzzy translations, 232 untranslated messages.
debian-edu-lenny-manual.it.po: debian-edu-lenny-manual.it.po:7683: end-of-line within string
debian-edu-lenny-manual.nb.po: 711 translated messages, 159 fuzzy translations, 88 untranslated messages.
----------------------------------
http://wiki.debian.org/DebianEdu/Documentation/Lenny//Features
FIXME: describe new features in 5.0.1+edu0 here.
----------------------------------
http://wiki.debian.org/DebianEdu/Documentation/Lenny//Requirements
FIXME: a description of main-server and thinclient-server is missing.
----------------------------------
http://wiki.debian.org/DebianEdu/Documentation/Lenny//Installation
FIXME: probably each paragraph on this page needs to be (slightly) rewritten for lenny.
FIXME: describe PXE installation here, if its only two sentences, then they should be here.
FIXME: path to preseed file location missing
----------------------------------
[...]
====================
24 FIXMEs left to fix
====================
Whilst working on update-manager I have been wondering whether I should use gettext for localizing debug output and error messages sent to stderr.
As I promised to keep you updated on recent developments on update-manager I am writing this article. Just as a disclaimer: I am not going to write about any recent developments here, but would rather like to point at a piece of code I added to update-manager that could be useful in other applications too.
Now, as the title suggests there are sphinx-aware Enums in update-manager. Enums are common constructs in other programming languages like C and allow simple creation of constants with, for example, ascending values (first constant has value 0, second has value 1 and so on). Python unfortunately does not include support for Enums itself, but I found it rather easy to write classes that emulate such a construct.
Nothing is new about Enums in Python and there are probably quite a few different implementations out there, but I believe mine is different. The sphinx-aware part means that my implementation automagically updates the docstrings of the created instances and thus allows sphinx autodata method to include sensible information in generated API documentation.
I could go on writing about and praising my method, but I believe a short example gives you a better idea how my implementation works and what I wanted to achieve with this. Have a look at this page, which is part of update-manager s new API documentation. You should see rather well-looking documentation of the UpdateManager.Backend.RELOAD_CACHE_STATUS NegativeEnum, the defined constants, their values and some additional information about each value now.
Still, nothing too fancy, HTML documentation generated from docstrings. What makes this special is the code from which it was generated:
RELOAD_CACHE_STATUS = NegativeEnum( BEGIN = "Started reloading package cache", DONE = "Finished reloading package cache")This not only gives us a RELOAD_CACHE_STATUS enum, along with the RELOAD_CACHE_STATUS.BEGIN and RELOAD_CACHE_STATUS.DONE, but also some documentation, included in RELOAD_CACHE_STATUS docstring, that can be used by sphinx. You can find the Enum code, which is rather short and should be quite easy to understand, here. I hope you find this code as useful as I do.
ADD 1 TO KIBI.2.49
(release logs)
finally got uploaded to unstable. Screenshot follows:
Now being an official Debian developer I ve the possibility to use $DEBEMAIL=mika@debian.org for my Debian packages. But whereas I want to use that for all my official Debian packages I still want to use $DEBEMAIL=mika@grml.org for my grml related packages. I m a lazy sysadmin and don t want to manually adjust my changelogs depending on the type of package (especially since this might be error-prone) so I needed a generic solution. Grml s Zsh configuration (Debian package grml-etc-core >=0.3.71) provides a solution for Zsh (version 4.3.3 or later): based on directories you can set your own profiles. Demonstration:
% cd /grml/git-grml chpwd(): Switching to profile: grml % echo $DEBEMAIL mika@grml.org % cd /grml/git-debian chpwd(): Switching to profile: debian % echo $DEBEMAIL mika@debian.orgThe configuration is pretty simple:
# define profiles based on directories: zstyle ':chpwd:profiles:/grml/git-grml( / /*)' profile grml zstyle ':chpwd:profiles:/grml/git-debian( / /*)' profile debian zstyle ':chpwd:profiles:/home/mika/Customers( / /*)' profile customers # configuration for profile 'grml': chpwd_profile_grml() [[ $ profile == $ CHPWD_PROFILE ]] && return 1 print "chpwd(): Switching to profile: $profile" export DEBEMAIL=mika@grml.org export GIT_AUTHOR_EMAIL="mika@grml.org" export GIT_COMMITTER_EMAIL="mika@grml.org" # configuration for profile 'debian': chpwd_profile_debian() [[ $ profile == $ CHPWD_PROFILE ]] && return 1 print "chpwd(): Switching to profile: $profile" export DEBEMAIL=mika@debian.org export GIT_AUTHOR_EMAIL="mika@debian.org" export GIT_COMMITTER_EMAIL="mika@debian.org" # configuration for profile 'customers': chpwd_profile_customers() [[ $ profile == $ CHPWD_PROFILE ]] && return 1 print "chpwd(): Switching to profile: $profile" export TELEPHONE=[...] export MAIL=[...]Kudos to Frank for implementing this lovely feature in grml s zshrc. Look for chpwd_profiles() in grml s zsh config for further documentation on this feature.
Next.