GNU bug report logs - #48974
A possible shepherd bug (it's very minor)

Previous Next

Package: guix;

Reported by: Joshua Branson <jbranso <at> dismail.de>

Date: Sat, 12 Jun 2021 13:27:02 UTC

Severity: normal

Done: Joshua Branson <jbranso <at> dismail.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48974 in the body.
You can then email your comments to 48974 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Sat, 12 Jun 2021 13:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joshua Branson <jbranso <at> dismail.de>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sat, 12 Jun 2021 13:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Joshua Branson <jbranso <at> dismail.de>
To: bug-guix <at> gnu.org
Subject: A possible shepherd bug (it's very minor)
Date: Sat, 12 Jun 2021 09:26:23 -0400
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 <at> 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




Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Sat, 12 Jun 2021 19:40:01 GMT) Full text and rfc822 format available.

Message #8 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Joshua Branson <jbranso <at> dismail.de>, 48974 <at> debbugs.gnu.org
Subject: Re: A possible shepherd bug (it's very minor)
Date: Sat, 12 Jun 2021 21:39:18 +0200
Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua Branson:
> 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
I am sorry to say this, but rather than this being (just) a bug with
shepherd, your config looks seriously borked.  Why are you asking Guix
to autologin you on *every available console*?

Regards,
Leo





Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Sat, 12 Jun 2021 20:10:01 GMT) Full text and rfc822 format available.

Message #11 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: jbranso <at> dismail.de
To: "Leo Prikler" <leo.prikler <at> student.tugraz.at>, 48974 <at> debbugs.gnu.org
Subject: Re: A possible shepherd bug (it's very minor)
Date: Sat, 12 Jun 2021 20:09:10 +0000
June 12, 2021 3:39 PM, "Leo Prikler" <leo.prikler <at> student.tugraz.at> wrote:

> Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua Branson:
> 
>> 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
> 
> I am sorry to say this, but rather than this being (just) a bug with

Thank you for speaking so gently! :)

> shepherd, your config looks seriously borked. Why are you asking Guix
> to autologin you on *every available console*?

HAHAHA! That's what I'm doing! I forgot that! Honestly, I did that, because I
couldn't figure out how to code "just auto log into console 1 ONLY". :)

Would you mind explaining how bad of a decision this is? Is this a BAD security practice?

I'll tell you what, why don't we leave this "bug" open for a week...I'll try to write
the code that does what I want, and I'll email the answer.

Then I'll edit the manual to provide an example!

Thanks Leo (You sir, are a superstar!),

Joshua

> Regards,
> Leo




Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Sat, 12 Jun 2021 21:14:01 GMT) Full text and rfc822 format available.

Message #14 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: jbranso <at> dismail.de, 48974 <at> debbugs.gnu.org
Subject: Re: A possible shepherd bug (it's very minor)
Date: Sat, 12 Jun 2021 23:13:18 +0200
Hi,

Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso <at> dismail.de:
> June 12, 2021 3:39 PM, "Leo Prikler" <leo.prikler <at> student.tugraz.at>
> wrote:
> 
> > Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua Branson:
> > 
> > > 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
> > 
> > I am sorry to say this, but rather than this being (just) a bug
> > with
> 
> Thank you for speaking so gently! :)
> 
> > shepherd, your config looks seriously borked. Why are you asking
> > Guix
> > to autologin you on *every available console*?
> 
> HAHAHA! That's what I'm doing! I forgot that! Honestly, I did that,
> because I
> couldn't figure out how to code "just auto log into console 1 ONLY".
> :)
> 
> Would you mind explaining how bad of a decision this is? Is this a
> BAD security practice?
It is seriously bad practice.  With just one TTY, you can usually
suspend it with programs such as vlock, plus it's expected that you
actually sit in front of the given TTY when the autologin happens. 
With all TTYs though, anyone could switch to the other and "lol, now
I'm jbranso".  The only configuration, that could possibly be worse is
autologin root :P

(Granted, it probably still takes physical access to exploit, but it's
something your family/friends could likely do just to troll you.)

