public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Cannot shutdown or reboot because of logind disconnection
@ 2022-09-17  2:40 johnstrass
  2022-09-17  6:15 ` Walter Dnes
  0 siblings, 1 reply; 9+ messages in thread
From: johnstrass @ 2022-09-17  2:40 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

Dear friends,


After compiling gcc,  I ran reboot or shutdown, and it shows
" Failed to reboot system via logind: connection timed out".


If use "systemctl daemon-reexec" or "systemctl daemon-reload", it shows "Failed to reload daemon: Transport endpoint is not connected".


Compiling gcc uses alot of memory, sometimes only less then 10MB left free ( I am doing this on a small yeeloong netbook with only 1GB memory).  This may cause the logind disconnected. However, after the compilation, there should be enough memery left. However the logind is still disconnected.


If this happens, what is the best way to reboot or shutdown?


Why does the systemd need logind to shutdown? Is it possible to design a way to just shutdown without access of the logind?


Thanks.

[-- Attachment #2: Type: text/html, Size: 1274 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Cannot shutdown or reboot because of logind disconnection
  2022-09-17  2:40 [gentoo-user] Cannot shutdown or reboot because of logind disconnection johnstrass
@ 2022-09-17  6:15 ` Walter Dnes
  2022-09-17  9:37   ` johnstrass
  2022-09-17 18:20   ` Frank Steinmetzger
  0 siblings, 2 replies; 9+ messages in thread
