Subject: bug#48974: closed (Re: bug#48974: A possible shepherd bug (it's very minor))

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 06 Jul 2021 00:01:01 +0000

Your bug report

#48974: A possible shepherd bug (it's very minor)

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
48974: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=48974
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#48974: A possible shepherd bug (it's very minor)
From: Joshua Branson <[email-masked]>
To: [email-masked]
Date: Mon, 05 Jul 2021 19:59:43 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Leo Prikler <[email-masked]> writes:

> Hi,
>
> Am Freitag, den 02.07.2021, 18:57 -0400 schrieb Joshua Branson:
>> Leo Prikler <[email-masked]> writes:
>> 
>> > Am Freitag, den 25.06.2021, 14:06 -0400 schrieb Joshua Branson:
>> > > Leo Prikler <[email-masked]> writes:
>> > > 
>> > > > Hi,
>> > > > 
>> > > > Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:
>> > > > > Leo Prikler <[email-masked]> writes:
>> > > 
>> > > Thanks again!  The current code doesn't quite work for me
>> > > yet.  I'll
>> > > try using match-lambda to define it.  I'll post again when I have
>> > > a
>> > > free moment.  When i get it working, I'll send a patch to the
>> > > manual
>> > > via guix-patches and CC you.  Is that ok?  Or would you rather
>> > > that
>> > > documentation be in the cookbook?
>> > Did I make a mistake or does it do the job only in a somewhat
>> > inelegant
>> > way?  I'm perfectly fine with the latter as I'm not the one using
>> > the
>> > code :P
>> 
>> I've got some code now that works!
>> 
>> #+BEGIN_SRC scheme
>> (define (auto-login-to-tty tty user config)
>>   (if (string=? tty (mingetty-configuration-tty config))
>>         (mingetty-configuration
>>          (inherit config)
>>          (auto-login user))
> Why do you need to inherit the config, when it doesn't change?  Seems
> like a pointless allocation to me.
>>         (mingetty-configuration
>>          (inherit config))))
>> 
>> ;; allegedly %desktop-services now contains network-manager-
>> applet...?  Can I remove that?
> Not with modify-services, but there's some filter example in the manual
> as well.
>> (define %my-desktop-services
>>   (modify-services %desktop-services ;;end of remove services
>>     (mingetty-service-type config =>
>>                            (auto-login-to-tty "3" "joshua" config))))
>> 
>> #+END_SRC
>> 
>> > I think the cookbook is a better destination for stuff like this.
>> 
>> I agree, but we should also probably fix the manual:
>> 
>> 10.1 Using the Configuration System
>> ===================================
>> 
>> System Services
>> 
>>    For example, suppose you want to modify ‘guix-daemon’ and Mingetty
>> (the console log-in) in the ‘%base-services’ list (*note
>> ‘%base-services’: Base Services.).  To do that, you can write the
>> following in your operating system declaration:
>> 
>> 
>>      (define %my-services
>>        ;; My very own list of services.
>>        (modify-services %base-services
>>          (guix-service-type config =>
>>                             (guix-configuration
>>                              (inherit config)
>>                              ;; Fetch substitutes from example.org.
>>                              (substitute-urls
>>                                (list "https://example.org/guix"
>>                                      "https://ci.guix.gnu.org"))))
>>             ;; it looks like the manual is telling you to set up
>>             ;; auto login on ALL ttys.
>>          (mingetty-service-type config =>
>>                                 (mingetty-configuration
>>                                  (inherit config)
>>                                  ;; Automatially log in as "guest".
>>                                  (auto-login "guest")))))
>> 
>>      (operating-system
>>        ;; ...
>>        (services %my-services))
>> 
>> How about I delete that section in the manual about automatic login
>> and
>> instead add this to the cookbook?
> No.  Read on, the manual clearly states that this affects *all* TTYs. 
> Presumably the guest user only has access to su and logout, maybe guix,
> but in any case they ought not to have access to anyone's $HOME, not
> even their own.
>
> The thing we've coded up here is a more involved process to solve a
> particular problem rather than a general demo of what services can do
> and thus belongs to the cookbook.
>
> Regards,
> Leo
>

-- 
Joshua Branson (joshuaBPMan in #guix)
Sent from Emacs and Gnus
  https://gnucode.me
  https://video.hardlimit.com/accounts/joshua_branson/video-channels
  https://propernaming.org
  "You can have whatever you want, as long as you help
enough other people get what they want." - Zig Ziglar

Subject: A possible shepherd bug (it's very minor)
From: Joshua Branson <[email-masked]>
To: [email-masked]
Date: Sat, 12 Jun 2021 09:26:23 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello!

I've had this issue every since I enabled automatic login on my guix
system like so:

#+BEGIN_SRC scheme
(define %my-desktop-services
  (modify-services
      %desktop-services 
    (mingetty-service-type config =>
                           (mingetty-configuration
                            (inherit config)
                            ;;auto login as joshua
                            (auto-login "joshua")))))

(operating-system
   ...
   (services (list %my-desktop-services)))
#+END_SRC

This is the "error message"

#+BEGIN_SRC sh
This is the GNU system.  Welcome
dobby login: joshua (automatic login)
This is the GNU operating system, welcome!

Cannot make/remove an entry for the specified session
#+END_SRC

Essentially, mingetty tries to auto log me in, but I am using desktop
services.  So mingetty tries to log me in, before many of the desktop
services are started.  However, I guess this doesn't work.  Meaning,
my autostart sway script is NOT run, until AFTER all of the desktop
services are started.  WHICH IS PROBABLY A GOOD IDEA.  I would rather
log in, when my desktop services have started, not before.

BUT the minor issue is that after I log in, =users= reports:

#+BEGIN_SRC sh
joshua@dobby ~> users
joshua joshua joshua joshua joshua joshua
#+END_SRC

So it looks like 6 versions of myself are logged in by the time I am
officially logged in and I auto start sway via .bash_profile:

#+BEGING_SRC sh
# Honor per-interactive-shell startup file
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

# shepherd

if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
    export MOZ_ENABLE_WAYLAND=1
    export GUIX_PACKAGE_PATH=/home/joshua/prog/gnu/guix/guix-packages/
    XDG_DATA_DIRS=/var/lib/flatpak/exports/share:/home/joshua/.local/share/flatpak/exports/share:$XDG_DATA_DIRS
    # this may fix a bug that I have with termite confusing backspace as space in guix environment
    # export TERM=linux
    shepherd -c /home/joshua/.config/shepherd/init.scm &
    exec dbus-run-session sway
fi
#+END_SRC 

I'm guessing the root cause is that the shepherd starts most services
sequentially at the moment.  Anyway, I thought I'd share a minor issue
with you all!

Thanks!

Joshua Branson