> I'll tell you what, why don't we leave this "bug" open for a
> week...I'll try to write
> the code that does what I want, and I'll email the answer.
> 
> Then I'll edit the manual to provide an example!
I'm pretty sure that the actual bug also exists, just not sure whether
that's on your config or on shepherd.  Using TTY1 for graphical stuff
is also somewhat rare in Guix land, I presume.  (Or rather, I can't
think of it as anything but a container for debug output spam :D)

As for getting this to work only on TTY1, you do get the config object,
so you can do stuff like 
  (if (is-tty1? config) (inherit+autologin config) config)  
Note of course, that is-tty1? is not a procedure that's ready-made, but
one that you'd need to build from primitives such as record accessors.

Regards,
Leo





Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Sat, 12 Jun 2021 23:35:02 GMT) Full text and rfc822 format available.

Message #17 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: jbranso <at> dismail.de
To: "Leo Prikler" <leo.prikler <at> student.tugraz.at>, 48974 <at> debbugs.gnu.org
Subject: Re: A possible shepherd bug (it's very minor)
Date: Sat, 12 Jun 2021 23:34:28 +0000
June 12, 2021 5:13 PM, "Leo Prikler" <leo.prikler <at> student.tugraz.at> wrote:

> Hi,
> 
> Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso <at> dismail.de:
> 
>> June 12, 2021 3:39 PM, "Leo Prikler" <leo.prikler <at> student.tugraz.at>
>> wrote:
>> 
>> Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua Branson:
>> 
> 
> I'm pretty sure that the actual bug also exists, just not sure whether
> that's on your config or on shepherd. Using TTY1 for graphical stuff
> is also somewhat rare in Guix land, I presume. (Or rather, I can't
> think of it as anything but a container for debug output spam :D)

So...whay tty should I auto login to start my sway session?  tty2?  tty3?

> 
> As for getting this to work only on TTY1, you do get the config object,
> so you can do stuff like
> (if (is-tty1? config) (inherit+autologin config) config)
> Note of course, that is-tty1? is not a procedure that's ready-made, but
> one that you'd need to build from primitives such as record accessors.

Thanks!

> 
> Regards,
> Leo




Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Sun, 13 Jun 2021 07:49:02 GMT) Full text and rfc822 format available.

