[BUG] guix home: on foreign distro, ~/.bash_profile is not initialized

  • Open
  • quality assurance status badge
Details
3 participants
  • Andrew Tropin
  • florhizome
  • Liliana Marie Prikler
Owner
unassigned
Submitted by
florhizome
Severity
normal
F
F
florhizome wrote on 12 Mar 2022 14:07
(address . bug-guix@gnu.org)
878rtfjp4e.fsf@thinkpad-manjaro.mail-host-address-is-not-set
Hi guix' !
I have been trying to use guix home on my foreign distro partition
(manjaro); especially in order to set up additional profiles from
there, but my .bash_profile generated by guix doesn't seem to be
evaluated at all.

To describe the actual issue finally: None of the things that should happen through .bash_profile seem to
happen at the moment (it's just about different environment variables that
will not be set up.), but after running bash --login in my
terminal-emulator everything is as anticipated so my guess is that
.bash_profile actually isn't evaluated at all after login. I'm happy to hear
other suggestions and especially solutions.

I will attach the file that I use
for home configuration, as well as the current resulting .bashrc,
.bash_profile and .profile files.
I'm aware that there is duplicated code by the generated aliases in
.bashrc and that the prompt customization for guix profiles added by
the "guix-defaults?" field does not work due to other related code that comes afterwards but I'm not sure it's related to that main issue.
I did the original set up using "guix home import" which seems to have
improved since I tried last in december last year when the generated
file didn't work at all.
Manjaro has a lot of stuff in it's .bashrc that i didn't want to
override, and maybe there are more cases of duplication there that I
don't know about what harm they might introduce.

Greetings, Florian
(use-modules (gnu home) (gnu packages) (gnu packages base) (gnu services) (guix gexp) (gnu home services shells)) (define %enable-extra-profiles (plain-file "enable-profiles" "for i in $GUIX_EXTRA_PROFILES/*; do profile=$i/$(basename \"$i\") if [ -f \"$profile\"/etc/profile ]; then GUIX_PROFILE=\"$profile\" . \"$GUIX_PROFILE\"/etc/profile fi unset profile done")) (home-environment (services (list (service home-bash-service-type (home-bash-configuration (environment-variables '(("GUIX_EXTRA_PROFILES" . "/home/flo/.extra-profiles") ;;("ALTERNATE_EDITOR" . "\"\"") ("EDITOR" . "\"emacsclient -nw -q\"") ("VISUAL" . "\"emacsclient -c -a \"\"\"") ("GIT_EDITOR" . "\"emacs -nw -q\""))) (aliases '(("cp" . "cp -i") ("df" . "df -h") ("egrep='egrep --colour" . "auto") ("fgrep='fgrep --colour" . "auto") ("free" . "free -m") ("grep='grep --colour" . "auto") ("ls='ls --color" . "auto") ("more" . "less") ("np" . "nano -w PKGBUILD"))) (bashrc (list (local-file "/home/flo/.config/guix/home/.bashrc" "bashrc"))) (bash-profile (list %enable-extra-profiles)) (bash-logout (list (local-file "/home/flo/.config/guix/home/.bash_logout" "bash_logout"))))))))
HOME_ENVIRONMENT=$HOME/.guix-home
. $HOME_ENVIRONMENT/setup-environment
$HOME_ENVIRONMENT/on-first-login
Attachment: .bashrc
# Setups system and user profiles and related variables
# /etc/profile will be sourced by bash automatically
# Setups home environment profile
if [ -f ~/.profile ]; then source ~/.profile; fi

