A possible shepherd bug (it's very minor)

DoneSubmitted by Joshua Branson.
Details
3 participants
  • Joshua Branson
  • Leo Prikler
  • pelzflorian (Florian Pelz)
Owner
unassigned
Severity
normal
J
J
Joshua Branson wrote on 12 Jun 15:26 +0200
(address . bug-guix@gnu.org)
87wnqz43k0.fsf@dismail.de
Hello!
I've had this issue every since I enabled automatic login on my guixsystem 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 shThis is the GNU system. Welcomedobby 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 desktopservices. So mingetty tries to log me in, before many of the desktopservices are started. However, I guess this doesn't work. Meaning,my autostart sway script is NOT run, until AFTER all of the desktopservices are started. WHICH IS PROBABLY A GOOD IDEA. I would ratherlog in, when my desktop services have started, not before.
BUT the minor issue is that after I log in, =users= reports:
#+BEGIN_SRC shjoshua@dobby ~> usersjoshua joshua joshua joshua joshua joshua#+END_SRC
So it looks like 6 versions of myself are logged in by the time I amofficially logged in and I auto start sway via .bash_profile:
#+BEGING_SRC sh# Honor per-interactive-shell startup fileif [ -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 swayfi#+END_SRC

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

Thanks!
Joshua Branson
L
L
Leo Prikler wrote on 12 Jun 21:39 +0200
9d5c5334eacfae92ace38329e55bc4a91929e206.camel@student.tugraz.at
Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua Branson:
Toggle quote (19 lines)> 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 withshepherd, your config looks seriously borked. Why are you asking Guixto autologin you on *every available console*?
Regards,Leo
J
J
jbranso wrote on 12 Jun 22:09 +0200
3192d62ef790c16fb2dfb894d9ccb160@dismail.de
June 12, 2021 3:39 PM, "Leo Prikler" <leo.prikler@student.tugraz.at> wrote:
Toggle quote (24 lines)> 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! :)
Toggle quote (3 lines)> 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 Icouldn'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 writethe 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
Toggle quote (2 lines)> Regards,> Leo
L
L
Leo Prikler wrote on 12 Jun 23:13 +0200
13bff20e418f1cec97cdda49ffed51544c5c9402.camel@student.tugraz.at
Hi,
Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso@dismail.de:
Toggle quote (42 lines)> June 12, 2021 3:39 PM, "Leo Prikler" <leo.prikler@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 usuallysuspend it with programs such as vlock, plus it's expected that youactually sit in front of the given TTY when the autologin happens. With all TTYs though, anyone could switch to the other and "lol, nowI'm jbranso". The only configuration, that could possibly be worse isautologin root :P
(Granted, it probably still takes physical access to exploit, but it'ssomething your family/friends could likely do just to troll you.)
Toggle quote (5 lines)> 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 whetherthat's on your config or on shepherd. Using TTY1 for graphical stuffis also somewhat rare in Guix land, I presume. (Or rather, I can'tthink 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, butone that you'd need to build from primitives such as record accessors.
Regards,Leo
J
J
jbranso wrote on 13 Jun 01:34 +0200
5b82fa9b2ea3ec800d450975e9637fe2@dismail.de
June 12, 2021 5:13 PM, "Leo Prikler" <leo.prikler@student.tugraz.at> wrote:
Toggle quote (15 lines)> Hi,> > Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso@dismail.de:> >> June 12, 2021 3:39 PM, "Leo Prikler" <leo.prikler@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?
Toggle quote (7 lines)> > 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!
Toggle quote (3 lines)> > Regards,> Leo
L
L
Leo Prikler wrote on 13 Jun 09:48 +0200
6ab68c00bdc9a26db8b63d91898ba3d0ff5d43e3.camel@student.tugraz.at
Am Samstag, den 12.06.2021, 23:34 +0000 schrieb jbranso@dismail.de:
Toggle quote (23 lines)> June 12, 2021 5:13 PM, "Leo Prikler" <leo.prikler@student.tugraz.at>> wrote:> > > Hi,> > > > Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso@dismail.de:> > > > > June 12, 2021 3:39 PM, "Leo Prikler" <> > > leo.prikler@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 toreceive all the debug stuff and won't be particularly useful), so justpick your favourite. (The installer has TTY2 dedicated to the manualand TTY3 the first console if that helps with your decision.)
Toggle quote (13 lines)> > 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
J
J
Joshua Branson wrote on 25 Jun 11:31 +0200
Re: bug#48974: A possible shepherd bug (it's very minor)
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 48974@debbugs.gnu.org)
87mtre5lzy.fsf@dismail.de
Leo Prikler <leo.prikler@student.tugraz.at> writes:
Toggle quote (27 lines)> Hi,>> Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso@dismail.de:>> June 12, 2021 3:39 PM, "Leo Prikler" <leo.prikler@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 itwere a procedure. In fact, it is a macro. :)
I'm just popping in to give you an update on my progress. I've probablyspent less than 20 minutes working on this. The good news is I did findthe 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 helpenough other people get what they want." - Zig Ziglar
L
L
Leo Prikler wrote on 25 Jun 11:56 +0200
(name . Joshua Branson)(address . jbranso@dismail.de)(address . 48974@debbugs.gnu.org)
6254e4d32697986bd61986e10399f341930c5c2e.camel@student.tugraz.at
Hi,
Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:
Toggle quote (57 lines)> Leo Prikler <leo.prikler@student.tugraz.at> writes:> > > Hi,> > > > Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso@dismail.de:> > > June 12, 2021 3:39 PM, "Leo Prikler" <> > > leo.prikler@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 facta 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