Message #20 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: jbranso <at> dismail.de, 48974 <at> debbugs.gnu.org
Subject: Re: A possible shepherd bug (it's very minor)
Date: Sun, 13 Jun 2021 09:48:12 +0200
Am Samstag, den 12.06.2021, 23:34 +0000 schrieb jbranso <at> dismail.de:
> June 12, 2021 5:13 PM, "Leo Prikler" <leo.prikler <at> student.tugraz.at>
> wrote:
> 
> > Hi,
> > 
> > Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso <at> dismail.de:
> > 
> > > June 12, 2021 3:39 PM, "Leo Prikler" <
> > > leo.prikler <at> student.tugraz.at>
> > > wrote:
> > > 
> > > Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua Branson:
> > > 
> > 
> > I'm pretty sure that the actual bug also exists, just not sure
> > whether
> > that's on your config or on shepherd. Using TTY1 for graphical
> > stuff
> > is also somewhat rare in Guix land, I presume. (Or rather, I can't
> > think of it as anything but a container for debug output spam :D)
> 
> So...whay tty should I auto login to start my sway
> session?  tty2?  tty3?
In principle, any number is safe (even 1, but that's dedicated to
receive all the debug stuff and won't be particularly useful), so just
pick your favourite.  (The installer has TTY2 dedicated to the manual
and TTY3 the first console if that helps with your decision.)
> > As for getting this to work only on TTY1, you do get the config
> > object,
> > so you can do stuff like
> > (if (is-tty1? config) (inherit+autologin config) config)
> > Note of course, that is-tty1? is not a procedure that's ready-made, 
> > but
> > one that you'd need to build from primitives such as record
> > accessors.
> 
> Thanks!
> 
> > Regards,
> > Leo





Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Fri, 25 Jun 2021 09:32:02 GMT) Full text and rfc822 format available.

Message #23 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: Joshua Branson <jbranso <at> dismail.de>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 48974 <at> debbugs.gnu.org
Subject: Re: bug#48974: A possible shepherd bug (it's very minor)
Date: Fri, 25 Jun 2021 05:31:13 -0400
Leo Prikler <leo.prikler <at> student.tugraz.at> writes:

> Hi,
>
> Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso <at> dismail.de:
>> June 12, 2021 3:39 PM, "Leo Prikler" <leo.prikler <at> student.tugraz.at>
>> wrote:
>>
>> > Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua Branson:
>> >
>> > > Hello!
>> > >
>> I'll tell you what, why don't we leave this "bug" open for a
>> week...I'll try to write
>> the code that does what I want, and I'll email the answer.
>>
>> Then I'll edit the manual to provide an example!
> I'm pretty sure that the actual bug also exists, just not sure whether
> that's on your config or on shepherd.  Using TTY1 for graphical stuff
> is also somewhat rare in Guix land, I presume.  (Or rather, I can't
> think of it as anything but a container for debug output spam :D)
>
> As for getting this to work only on TTY1, you do get the config object,
> so you can do stuff like
>   (if (is-tty1? config) (inherit+autologin config) config)
> Note of course, that is-tty1? is not a procedure that's ready-made, but
> one that you'd need to build from primitives such as record accessors.
>

Well, it's been about a week. Here is my current code that doesn't work.
haha.

#+BEGIN_SRC scheme
(define %my-desktop-services
  (modify-services %desktop-services ;;end of remove services
    (mingetty-service-type config =>
                           (mingetty-configuration
                            (inherit config)
                            ;; ERROR at the NEXT LINE
                            (auto-login-to-tty-3 config)
                            ))))

(define (auto-login-to-tty-3 config)
  (if (string=? "3" (mingetty-configuration-tty config))
      '(auto-login "joshua")
      '(auto-login #f)))
#+END_SRC

It obviously doesn't work because I am treating modify-services as if it
were a procedure.  In fact, it is a macro.  :)

I'm just popping in to give you an update on my progress.  I've probably
spent less than 20 minutes working on this.  The good news is I did find
the record accessor for tty is mingetty-configuration-tty.

My goal for the next week is to do something like this:

#+BEGIN_SRC scheme
(define (auto-login-to-tty-3 mingetty-service)
  (if (string=? "3" (mingetty-configuration-tty config))
      '(mingetty-configuration
         (auto-login "joshua")
         (tty "3"))
      mingetty-service))

(define (my-modify-%desktop-services-to-auto-login-on-tty-3 %desktop-services)
   ;; to be written
   ;; though I think fold, or map, may be useful functions here.

   ;;somehow I will use this function...
    (auto-login-to-tty-3 mingetty-service)
)

(define %my-desktop-services
        (my-modify-%desktop-services-to-auto-login-on-tty-3 %desktop-services))
#+END_SRC


I'll post again in about a week to tell you about my progress!

--
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




Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Fri, 25 Jun 2021 09:57:02 GMT) Full text and rfc822 format available.

