Re: service jail start xyz returns success - when it shouldn't!
Date: Mon, 20 Oct 2025 17:19:20 UTC
On 2025-10-20 09:31, Frank Leonhardt wrote: > So I accidentally installed an ARM base system in a AMD64 jail and > tried to start it. It doesn't work, no one will be surprised to know. > > The thing is I'd expect service to return non-zero if the jail it's > starting crashes and burns. To quote the FM: > > " The service utility exits 0 on success, and >0 if an error occurs." > > A pretty major error, but it still returns success. Now I can see why > this might be considered success - the "service" utility did what it > was told and the service itself went badly wrong. But it's not exactly > helpful if you want to know if your jail has started properly, is it? > > My question - is this a bug, or can someone explain why it's actually a > feature? The service in question is that of creating jails and starting them up. So I'd call it one more layer removed: the service itself (creating a jail) went fine. The jail was created and it reported success. Then the jail's main process (presumably "sh /etc/rc") failed, so the jail crashed and burned. But that's not the service; that's just whatever the service was trying to do. The service reported back "OK, I've readied by child for the world, and sent it out the door." That the child took one step out the door and was hit by a bus is neither here nor there. From a practical standpoint, there's no good way to report the failure of a jail. A successfully created jail runs for an arbitrarily long time, and that is called success. Failure could happen immediately, or it could also take a long time. Even if you choose to wait, jails have no wait(2) call with an exit status like processes do. They're like daemons that way; you have to judge success or failure on your own by looking at logs, or seeing if what you expect to be running is in fact still running. - Jamie