Toggle quote (7 lines)> #+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.
Toggle quote (12 lines)> (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, ratherjust use the existing thing in the "correct" way – i.e. adhering to theexpectations given by the already existing procedure (or macro).
Toggle quote (1 lines)> #+END_SRC
Regards,Leo
J
J
Joshua Branson wrote on 25 Jun 20:06 +0200
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 48974@debbugs.gnu.org)
875yy1vmy7.fsf@dismail.de
Leo Prikler <leo.prikler@student.tugraz.at> writes:
Toggle quote (47 lines)> Hi,>> Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:>> Leo Prikler <leo.prikler@student.tugraz.at> writes:>>>> > Hi,>> >>> > Am Samstag, den 12.06.2021, 20:09 +0000 schrieb jbranso@dismail.de:>> > > June 12, 2021 3:39 PM, "Leo Prikler" <>> > > leo.prikler@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 recordconstructors for endlessh and my almost complete sway service:
http://issues.guix.gnu.org/39136https://notabug.org/jbranso/guix-config/src/master/sway-service.scm
Toggle quote (7 lines)>> 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!
Toggle quote (16 lines)> (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? Iwonder why you need that lambda inside of it...Probably to pass theconfig variable into the function...hmmm. I still don't understand whyit is necessary. I'll think about that a bit later on.
Toggle quote (11 lines)>>> #+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 thatfile should be upstreamed into guile!
Toggle quote (17 lines)>>> (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 tryusing match-lambda to define it. I'll post again when I have a freemoment. When i get it working, I'll send a patch to the manual viaguix-patches and CC you. Is that ok? Or would you rather thatdocumentation be in the cookbook?
Toggle quote (5 lines)>> #+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 helpenough other people get what they want." - Zig Ziglar
L
L
Leo Prikler wrote on 25 Jun 20:28 +0200
(name . Joshua Branson)(address . jbranso@dismail.de)(address . 48974@debbugs.gnu.org)
595245e54b3199173b9e47992d770caa4f807312.camel@student.tugraz.at
Am Freitag, den 25.06.2021, 14:06 -0400 schrieb Joshua Branson:
Toggle quote (91 lines)> Leo Prikler <leo.prikler@student.tugraz.at> writes:> > > Hi,> > > > Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:> > > Leo Prikler <leo.prikler@student.tugraz.at> writes:> > > > > > > Hi,> > > > > > > > Am Samstag, den 12.06.2021, 20:09 +0000 schrieb > > > > jbranso@dismail.de:> > > > > June 12, 2021 3:39 PM, "Leo Prikler" <> > > > > leo.prikler@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'ssay (auto-login-to-tty "4" "nsa-backdoor") if you wanted ;)
You need a single-argument procedure in the config => proc part. Soyou generate a closure to do everything else. You could do the samewith let-bindings inside the scope of modify-services, but I found itmore useful to extract that.
Toggle quote (13 lines)> > > #+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 quickeriteration than guile's.
Toggle quote (25 lines)> > > (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 inelegantway? I'm perfectly fine with the latter as I'm not the one using thecode :PI think the cookbook is a better destination for stuff like this.
Regards,Leo
J
J
Joshua Branson wrote on 3 Jul 00:57 +0200
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 48974@debbugs.gnu.org)
87y2ao728t.fsf@dismail.de
Leo Prikler <leo.prikler@student.tugraz.at> writes:
Toggle quote (17 lines)> Am Freitag, den 25.06.2021, 14:06 -0400 schrieb Joshua Branson:>> Leo Prikler <leo.prikler@student.tugraz.at> writes:>>>> > Hi,>> >>> > Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:>> > > Leo Prikler <leo.prikler@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
Toggle quote (2 lines)> 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 thefollowing 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 andinstead 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 threecan 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
Toggle quote (5 lines)>> 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 helpenough other people get what they want." - Zig Ziglar
L
L
Leo Prikler wrote on 3 Jul 08:41 +0200
(name . Joshua Branson)(address . jbranso@dismail.de)(address . 48974@debbugs.gnu.org)
deb1742076cc32ed4113dcae8a1a35a83797c2a9.camel@student.tugraz.at
Hi,
Am Freitag, den 02.07.2021, 18:57 -0400 schrieb Joshua Branson:
Toggle quote (33 lines)> Leo Prikler <leo.prikler@student.tugraz.at> writes:> > > Am Freitag, den 25.06.2021, 14:06 -0400 schrieb Joshua Branson:> > > Leo Prikler <leo.prikler@student.tugraz.at> writes:> > > > > > > Hi,> > > > > > > > Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:> > > > > Leo Prikler <leo.prikler@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? Seemslike a pointless allocation to me.
Toggle quote (5 lines)> (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 manualas well.
Toggle quote (47 lines)> (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, noteven their own.
The thing we've coded up here is a more involved process to solve aparticular problem rather than a general demo of what services can doand thus belongs to the cookbook.
Regards,Leo
P
P
pelzflorian (Florian Pelz) wrote on 3 Jul 09:37 +0200
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)
20210703073702.r2dzvvkf7biqytds@pelzflorian.localdomain
Hi,
On Sat, Jul 03, 2021 at 08:41:08AM +0200, Leo Prikler wrote:
Toggle quote (6 lines)> 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
J
J
Joshua Branson wrote on 6 Jul 01:59 +0200
(address . 48974-done@debbugs.gnu.org)
87zgv01fdc.fsf@dismail.de
Leo Prikler <leo.prikler@student.tugraz.at> writes:
Toggle quote (105 lines)> Hi,>> Am Freitag, den 02.07.2021, 18:57 -0400 schrieb Joshua Branson:>> Leo Prikler <leo.prikler@student.tugraz.at> writes:>> >> > Am Freitag, den 25.06.2021, 14:06 -0400 schrieb Joshua Branson:>> > > Leo Prikler <leo.prikler@student.tugraz.at> writes:>> > > >> > > > Hi,>> > > > >> > > > Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson:>> > > > > Leo Prikler <leo.prikler@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 helpenough other people get what they want." - Zig Ziglar
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 48974@debbugs.gnu.org