Message #26 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Joshua Branson <jbranso <at> dismail.de>
Cc: 48974 <at> debbugs.gnu.org
Subject: Re: bug#48974: A possible shepherd bug (it's very minor)
Date: Fri, 25 Jun 2021 11:56:40 +0200
Hi,

Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:
> Leo Prikler <leo.prikler <at> student.tugraz.at> writes:
> 
> > Hi,
> > 
> > Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso <at> dismail.de:
> > > June 12, 2021 3:39 PM, "Leo Prikler" <
> > > leo.prikler <at> student.tugraz.at>
> > > wrote:
> > > 
> > > > Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua Branson:
> > > > 
> > > > > Hello!
> > > > > 
> > > I'll tell you what, why don't we leave this "bug" open for a
> > > week...I'll try to write
> > > the code that does what I want, and I'll email the answer.
> > > 
> > > Then I'll edit the manual to provide an example!
> > I'm pretty sure that the actual bug also exists, just not sure
> > whether
> > that's on your config or on shepherd.  Using TTY1 for graphical
> > stuff
> > is also somewhat rare in Guix land, I presume.  (Or rather, I can't
> > think of it as anything but a container for debug output spam :D)
> > 
> > As for getting this to work only on TTY1, you do get the config
> > object,
> > so you can do stuff like
> >   (if (is-tty1? config) (inherit+autologin config) config)
> > Note of course, that is-tty1? is not a procedure that's ready-made, 
> > but
> > one that you'd need to build from primitives such as record
> > accessors.
> > 
> 
> Well, it's been about a week. Here is my current code that doesn't
> work.
> haha.
> 
> #+BEGIN_SRC scheme
> (define %my-desktop-services
>   (modify-services %desktop-services ;;end of remove services
>     (mingetty-service-type config =>
>                            (mingetty-configuration
>                             (inherit config)
>                             ;; ERROR at the NEXT LINE
>                             (auto-login-to-tty-3 config)
>                             ))))
> 
> (define (auto-login-to-tty-3 config)
>   (if (string=? "3" (mingetty-configuration-tty config))
>       '(auto-login "joshua")
>       '(auto-login #f)))
> #+END_SRC
> 
> It obviously doesn't work because I am treating modify-services as if
> it were a procedure.  In fact, it is a macro.  :)
That's not the issue here, the issue is that you're treating mingetty-
configuration as… I'm not really sure what exactly, when it is in fact
a record constructor.  

Try the following:
#+BEGIN_SRC scheme
(define (auto-login-to-tty tty user)
  ;; TODO: you might want to implement this as match-lambda instead
  (lambda (config)
    (if (string=? tty (mingetty-configuration-tty mingetty-config))
        (mingetty-configuration
          (inherit config)
          (auto-login user))
        config)))

(define %my-desktop-services
  (modify-services %desktop-services
   
(mingetty-service-type config => 
                          (auto-login-
to-tty "3" "joshua"))))
#+END_SRC


> #+BEGIN_SRC scheme
> (define (auto-login-to-tty-3 mingetty-service)
>   (if (string=? "3" (mingetty-configuration-tty config))
>       '(mingetty-configuration
>          (auto-login "joshua")
>          (tty "3"))
>       mingetty-service))
Don't quote mingetty-configuration et al.  They're first-class syntax,
not just weird lists.

> (define (my-modify-%desktop-services-to-auto-login-on-tty-3 %desktop-
> services)
>    ;; to be written
>    ;; though I think fold, or map, may be useful functions here.
> 
>    ;;somehow I will use this function...
>     (auto-login-to-tty-3 mingetty-service)
> )
> 
> (define %my-desktop-services
>         (my-modify-%desktop-services-to-auto-login-on-tty-3 %desktop-
> services))
I don't think you need to implement modify-services on your own, rather
just use the existing thing in the "correct" way – i.e. adhering to the
expectations given by the already existing procedure (or macro).
> #+END_SRC
Regards,
Leo





Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Fri, 25 Jun 2021 18:07:01 GMT) Full text and rfc822 format available.

Message #29 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: Joshua Branson <jbranso <at> dismail.de>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 48974 <at> debbugs.gnu.org
Subject: Re: bug#48974: A possible shepherd bug (it's very minor)
Date: Fri, 25 Jun 2021 14:06:08 -0400
Leo Prikler <leo.prikler <at> student.tugraz.at> writes:

> Hi,
>
> Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:
>> Leo Prikler <leo.prikler <at> student.tugraz.at> writes:
>>
>> > Hi,
>> >
>> > Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso <at> dismail.de:
>> > > June 12, 2021 3:39 PM, "Leo Prikler" <
>> > > leo.prikler <at> student.tugraz.at>
>> > > wrote:
>> > >
>> > > > Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua Branson:
>> > > >
>> > > > > Hello!
>> > > > >
>> > > I'll tell you what, why don't we leave this "bug" open for a
>> > > week...I'll try to write
>> > > the code that does what I want, and I'll email the answer.
>> > >
>> > > Then I'll edit the manual to provide an example!
>> Well, it's been about a week. Here is my current code that doesn't
>> work.
>> haha.
>>
>> #+BEGIN_SRC scheme
>> (define %my-desktop-services
>>   (modify-services %desktop-services ;;end of remove services
>>     (mingetty-service-type config =>
>>                            (mingetty-configuration
>>                             (inherit config)
>>                             ;; ERROR at the NEXT LINE
>>                             (auto-login-to-tty-3 config)
>>                             ))))
>>
>> (define (auto-login-to-tty-3 config)
>>   (if (string=? "3" (mingetty-configuration-tty config))
>>       '(auto-login "joshua")
>>       '(auto-login #f)))
>> #+END_SRC
>>
>> It obviously doesn't work because I am treating modify-services as if
>> it were a procedure.  In fact, it is a macro.  :)
> That's not the issue here, the issue is that you're treating mingetty-
> configuration as… I'm not really sure what exactly, when it is in fact
> a record constructor.

Oh!!!! Light bulb!  I knew that!  I've made quite a few record
constructors for endlessh and my almost complete sway service:

http://issues.guix.gnu.org/39136
https://notabug.org/jbranso/guix-config/src/master/sway-service.scm

>
> Try the following:
>
> #+BEGIN_SRC scheme
> (define (auto-login-to-tty tty user)
>   ;; TODO: you might want to implement this as match-lambda instead

I will try that!

>   (lambda (config)
>     (if (string=? tty (mingetty-configuration-tty mingetty-config))
>         (mingetty-configuration
>           (inherit config)
>           (auto-login user))
>         config)))
>
> (define %my-desktop-services
>   (modify-services %desktop-services
>
> (mingetty-service-type config =>
>                           (auto-login-
> to-tty "3" "joshua"))))
> #+END_SRC
>

Hmmm.  Is that (define (auto-login-to-tty tty user) ...) a closure?  I
wonder why you need that lambda inside of it...Probably to pass the
config variable into the function...hmmm.  I still don't understand why
it is necessary.  I'll think about that a bit later on.

>
>> #+BEGIN_SRC scheme
>> (define (auto-login-to-tty-3 mingetty-service)
>>   (if (string=? "3" (mingetty-configuration-tty config))
>>       '(mingetty-configuration
>>          (auto-login "joshua")
>>          (tty "3"))
>>       mingetty-service))
> Don't quote mingetty-configuration et al.  They're first-class syntax,
> not just weird lists.

Yeah that's true.  I do actually like (guix records)!  I feel like that
file should be upstreamed into guile!

>
>> (define (my-modify-%desktop-services-to-auto-login-on-tty-3 %desktop-
>> services)
>>    ;; to be written
>>    ;; though I think fold, or map, may be useful functions here.
>>
>>    ;;somehow I will use this function...
>>     (auto-login-to-tty-3 mingetty-service)
>> )
>>
>> (define %my-desktop-services
>>         (my-modify-%desktop-services-to-auto-login-on-tty-3 %desktop-
>> services))
> I don't think you need to implement modify-services on your own, rather
> just use the existing thing in the "correct" way – i.e. adhering to the
> expectations given by the already existing procedure (or macro).

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?

>> #+END_SRC
> 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




Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Fri, 25 Jun 2021 18:29:02 GMT) Full text and rfc822 format available.

Message #32 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Joshua Branson <jbranso <at> dismail.de>
Cc: 48974 <at> debbugs.gnu.org
Subject: Re: bug#48974: A possible shepherd bug (it's very minor)
Date: Fri, 25 Jun 2021 20:28:14 +0200
Am Freitag, den 25.06.2021, 14:06 -0400 schrieb Joshua Branson:
> Leo Prikler <leo.prikler <at> student.tugraz.at> writes:
> 
> > Hi,
> > 
> > Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:
> > > Leo Prikler <leo.prikler <at> student.tugraz.at> writes:
> > > 
> > > > Hi,
> > > > 
> > > > Am Samstag, den 12.06.2021, 20:09 +0000 schrieb 
> > > > jbranso <at> dismail.de:
> > > > > June 12, 2021 3:39 PM, "Leo Prikler" <
> > > > > leo.prikler <at> student.tugraz.at>
> > > > > wrote:
> > > > > 
> > > > > > Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua
> > > > > > Branson:
> > > > > > 
> > > > > > > Hello!
> > > > > > > 
> > > > > I'll tell you what, why don't we leave this "bug" open for a
> > > > > week...I'll try to write
> > > > > the code that does what I want, and I'll email the answer.
> > > > > 
> > > > > Then I'll edit the manual to provide an example!
> > > Well, it's been about a week. Here is my current code that
> > > doesn't
> > > work.
> > > haha.
> > > 
> > > #+BEGIN_SRC scheme
> > > (define %my-desktop-services
> > >   (modify-services %desktop-services ;;end of remove services
> > >     (mingetty-service-type config =>
> > >                            (mingetty-configuration
> > >                             (inherit config)
> > >                             ;; ERROR at the NEXT LINE
> > >                             (auto-login-to-tty-3 config)
> > >                             ))))
> > > 
> > > (define (auto-login-to-tty-3 config)
> > >   (if (string=? "3" (mingetty-configuration-tty config))
> > >       '(auto-login "joshua")
> > >       '(auto-login #f)))
> > > #+END_SRC
> > > 
> > > It obviously doesn't work because I am treating modify-services
> > > as if
> > > it were a procedure.  In fact, it is a macro.  :)
> > That's not the issue here, the issue is that you're treating
> > mingetty-
> > configuration as… I'm not really sure what exactly, when it is in
> > fact
> > a record constructor.
> 
> Oh!!!! Light bulb!  I knew that!  I've made quite a few record
> constructors for endlessh and my almost complete sway service:
> 
> http://issues.guix.gnu.org/39136
> https://notabug.org/jbranso/guix-config/src/master/sway-service.scm
> 
> > Try the following:
> > 
> > #+BEGIN_SRC scheme
> > (define (auto-login-to-tty tty user)
> >   ;; TODO: you might want to implement this as match-lambda instead
> 
> I will try that!
> 
> >   (lambda (config)
> >     (if (string=? tty (mingetty-configuration-tty mingetty-config))
> >         (mingetty-configuration
> >           (inherit config)
> >           (auto-login user))
> >         config)))
> > 
> > (define %my-desktop-services
> >   (modify-services %desktop-services
> > 
> > (mingetty-service-type config =>
> >                           (auto-login-
> > to-tty "3" "joshua"))))
> > #+END_SRC
> > 
> 
> Hmmm.  Is that (define (auto-login-to-tty tty user) ...) a
> closure?  I
> wonder why you need that lambda inside of it...Probably to pass the
> config variable into the function...hmmm.  I still don't understand
> why
> it is necessary.  I'll think about that a bit later on.
Yes, I've made it a bit more generic, so that you could also add let's
say (auto-login-to-tty "4" "nsa-backdoor") if you wanted ;)

You need a single-argument procedure in the config => proc part.  So
you generate a closure to do everything else.  You could do the same
with let-bindings inside the scope of modify-services, but I found it
more useful to extract that.

> > > #+BEGIN_SRC scheme
> > > (define (auto-login-to-tty-3 mingetty-service)
> > >   (if (string=? "3" (mingetty-configuration-tty config))
> > >       '(mingetty-configuration
> > >          (auto-login "joshua")
> > >          (tty "3"))
> > >       mingetty-service))
> > Don't quote mingetty-configuration et al.  They're first-class
> > syntax,
> > not just weird lists.
> 
> Yeah that's true.  I do actually like (guix records)!  I feel like
> that file should be upstreamed into guile!
Haha, yes, guixy records are a charm, but they're subject to quicker
iteration than guile's.

> > > (define (my-modify-%desktop-services-to-auto-login-on-tty-3
> > > %desktop-
> > > services)
> > >    ;; to be written
> > >    ;; though I think fold, or map, may be useful functions here.
> > > 
> > >    ;;somehow I will use this function...
> > >     (auto-login-to-tty-3 mingetty-service)
> > > )
> > > 
> > > (define %my-desktop-services
> > >         (my-modify-%desktop-services-to-auto-login-on-tty-3
> > > %desktop-
> > > services))
> > I don't think you need to implement modify-services on your own,
> > rather
> > just use the existing thing in the "correct" way – i.e. adhering to
> > the
> > expectations given by the already existing procedure (or macro).
> 
> 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 think the cookbook is a better destination for stuff like this.

Regards,
Leo





Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Fri, 02 Jul 2021 22:58:02 GMT) Full text and rfc822 format available.

Message #35 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: Joshua Branson <jbranso <at> dismail.de>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 48974 <at> debbugs.gnu.org
Subject: Re: bug#48974: A possible shepherd bug (it's very minor)
Date: Fri, 02 Jul 2021 18:57:38 -0400
Leo Prikler <leo.prikler <at> student.tugraz.at> writes:

> Am Freitag, den 25.06.2021, 14:06 -0400 schrieb Joshua Branson:
>> Leo Prikler <leo.prikler <at> student.tugraz.at> writes:
>>
>> > Hi,
>> >
>> > Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:
>> > > Leo Prikler <leo.prikler <at> student.tugraz.at> 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))
        (mingetty-configuration
         (inherit config))))

;; allegedly %desktop-services now contains network-manager-applet...?  Can I remove that?
(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?

Section Title:  Setting up automatic login for one tty 

The interested hacker, who wishes to set up automatic login to tty three
can use the following code snippet:

#+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))
        (mingetty-configuration
         (inherit config))))

(operating-system
  (host-name "dobby")
  ...
  (services
    (cons*
      (modify-services %base-services
        (mingetty-service-type config =>
                               (auto-login-to-tty "3" "joshua" config))))
#+END_SRC

>
> 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




Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Sat, 03 Jul 2021 06:42:01 GMT) Full text and rfc822 format available.

Message #38 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Joshua Branson <jbranso <at> dismail.de>
Cc: 48974 <at> debbugs.gnu.org
Subject: Re: bug#48974: A possible shepherd bug (it's very minor)
Date: Sat, 03 Jul 2021 08:41:08 +0200
Hi,

Am Freitag, den 02.07.2021, 18:57 -0400 schrieb Joshua Branson:
> Leo Prikler <leo.prikler <at> student.tugraz.at> writes:
> 
> > Am Freitag, den 25.06.2021, 14:06 -0400 schrieb Joshua Branson:
> > > Leo Prikler <leo.prikler <at> student.tugraz.at> writes:
> > > 
> > > > Hi,
> > > > 
> > > > Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:
> > > > > Leo Prikler <leo.prikler <at> student.tugraz.at> 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





Information forwarded to bug-guix <at> gnu.org:
bug#48974; Package guix. (Sat, 03 Jul 2021 07:38:01 GMT) Full text and rfc822 format available.

Message #41 received at 48974 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 48974 <at> debbugs.gnu.org, Joshua Branson <jbranso <at> dismail.de>
Subject: Re: bug#48974: A possible shepherd bug (it's very minor)
Date: Sat, 3 Jul 2021 09:37:02 +0200
Hi,

On Sat, Jul 03, 2021 at 08:41:08AM +0200, Leo Prikler wrote:
> Am Freitag, den 02.07.2021, 18:57 -0400 schrieb Joshua Branson:
> > ;; 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.

There is now a delete in modify-services by Ricardo as a247f5c.

The manual has an example:

(modify-services %desktop-services
  (delete avahi-service-type))

Regards,
Florian Pelz




Reply sent to Joshua Branson <jbranso <at> dismail.de>:
You have taken responsibility. (Tue, 06 Jul 2021 00:01:01 GMT) Full text and rfc822 format available.

Notification sent to Joshua Branson <jbranso <at> dismail.de>:
bug acknowledged by developer. (Tue, 06 Jul 2021 00:01:01 GMT) Full text and rfc822 format available.

Message #46 received at 48974-done <at> debbugs.gnu.org (full text, mbox):

From: Joshua Branson <jbranso <at> dismail.de>
To: 48974-done <at> debbugs.gnu.org
Subject: Re: bug#48974: A possible shepherd bug (it's very minor)
Date: Mon, 05 Jul 2021 19:59:43 -0400
Leo Prikler <leo.prikler <at> student.tugraz.at> writes:

> Hi,
>
> Am Freitag, den 02.07.2021, 18:57 -0400 schrieb Joshua Branson:
>> Leo Prikler <leo.prikler <at> student.tugraz.at> writes:
>> 
>> > Am Freitag, den 25.06.2021, 14:06 -0400 schrieb Joshua Branson:
>> > > Leo Prikler <leo.prikler <at> student.tugraz.at> writes:
>> > > 
>> > > > Hi,
>> > > > 
>> > > > Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:
>> > > > > Leo Prikler <leo.prikler <at> student.tugraz.at> 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
  




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 03 Aug 2021 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 259 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.