On Wed, Sep 12, 2012 at 3:15 PM, Kok, Auke-jan H
<[email protected]> wrote:
> On Tue, Sep 11, 2012 at 3:06 AM, Tomasz Torcz <[email protected]> wrote:
>> From 0a3f3b2a46607a94efd2936ae7094a9ef7421e76 Mon Sep 17 00:00:00 2001
>> From: Tomasz Torcz <[email protected]>
>> Date: Fri, 7 Sep 2012 14:14:44 +0200
>> Subject: [PATCH] Try to start rescue.target if default.target is missing
>>
>> In rare cases when default.target symlink is missing, systemd fails
>> instantly and gets into reboot loop.
>> Noticed by XReaper on IRC.
>> Be a bit more resilient, try to fallback to rescue.target first.
>> ---
>>  src/core/main.c | 12 +++++++++++-
>>  1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/core/main.c b/src/core/main.c
>> index 7b5c861..60e213a 100644
>> --- a/src/core/main.c
>> +++ b/src/core/main.c
>> @@ -1301,7 +1301,17 @@ int main(int argc, char *argv[]) {
>>          r = set_default_unit(SPECIAL_DEFAULT_TARGET);
>>          if (r < 0) {
>>                  log_error("Failed to set default unit %s: %s", 
>> SPECIAL_DEFAULT_TARGET, strerror(-r));
>> -                goto finish;
>> +
>> +               if (arg_running_as == MANAGER_USER)
>> +                       goto finish;
>> +               else {
>> +                       /* Give administrator a chance to fix things */
>> +                       r = set_default_unit(SPECIAL_RESCUE_TARGET);
>> +                       if (r < 0) {
>> +                               log_error("Failed to set %s: %s", 
>> SPECIAL_RESCUE_TARGET, strerror(-r));
>> +                               goto finish;
>> +                       }
>> +               }
>>          }
>>
>>          /* By default, mount "cpu" and "cpuacct" together */
>
> hmm
>
> I wonder why default.target goes missing - after all systemd itself
> installs a "default.target" file (not symlink!) under
> /usr/lib/systemd/user/ (which in itself is horrible, but that's
> another story).
>
> A better approach to me sounds that a missing default.target would
> result in an empty user session, where systemd just sits idle and
> never spawns jobs unless manually instructed.
>
> I often create new empty users and start a
> user-session@<newuid>.service, then go and work on services for that
> user after. Having a systemd --user come up without any configuration
> to an "empty" state would help.

ignore that, I just reread your patch and that's what you're actually
doing here, it seems, for the user session, or does it error out for
the user session here?

Auke
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to