# Honor per-interactive-shell startup file
if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
for i in $GUIX_EXTRA_PROFILES/*; do
profile=$i/$(basename "$i")
if [ -f "$profile"/etc/profile ]; then
GUIX_PROFILE="$profile"
. "$GUIX_PROFILE"/etc/profile
fi
unset profile
done
export GUIX_EXTRA_PROFILES=/home/flo/.extra-profiles
export EDITOR="emacsclient -nw -q"
export VISUAL="emacsclient -c -a """
export GIT_EDITOR="emacs -nw -q"
L
L
Liliana Marie Prikler wrote on 12 Mar 2022 19:29
37831ee70559c60fd1d0545b621b5cc485185f5f.camel@gmail.com
Hi Florian

Am Samstag, dem 12.03.2022 um 13:07 +0000 schrieb florhizome:
Toggle quote (14 lines)
>
> Hi guix' !
> I have been trying to use guix home on my foreign distro partition
> (manjaro); especially in order to set up additional profiles from
> there, but my .bash_profile generated by guix doesn't seem to be
> evaluated at all.
>
> To describe the actual issue finally: None of the things that should
> happen through .bash_profile seem to happen at the moment (it's just
> about different environment variables that will not be set up.), but
> after running bash --login in my terminal-emulator everything is as
> anticipated so my guess is that .bash_profile actually isn't evaluated
> at all after login. I'm happy to hear other suggestions and especially
> solutions.
This looks vaguely like a problem others (myself included) have
experienced/are experiencing on Ubuntu. See [1] among others.

Given that bash is not used for login, your environment-variables block
has not effect. Now if you were to define that inside a variable, you
could also write up a service that generates systemd unit overrides and
add those definitions to it. I'm not sure how well-received such a
service would be upstream given that we don't use systemd in Guix, but
it's a point to start.

Cheers

F
F
florhizome wrote on 20 Mar 2022 15:09
8735jcd8bx.fsf@thinkpad-manjaro.mail-host-address-is-not-set
Hi Liliana,

Hm, well it doesn't seem like the exact same issue, but that thread is
helpful. Could systemd/logind be made to use bash for login? For now I thought maybe I can just write shepherd services to do
that stuff for me, to stay in guix homes framework. But shepherd seems
to have a problem starting up:

/gnu/store/y85vzni5yc6lcb7qqhmlkifis9nzmm5l-shepherd.conf wird geladen.
herd: Ausnahmefehler während der Ausführung von »load« mit dem Dienst »root«:
In procedure fport_write: Eingabe-/Ausgabefehler

If you don't speak german, that roughly translates to:

loading /gnu/store/...-shepherd.conf
herd: exception error during the execution of <<load>> with the service
<<root>>:
In procedure fport_write: i/o error

I got the same error when reconfiguring with two differing simple
service configurations (just start a program from a package) passed to shepherd.
In anyway I think it would be good to add to guix home's documentation that some features might not work
due to the login system of a foreign distro if we are sure of that?

cheers


Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (30 lines)
> Hi Florian
>
> Am Samstag, dem 12.03.2022 um 13:07 +0000 schrieb florhizome:
>>
>> Hi guix' !
>> I have been trying to use guix home on my foreign distro partition
>> (manjaro); especially in order to set up additional profiles from
>> there, but my .bash_profile generated by guix doesn't seem to be
>> evaluated at all.
>>
>> To describe the actual issue finally: None of the things that should
>> happen through .bash_profile seem to happen at the moment (it's just
>> about different environment variables that will not be set up.), but
>> after running bash --login in my terminal-emulator everything is as
>> anticipated so my guess is that .bash_profile actually isn't evaluated
>> at all after login. I'm happy to hear other suggestions and especially
>> solutions.
> This looks vaguely like a problem others (myself included) have
> experienced/are experiencing on Ubuntu. See [1] among others.
>
> Given that bash is not used for login, your environment-variables block
> has not effect. Now if you were to define that inside a variable, you
> could also write up a service that generates systemd unit overrides and
> add those definitions to it. I'm not sure how well-received such a
> service would be upstream given that we don't use systemd in Guix, but
> it's a point to start.
>
> Cheers
>
> [1] https://issues.guix.gnu.org/48300#7
A
A
Andrew Tropin wrote on 18 Oct 2022 10:47
Re: bug#54354: [BUG] guix home: on foreign distro, ~/.bash_profile is not initialized
871qr5a572.fsf@trop.in
On 2022-03-20 14:09, florhizome wrote:

Toggle quote (5 lines)
> Hi Liliana,
>
> Hm, well it doesn't seem like the exact same issue, but that thread is
> helpful. Could systemd/logind be made to use bash for login?

Login shell is usually controlled by /etc/passwd, so it shouldn't
inerfer with systemd, elogind.

Toggle quote (21 lines)
> For now I thought maybe I can just write shepherd services to do
> that stuff for me, to stay in guix homes framework. But shepherd seems
> to have a problem starting up:
>
> /gnu/store/y85vzni5yc6lcb7qqhmlkifis9nzmm5l-shepherd.conf wird geladen.
> herd: Ausnahmefehler während der Ausführung von »load« mit dem Dienst »root«:
> In procedure fport_write: Eingabe-/Ausgabefehler
>
> If you don't speak german, that roughly translates to:
>
> loading /gnu/store/...-shepherd.conf
> herd: exception error during the execution of <<load>> with the service
> <<root>>:
> In procedure fport_write: i/o error
>
> I got the same error when reconfiguring with two differing simple
> service configurations (just start a program from a package) passed to shepherd.
> In anyway I think it would be good to add to guix home's documentation that some features might not work
> due to the login system of a foreign distro if we are sure of that?
>

There were a few fixes related to shepherd service, which probably fixes
it. Can you confirm this? Or issue is still valid?

Is the whole issue 54354 still valid?

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmNOaDIACgkQIgjSCVjB
3rDT5w//c0UpYYImC49ezMpYjUE9J4AmBpCYPVqXKaXA6gs7sAKHsx08jgJyljfM
xNtt+yPlGQK5ZU0rc6eP3IyD4uV7XFHV3xm4tFegND6Wnww7AFt/Y01/ukApxA4F
2P7pd0aOcV/x+0av98NHOZY0t4qvo5VMw5jewf534kDDFuoj/Bs6mQjnj2B/FJo1
vcPMAhhxbcXMRhRnZTGCEGrn/rqAvRl0AUHMSWV8Hl6LipMdRJ/Fe40ak3MAZoxD
kx4X1twHGY++q3X104DWDKyqmL52bBxw8nIf03YJYaYNgKgjt76I249gFPz0Zot6
M5Z785VEhm4Clv5ms/QOhV/s82TZuEmVPx+UZN28zu1jMPOAb1umBtyB8g8TXlm4
DVL1EIVHhzjWpIhjON3LNDi8rCVpJEmXZs1PnjSFnXkJCL7DmejFAaMiZZg9qhvq
vbP6D4iswz1X49yV7rEXVXyZRRJMQYjDJ1H90soBSw7Jl3z3jcNQ2uAZGQhmboml
TjY4Kl2/t9rR5szM0hA52ZcV5+U0Kq8SJCPXuktfBlp0bhWNMaVhHnOZtlkuyt/3
eC4lx1fL6ExGF3Vl52qrfwTfhNHRK+pEyMk/LuNVlAUe8bWB+EBxL96uapAYq+3t
bSoSgyrJMNMpcC1DOs9ivdZOdmJbdKetXhZW36g08p+UDI3asYc=
=+qUm
-----END PGP SIGNATURE-----

?