From: Walter Dnes @ 2022-09-17  6:15 UTC (permalink / raw
  To: gentoo-user

On Sat, Sep 17, 2022 at 10:40:53AM +0800, johnstrass wrote

> Compiling gcc uses alot of memory, sometimes only less then 10MB
> left free ( I am doing this on a small yeeloong netbook with only
> 1GB memory).

  Ouch, I'm surprised it compiles at all.  The Gentoo install handbook
https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#MAKEOPTS
has a dire warning about memory usage...

>  Warning
> Using a large number of jobs can significantly impact memory
> consumption. A good recommendation is to have at least 2 GiB of RAM
> for every job specified (so, e.g. -j6 requires at least 12 GiB). To
> avoid running out of memory, lower the number of jobs to fit the
> available memory.

  You simply don't have enough ram.  You might reduce the pain and the
swapping by trying something like the following in make.conf (assuming
you haven't already done it)

MAKEOPTS="-j1"

> If this happens, what is the best way to reboot or shutdown?

  Try ye olde {CTRL}{ALT}{DEL}

-- 
I've seen things, you people wouldn't believe; Gopher, Netscape with
frames, the first Browser Wars.  Searching for pages with AltaVista,
pop-up windows self-replicating, trying to uninstall RealPlayer.  All
those moments, will be lost in time like tears in rain... time to die.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re:Re: [gentoo-user] Cannot shutdown or reboot because of logind disconnection
  2022-09-17  6:15 ` Walter Dnes
@ 2022-09-17  9:37   ` johnstrass
  2022-09-17 11:11     ` tastytea
  2022-09-17 18:20   ` Frank Steinmetzger
  1 sibling, 1 reply; 9+ messages in thread
From: johnstrass @ 2022-09-17  9:37 UTC (permalink / raw
  To: gentoo-user, waltdnes

[-- Attachment #1: Type: text/plain, Size: 1816 bytes --]




At 2022-09-17 14:15:51, "Walter Dnes" <waltdnes@waltdnes.org> wrote:

>On Sat, Sep 17, 2022 at 10:40:53AM +0800, johnstrass wrote
>
>> Compiling gcc uses alot of memory, sometimes only less then 10MB
>> left free ( I am doing this on a small yeeloong netbook with only
>> 1GB memory).
>
>  Ouch, I'm surprised it compiles at all.  The Gentoo install handbook
>https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#MAKEOPTS
>has a dire warning about memory usage...

>



Yep, I've got the gcc-12.2.0 natively compiled on this netbook using gcc-11.3.0, after 5+ days + a crash + 5more days.

I set up a large swap and I've also set up the ccache which may speedup a little after the crash.


>>  Warning
>> Using a large number of jobs can significantly impact memory
>> consumption. A good recommendation is to have at least 2 GiB of RAM
>> for every job specified (so, e.g. -j6 requires at least 12 GiB). To
>> avoid running out of memory, lower the number of jobs to fit the
>> available memory.
>
>  You simply don't have enough ram.  You might reduce the pain and the
>swapping by trying something like the following in make.conf (assuming
>you haven't already done it)
>

>MAKEOPTS="-j1"


I will try next time. Thanks.


>
>> If this happens, what is the best way to reboot or shutdown?
>

>  Try ye olde {CTRL}{ALT}{DEL}




I remember that I did try "CTRL+ALT+DEL" in such situations before, and most times it did not work but for one or two times it worked occasionally. I will try it again next time.




>
>-- 
>I've seen things, you people wouldn't believe; Gopher, Netscape with
>frames, the first Browser Wars.  Searching for pages with AltaVista,
>pop-up windows self-replicating, trying to uninstall RealPlayer.  All
>those moments, will be lost in time like tears in rain... time to die.

[-- Attachment #2: Type: text/html, Size: 2597 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Cannot shutdown or reboot because of logind disconnection
  2022-09-17  9:37   ` johnstrass
@ 2022-09-17 11:11     ` tastytea
  2022-09-17 11:43       ` Michael
  0 siblings, 1 reply; 9+ messages in thread
From: tastytea @ 2022-09-17 11:11 UTC (permalink / raw
  To: gentoo-user

On 2022-09-17 17:37+0800 johnstrass  <johnstrass@163.com> wrote:

> At 2022-09-17 14:15:51, "Walter Dnes" <waltdnes@waltdnes.org> wrote:
> 
> >On Sat, Sep 17, 2022 at 10:40:53AM +0800, johnstrass wrote
> >  
> >> Compiling gcc uses alot of memory, sometimes only less then 10MB
> >> left free ( I am doing this on a small yeeloong netbook with only
> >> 1GB memory).  
> >
> >  Ouch, I'm surprised it compiles at all.  The Gentoo install
> > handbook
> >https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#MAKEOPTS
> >has a dire warning about memory usage...  
> 
> >  
> 
> 
> 
> Yep, I've got the gcc-12.2.0 natively compiled on this netbook using
> gcc-11.3.0, after 5+ days + a crash + 5more days.
> 
> I set up a large swap and I've also set up the ccache which may
> speedup a little after the crash.
> 
> 
> >>  Warning
> >> Using a large number of jobs can significantly impact memory
> >> consumption. A good recommendation is to have at least 2 GiB of RAM
> >> for every job specified (so, e.g. -j6 requires at least 12 GiB). To
> >> avoid running out of memory, lower the number of jobs to fit the
> >> available memory.  
> >
> >  You simply don't have enough ram.  You might reduce the pain and
> > the
> >swapping by trying something like the following in make.conf
> >(assuming you haven't already done it)
> >  
> 
> >MAKEOPTS="-j1"  
> 
> 
> I will try next time. Thanks.
> 
> 
> >  
> >> If this happens, what is the best way to reboot or shutdown?  
> >  
> 
> >  Try ye olde {CTRL}{ALT}{DEL}  
> 
> 
> 
> 
> I remember that I did try "CTRL+ALT+DEL" in such situations before,
> and most times it did not work but for one or two times it worked
> occasionally. I will try it again next time.

You could also use “Magic SysRQ”s[1] to reboot the system forcefully
but somewhat controlled. The traditional sequence is:
 r e i s u b    (raising elephants is so utterly boring)[2]

[1] <https://wiki.gentoo.org/wiki/Magic_SysRQ>
[2] <https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html#what-are-the-command-keys>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Cannot shutdown or reboot because of logind disconnection
  2022-09-17 11:11     ` tastytea
@ 2022-09-17 11:43       ` Michael
  2022-09-17 12:21         ` johnstrass
  0 siblings, 1 reply; 9+ messages in thread
From: Michael @ 2022-09-17 11:43 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2589 bytes --]

On Saturday, 17 September 2022 12:11:56 BST tastytea wrote:
> On 2022-09-17 17:37+0800 johnstrass  <johnstrass@163.com> wrote:
> > At 2022-09-17 14:15:51, "Walter Dnes" <waltdnes@waltdnes.org> wrote:
> > >On Sat, Sep 17, 2022 at 10:40:53AM +0800, johnstrass wrote
> > >
> > >> Compiling gcc uses alot of memory, sometimes only less then 10MB
> > >> left free ( I am doing this on a small yeeloong netbook with only
> > >> 1GB memory).
> > >> 
> > >  Ouch, I'm surprised it compiles at all.  The Gentoo install
> > > 
> > > handbook
> > >
> > >https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#MAKEOPTS
> > >has a dire warning about memory usage...
> > 
> > Yep, I've got the gcc-12.2.0 natively compiled on this netbook using
> > gcc-11.3.0, after 5+ days + a crash + 5more days.
> > 
> > I set up a large swap and I've also set up the ccache which may
> > speedup a little after the crash.
> > 
> > >>  Warning
> > >> 
> > >> Using a large number of jobs can significantly impact memory
> > >> consumption. A good recommendation is to have at least 2 GiB of RAM
> > >> for every job specified (so, e.g. -j6 requires at least 12 GiB). To
> > >> avoid running out of memory, lower the number of jobs to fit the
> > >> available memory.
> > >> 
> > >  You simply don't have enough ram.  You might reduce the pain and
> > > 
> > > the
> > >
> > >swapping by trying something like the following in make.conf
> > >(assuming you haven't already done it)
> > >
> > >
> > >MAKEOPTS="-j1"
> > 
> > I will try next time. Thanks.
> > 
> > >> If this happens, what is the best way to reboot or shutdown?
> > >> 
> > >  Try ye olde {CTRL}{ALT}{DEL}
> > 
> > I remember that I did try "CTRL+ALT+DEL" in such situations before,
> > and most times it did not work but for one or two times it worked
> > occasionally. I will try it again next time.
> 
> You could also use “Magic SysRQ”s[1] to reboot the system forcefully
> but somewhat controlled. The traditional sequence is:
>  r e i s u b    (raising elephants is so utterly boring)[2]
> 
> [1] <https://wiki.gentoo.org/wiki/Magic_SysRQ>
> [2]
> <https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html#what-are-the
> -command-keys>

Using MAKEOPTS="-j1" will help and a bigger swap will stop it crashing with 
OOM, but a more sensible solution is to compile and build big packages like 
gcc on a faster PC as binaries, then transfer and emerge on the slow PC with 
--usepkg, or --usepkgonly options.  More info:

https://wiki.gentoo.org/wiki/Binary_package_guide

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re:Re: [gentoo-user] Cannot shutdown or reboot because of logind disconnection
  2022-09-17 11:43       ` Michael
@ 2022-09-17 12:21         ` johnstrass
  2022-09-17 13:08           ` Rich Freeman
  0 siblings, 1 reply; 9+ messages in thread
From: johnstrass @ 2022-09-17 12:21 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 3212 bytes --]




OK. 


However, my real confusion or worry in fact is not the compilation of gcc, but about the logind. This obvious happens not only in compilation of gcc. Whenever there are programs consuming almost all the memory, the logind will be disconnected and not come back again. Why is the logind so fragile? Why cannot it be  brought up again after the memeory become available again? Or why should the systemd depend on such a faulty logind in order to do important jobs like shutdown? Don't you think it is a serious weakness of the system?














At 2022-09-17 19:43:54, "Michael" <confabulate@kintzios.com> wrote:
>On Saturday, 17 September 2022 12:11:56 BST tastytea wrote:
>> On 2022-09-17 17:37+0800 johnstrass  <johnstrass@163.com> wrote:
>> > At 2022-09-17 14:15:51, "Walter Dnes" <waltdnes@waltdnes.org> wrote:
>> > >On Sat, Sep 17, 2022 at 10:40:53AM +0800, johnstrass wrote
>> > >
>> > >> Compiling gcc uses alot of memory, sometimes only less then 10MB
>> > >> left free ( I am doing this on a small yeeloong netbook with only
>> > >> 1GB memory).
>> > >> 
>> > >  Ouch, I'm surprised it compiles at all.  The Gentoo install
>> > > 
>> > > handbook
>> > >
>> > >https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#MAKEOPTS
>> > >has a dire warning about memory usage...
>> > 
>> > Yep, I've got the gcc-12.2.0 natively compiled on this netbook using
>> > gcc-11.3.0, after 5+ days + a crash + 5more days.
>> > 
>> > I set up a large swap and I've also set up the ccache which may
>> > speedup a little after the crash.
>> > 
>> > >>  Warning
>> > >> 
>> > >> Using a large number of jobs can significantly impact memory
>> > >> consumption. A good recommendation is to have at least 2 GiB of RAM
>> > >> for every job specified (so, e.g. -j6 requires at least 12 GiB). To
>> > >> avoid running out of memory, lower the number of jobs to fit the
>> > >> available memory.
>> > >> 
>> > >  You simply don't have enough ram.  You might reduce the pain and
>> > > 
>> > > the
>> > >
>> > >swapping by trying something like the following in make.conf
>> > >(assuming you haven't already done it)
>> > >
>> > >
>> > >MAKEOPTS="-j1"
>> > 
>> > I will try next time. Thanks.
>> > 
>> > >> If this happens, what is the best way to reboot or shutdown?
>> > >> 
>> > >  Try ye olde {CTRL}{ALT}{DEL}
>> > 
>> > I remember that I did try "CTRL+ALT+DEL" in such situations before,
>> > and most times it did not work but for one or two times it worked
>> > occasionally. I will try it again next time.
>> 
>> You could also use “Magic SysRQ”s[1] to reboot the system forcefully
>> but somewhat controlled. The traditional sequence is:
>>  r e i s u b    (raising elephants is so utterly boring)[2]
>> 
>> [1] <https://wiki.gentoo.org/wiki/Magic_SysRQ>
>> [2]
>> <https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html#what-are-the
>> -command-keys>
>
>Using MAKEOPTS="-j1" will help and a bigger swap will stop it crashing with 
>OOM, but a more sensible solution is to compile and build big packages like 
>gcc on a faster PC as binaries, then transfer and emerge on the slow PC with 
>--usepkg, or --usepkgonly options.  More info:
>
>https://wiki.gentoo.org/wiki/Binary_package_guide

[-- Attachment #2: Type: text/html, Size: 4296 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [gentoo-user] Cannot shutdown or reboot because of logind disconnection
  2022-09-17 12:21         ` johnstrass
@ 2022-09-17 13:08           ` Rich Freeman
  2022-09-17 15:05             ` johnstrass
  0 siblings, 1 reply; 9+ messages in thread
From: Rich Freeman @ 2022-09-17 13:08 UTC (permalink / raw
  To: gentoo-user

On Sat, Sep 17, 2022 at 8:21 AM johnstrass <johnstrass@163.com> wrote:
>
>
> Why is the logind so fragile?

Have you checked your logs.  I'm guessing that the kernel OOM killer
is killing it, and it is kind of hard for a process to not die when
the kernel kills it.

> Why cannot it be  brought up again after the memeory become available again?

I suspect it probably could be - probably not a failure mode upstream
has paid much attention to.  If the OOM killer is loose on your
system, general breakage is to be expected.  It is actually surprising
though that it didn't go after gcc itself.  I'd check the logs.

You probably could tweak the unit setting so that logind is less
likely to get prioritized.  Then it might go after something less
essential like sshd or postfix.  :)

Also possible that it isn't logind itself but something else it uses
for IPC.  Haven't looked into the gory details of how it works.

I'm guessing systemd could be coaxed to shut down without it.  It
might actually do that on its own if you give it time, but I haven't
checked the settings.

-- 
Rich


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re:Re: Re: [gentoo-user] Cannot shutdown or reboot because of logind disconnection
  2022-09-17 13:08           ` Rich Freeman
@ 2022-09-17 15:05             ` johnstrass
  0 siblings, 0 replies; 9+ messages in thread
From: johnstrass @ 2022-09-17 15:05 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1436 bytes --]




Your answer seems to be on the right track I expected.





At 2022-09-17 21:08:21, "Rich Freeman" <rich0@gentoo.org> wrote:
>On Sat, Sep 17, 2022 at 8:21 AM johnstrass <johnstrass@163.com> wrote:
>>
>>
>> Why is the logind so fragile?
>
>Have you checked your logs.  I'm guessing that the kernel OOM killer
>is killing it, and it is kind of hard for a process to not die when
>the kernel kills it.
>
>> Why cannot it be  brought up again after the memeory become available again?
>
>I suspect it probably could be - probably not a failure mode upstream
>has paid much attention to.  If the OOM killer is loose on your
>system, general breakage is to be expected.  It is actually surprising
>though that it didn't go after gcc itself.  I'd check the logs.
>
>You probably could tweak the unit setting so that logind is less
>likely to get prioritized.  Then it might go after something less
>essential like sshd or postfix.  :)
>
>Also possible that it isn't logind itself but something else it uses
>for IPC.  Haven't looked into the gory details of how it works.
>
>I'm guessing systemd could be coaxed to shut down without it.  It
>might actually do that on its own if you give it time, but I haven't
>checked the settings.

>


If you have some clue, I would like to know how to coax it. 
If you would like to have a look at some logs on my machine, I would love to send them to you next time I meet such problems. 


>-- 
>Rich

[-- Attachment #2: Type: text/html, Size: 1855 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Cannot shutdown or reboot because of logind disconnection
  2022-09-17  6:15 ` Walter Dnes
  2022-09-17  9:37   ` johnstrass
@ 2022-09-17 18:20   ` Frank Steinmetzger
  1 sibling, 0 replies; 9+ messages in thread
From: Frank Steinmetzger @ 2022-09-17 18:20 UTC (permalink / raw
  To: gentoo-user

Am Sat, Sep 17, 2022 at 02:15:51AM -0400 schrieb Walter Dnes:
> On Sat, Sep 17, 2022 at 10:40:53AM +0800, johnstrass wrote
> 
> > Compiling gcc uses alot of memory, sometimes only less then 10MB
> > left free ( I am doing this on a small yeeloong netbook with only
> > 1GB memory).
> 
>   Ouch, I'm surprised it compiles at all.  The Gentoo install handbook
> https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#MAKEOPTS
> has a dire warning about memory usage...
> 
> […]
> 
>   You simply don't have enough ram.  You might reduce the pain and the
> swapping by trying something like the following in make.conf (assuming
> you haven't already done it)
> 
> MAKEOPTS="-j1"

You could also have a look at zram/zswap to compress your RAM content.
https://wiki.gentoo.org/wiki/Zram
https://wiki.archlinux.org/title/Zswap

-- 
Grüße | Greetings | Salut | Qapla’
There are two kinds of computer people: 1 and 0.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-09-17 18:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-17  2:40 [gentoo-user] Cannot shutdown or reboot because of logind disconnection johnstrass
2022-09-17  6:15 ` Walter Dnes
2022-09-17  9:37   ` johnstrass
2022-09-17 11:11     ` tastytea
2022-09-17 11:43       ` Michael
2022-09-17 12:21         ` johnstrass
2022-09-17 13:08           ` Rich Freeman
2022-09-17 15:05             ` johnstrass
2022-09-17 18:20   ` Frank Steinmetzger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox