I took the chance over dinner to chat with the small group of
locals, especially Axel Beckert
who had some interesting stories about Fedora, Opera and other
groups.
On Sunday, we started slightly later but probably had a more
productive day in terms of the number of bugs closed. I fixed some
silly FTBFS issues in ser:
#384772
and #390008
were both caused by the build system assuming i386/amd64 compiler
options. I adapted patches suggested by Julien Blache from his own
work on openser (thanks!) and tested on my sparc and hppa systems at
home. Job done...
For the rest of the day, I used the time to work on remaining bugs
in my own packages. Both CVS and debian-cd needed new uploads to be
ready for the Etch freeze. CVS had a bucket-load of new translations
following Christian Perrier's call, and debian-cd had a large number
of bugs that had already been fixed in svn for a long time. Between
those 2 uploads (and some other old bugs in debian-cd that needed
reviewing) that made another 17 bugs fixed, although none of them were
RC. Once those uploads were done, I continued on with my debian-cd
multi-arch development work.
On Sunday evening, we went into the middle of the old city centre
in Zurich to a more traditional Swiss restaurant. Several of Martin's
colleagues from the lab joined us, and we had some widely varying
conversation, ranging from Debian (of course! *grin*) to gossip in the
lab via lots of other topics. Due to my ridiculously early flight home
on Monday morning we couldn't stay out too late nattering, but
nonetheless all the people seemed to enjoy themselves.
The Swiss group were a fair bit quieter then the Dutch the previous
weekend, but seemed just as committed to getting work done and getting
Etch out on time. It was lovely to meet and spend time with them, and
I've promised to go back and visit again soon. Until then, I've put my
small selection of photos
online.
I: It randomly freezes. The harddrive seems fine, and memtest86+ also ran fine. He: Please run the diagnostics tool. I: I don't have that installed. [I did not mention that I do not run Windows, but mumbled something about it being a university installation and that I cannot install the tool] He: Hm, okay. So it's not the hard drive and it's not memory, so there's not much left. I'll have a local technician get in touch with you tomorrow.Not more than 10 minutes later I had arranged for a replacement. And this was not the first time I came out of an IBM/Lenovo support call with a good feeling. Thanks! NP: Porcupine Tree / XMII

Our itinerary for tonight
We'll be carrying a few forehead lights and a bicycle light, and will really
hope that the sky isn't cloudy at all. We're really going to need the
moonlight. The route follows the national road from Sagunt to Teruel, through
an old train track which was turned into a cycling path. Most of the trip will
be descending, so covering the 150 kilometres shouldn't be too hard, except
that neither of us are specially trained now, unlike 3 years ago. If we end up
having to stop and sleep, that's going to be a problem as we are carrying no
sleepingbags or anything, just our winter cycling clothes. We pretend to take
our time, aka most of the night, to get to our destination, as we obviously
won't be able to cycle fast in the dark. But we'll manage. This is just crazy,
not impossible. :)
netstat -nap on the machine concerned, to check for listening processes, and nmap from remote hosts to sniff for open ports.
Portmap and its associated programs mostly use 'tcpwrappers' for controlling access. The first step you ought to take in securing portmap is to ensure that your hosts.allow and hosts.deny files are set up to control access properly.
In /etc/hosts.deny, deny access to allcomers:
mountd: ALL statd: ALL portmap: ALL rquotad: ALLThen in /etc/hosts.allow, let the good guys through (adjust for your network):
mountd: 192.168.0. statd: 192.168.0. portmap: 192.168.0. rquotad: 192.168.0.On top of this, however, you should firewall off the ports that these programs use. As I found out, this is not as easy as it sounds. Portmap assigns random ports for some of the services it starts. You can run
rpcinfo -p to see the ports in use. An example run on one of my machines looks like this:
program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100021 1 udp 32770 nlockmgr 100021 3 udp 32770 nlockmgr 100021 4 udp 32770 nlockmgr 100021 1 tcp 32788 nlockmgr 100021 3 tcp 32788 nlockmgr 100021 4 tcp 32788 nlockmgr 100005 1 udp 1005 mountd 100005 1 tcp 1008 mountd 100005 2 udp 1005 mountd 100005 2 tcp 1008 mountd 100005 3 udp 1005 mountd 100005 3 tcp 1008 mountd 100024 1 udp 863 status 100024 1 tcp 866 statusOf these, nfs and portmapper always use the same ports, 2049 and 111, so ensure you block off these. What about the rest? Happily, there's a way to configure them to use constant ports so we can reliably firewall them. Life would be too easy if all this configuration was in the one place, so here's how to find the different places you need to change.
options lockd nlm_udpport=32768 nlm_tcpport=32768Then run
update-modules to recreate your /etc/modules.conf. The next time you boot these ports will be used for nlockmgr. If you've got the lockd statically compiled into your kernel, you'll need to pass these options as lockd.mnlm_udpport and lockd.nlm_tcpport to the kernel on boot.
STATDOPTS in /etc/default/nfs-common, e.g.
STATDOPTS="--port 699 --outgoing-port 700"
RPCMOUNDOPTS, e.g.
RPCMOUNTDOPTS="--port 962"
RPCRQUOTADOPTS in /etc/default/quota.
See also:
Enter passphrase for /home/evan/.ssh/id_rsa:This happens because I haven't run ssh-add when I logged in, to store the passphrase for the key with the current ssh-agent. So now I have two options:
Add this key to your current ssh-agent session [Y/n]?...and then ssh would add the key, like ssh-add does, and continue with the login. Wouldn't that be great? I think this is the biggest usability problem I run up against in my daily work life. Which, y'know, is pretty good. [You might want to look into libpam-ssh] [See also http://advogato.org/person/mbrubeck/diary.html?start=90 ] tags: ssh usability wishlist
sysvinit package.
Before trying this, make sure your installation is up to date as we’ve had to split out some parts of sysvinit into a new sysvutils package. If you’re up to date, and want to try it out, install the upstart and upstart-compat-sysv packages from universe.
Note that the first reboot after you’ve installed the packages (from sysvinit to upstart) will be a little tricky … use reboot -f.
If your system boots and shuts down normally, everything’s working just fine. Note that both will be somewhat more quiet than you’re used to, unless you have usplash running.
Throughout the rest of this entry, I’ll try to answer some of the questions and comments that I’ve received since the last post.
Events
As I talked about previously, upstart is an event-based init daemon. Events are the primary force for having your services and tasks started and stopped at the appropriate time and in the appropriate order.
So what are events and where do they come from? (Note that this part is under development, so may change in later releases).
Events are just simple strings that may be sent by any process when something it is tracking the state of changes. They have no state or longevity, and if, when queued, they do not cause any job state changes, then they have no effect unless they are sent again.
Jobs can list which events cause them to be started if they are not already running and which events cause them to be stopped if they are running. Multiple start and stop events may be listed, in which case the first to occur changes the job until the next one occurs.
upstart itself generates the following system events:
shutdown tool included in the package also causes one of the following events to be sent once the “shutdown” event has been handled:
shutdown -e event.initctl trigger EVENT. For now this is just the event string, however it’s intended that the event may include other details including environment variables and even file descriptors.
Typical example
To clarify how it all hangs together, here’s an example (using fictional names) of how the tasks and events can be arranged to provide race-free mounting of filesystems.
/etc/fstab/etc/fstab and if all are mounted, generates the “writable-filesystem” event./etc/fstab will be checked and mounted.
The only reason they wouldn’t be is if there’s an error of some kind, and that means you have larger problems anyway and the system administrator would have a shell to fix it. Of course, the moment they finish checking the filesystem and mount it, the boot process would carry on.
There’s no reason that any of these events need to be generated by the upstart daemon itself, it can receive them from any other daemon on the system such as udev, acpid, etc. This keeps the focus of the init daemon narrow.
A large part of the future development will be working out exactly what kinds of events we want init itself to generate, what kinds we want to come from elsewhere, and what the contents of an event can be.
Getting Involved
If you want to get involved with trying to nudge the direction of upstart development, you can join the upstart-devel mailing list at http://lists.netsplit.com/
Or if you just want to grab the source code, tarballs are published at http://people.ubuntu.com/\scott/software/upstart/ and the bzr archive is at http://bazaar.launchpad.net/\keybuk/upstart/main
sysvinit. It separates jobs into different “run levels” and can either run a job when particular run levels are entered (e.g. /etc/init.d/rc 2) or continually during a particular run level (e.g. /sbin/getty).
The /etc/init.d/rc script is also based on the System V one (and is in the sysv-rc package), it simply executes the stop then start scripts found in /etc/rcN.d (where N is the run level) in numerical order.
Why change it?
Running a fixed set of scripts, one after the other, in a particular order has served us reasonably well until now. However as Linux has got better and better at dealing with modern computing (arguably Linux’s removable device support is better than Windows’ now) this approach has begun to have problems.
The old approach works as long as you can guarantee when in the boot sequence things are available, so you can place your init script after that point and know that it will work. Typical ordering requirements are:
/etc/fstab./etc/fstab may require tools in /usr which is a network filesystem that cannot be mounted until after networking has been brought up.
The two states shown in red (“waiting” and “running”) are rest states, normally we expect the job to remain in these states until an event comes in, at which point we need to take actual to get the job into the next state.
The other states are temporary states; these allow a job to run shell script to prepare for the job itself to be run (“starting”) and clean up afterwards (“stopping”). For services that should be respawned if they terminate before an event that stops them is received, they may run shell script before the process is started again (“respawning”).
Jobs leave a state because the process associated with them terminates (or gets killed) and move to the next appropriate state, following the green arrow if the job is to be started or the red arrow if it is to be stopped. When a script returns a non-zero exit status, or is killed, the job will always be stoped. When the main process terminates and the job should not be respawned, the job will also always be stopped.
As already covered, events generated by the init daemon or received from other processes cause jobs to be started or stopped; also manual requests to start or stop a job may be received.
The communication between the init daemon and other processes is bi-directional, so the status of jobs may be queries and even changes of state to all jobs be received.
How does it differ from launchd?
launchd is the replacement init system used in MacOS X developed as an “Open Source” project by Apple. For much of its life so far, the licence has actually been entirely non-free and thus it has only become recently interesting with the licence change.
Much of the goal of both systems appears initially to be the same; they both start jobs based on system events, however the launchd system severly limits the events to only the following:
/etc/fstab) is available and writable.
The launchd model expects the job to “sit and wait” if it is unable to start, rather than provide a mechanism for the job to only be started when it doesn’t need to wait. Jobs that need /usr to be mounted would need to spin in a loop waiting for /usr to be available before continuing (or use a file in a tmpfs to indicate it’s available, and use that modification as the event).
This is not especially surprising given that Apple have a high degree of control over both their hardware and the actual underlying operating system; they don’t need to deal with the wide array of different configurations that we have in the Linux world.
Had the licence been sufficiently free at the point we began development of our own system, we would probably have extended launchd rather than implement our own. At the point Apple changed the licence, our own system was already more suitable for our purposes.
How does it differ from initng?
Initng by Jimmy Wennlund is another replacement init daemon intended to replace the sysvinit system used by Linux. It is a dependency-based system, where upstart is an event-based system.
The notion of a dependency-based system is interesting to talk about at this point. Jobs declare dependencies on other jobs that need to happen before the job itself can be started. Starting the job causes its dependencies to be started first, and their dependencies, and so on. When jobs are stopped, if running jobs have no dependencies, they themselves can be stopped.
It’s a neat solution to the problem of ordering a fixed boot sequence and the problem of keeping the number of running processes to a minimum needed.
However this means that you need to have goals in mind when you boot the system, you need to have decided that you want gdm to be started in order for it, and its dependencies, to be started. Initng uses run levels to ensure this happens, where a run level is a list of goal jobs that should be running in that run level.
It’s also not clear how the dependencies interact with the different types of job, a dependency on Apache would need the daemon to be running where a dependency on “checkroot” would need the script to have finished running. Upstart handles this by using different events (“apache running” vs. “checkroot stopping”).
Again while interesting, Initng does not solve the problems that we wanted to solve. It can reorder a fixed set of jobs, but cannot dynamically determine the set of jobs needed for that particular boot.
A typical example would be that if the only dependency on the job that configures networking is the mount network filesystems job, then should that job fail or notbe a goal (e.g. because there are no network filesystems to be mounted) the result is that network devices themselves will not be configured. You could make everything a goal, and just use the dependencies to determine the order, however this is less efficient than just ordering the existing sysv-rc scripts (which
can be done at install time).
Another example is that often you simply don’t know whether something is a dependency or not without reading other configuration, for example the mount network filesystems may be a dependency of everything under /usr or may just be a dependency of anything allowing the user to login if it just mounts /home.
The difference in model can be summed up as “initng starts with a list of goals and works out how to get there, upstart starts with nothing and finds out where it gets to.”
How does it differ from Solaris SMF?
SMF is another approach to replacing init developed by Sun for the Solaris operating system. Like initng it’s a dependency-based system, so see above for the differences between those systems and upstart.
SMF’s main focus is serive management; making sure that once services are running, they stay running, and allowing the system administrator to query and modify the states of jobs on the system.
Upstart provides the same set of functionality in this regard, services are respawned when they fail and system administrators can at any time query the state of running services and adjust the state to their liking.
Will it replace cron, inetd, etc?
The goal of upstart is to replace those daemons, so that there is only one place (/etc/event.d) where system administrators need to configure when and how jobs should be run.
In fact, the goal is that upstart should also replace the “run event scripts” functionality of any daemon on the system. Daemons such as acpid, apmd and Network Manager would send events to init instead of running scripts themselves with their own perculiar configuration and semantics.
A system administrator who only wanted a particular daemon to be run while the computer was on AC power would simply need to edit /etc/event.d/daemon and change “on startup” to “on ac power”.
What about compatibility?
There’s a lot of systems administrators out there who have learned how Linux works already and will not want to learn again immediately, there’s also a large number of books that cover the existing software and won’t cover upstart for at least a couple of years.
For this reason, compatibility is very important. upstart will continue to run the existing scripts for the forseeable future so that packages will not need to be updated until the author wants.
Compatibility command-line tools that behave like their existing equivalents will also be implemented, a system administrator would never need to know that crontab -e is actually changing upstart jobs.
Does it use D-BUS?
“To D-BUS people, every problem seems like a D-BUS problem.” —Erik TroanThe UNIX philosophy is that something should do just one job, and do it very well. upstart’s one job is starting, supervising and stopping other jobs; D-BUS’s one job is passing messages between other jobs. D-BUS does provide a mechanism for services to be activated when the first message is sent to them, thereby starting other jobs. Some people have taken this idea and extended it to suggest that all a replacement init system need do is register jobs with D-BUS and turn booting into a simple matter of message parsing. This seems wrong to me, D-BUS would need to be extended to supervise these services, provide means for them to be restarted and stopped; as well as deal with being process #1 which means cleaning up after children whose parent’s have died, etc. It seems far simpler to arrange for D-BUS to send an event to init when it needs a service to be started, and focus on being a very good message passing system. The IPC mechanism used by upstart is not currently D-BUS because of various problems, however it’s always been expected that even if init itself doesn’t communicate with D-BUS directly, there would be a D-BUS proxy that would ensure messages about all init jobs and events would be given to D-BUS and D-BUS clients could send messages to init to query and change the state of jobs. What is the implementation plan? Because this is process #1 we are changing, we want to make sure that we get it right. Therefore instead of releasing a fully-featured daemon and configuration to the world, we’re developing it in the following stages:
/sbin/init while running the existing sysv-rc scripts. This is the shake-down test of the daemon, can it perform the same job as the existing sysvinit daemon without any regressions?/etc/rcS.d scripts replaced by upstart jobs. These consitute the majority of tasks for booting the system into at least single-user mode, and contain many of the current ordering problems and race conditions. If the daemon solves the problems here, it will be a success.upstart package for testing before it becomes the init daemon.
We welcome any experienced users who want to help test this; install the package and follow the instructions in /usr/share/doc/upstart/README.Debian to add a boot option that will use upstart instead of init. If your system boots and shut downs normally (other than a slightly more verbose boot without usplash running) then it is working correctly.
Other types of events will be added as required during development and testing. Currently only a basic client tool (initctl) has been written, compatibility tools such as shutdown will be written over the next week or two before it replaces our sysvinit package.
diff -pruN 2.4.1-6/debian/mdadm.init 2.4.1-6ubuntu4/debian/mdadm.init --- 2.4.1-6/debian/mdadm.init 2006-09-21 21:13:04.000000000 +0100 +++ 2.4.1-6ubuntu4/debian/mdadm.init 2006-09-21 21:10:08.000000000 +0100 @@ -1,4 +1,4 @@ -#!/bin/sh -eu +#!/bin/sh -e # # Start the RAID monitor daemon for all active md arrays if desired. #The changelog entry goes out of its way to reason the change:
Do not invoke init scripts with -u. Fixes dist upgrade from dapper to edgy mostlikely caused by /bin/sh pointing to dash.Of course, it's debateable whether set -u is applicable to an init.d script it causes the shell to barf when uninitialised variables are used, just like Perl's use strict;. I think set -u is good practice and I use it everywhere. My /bin/sh also points to /bin/dash, and I cannot say that I've never run into problems. However, the fixes are usually quite trivial. I consider Ubuntu's change a hack fixing symptoms, not causes. Due to the immense time pressure under which the core team is maintaining the main parts of the distribution, I can imagine such hacks to be quite common. I'd hate for that to be my job as a maintainer. NP: Explosions in the Sky / How Strange, Innocence
Next.