shutter-project / shutter

Screenshot tool for Linux
https://shutter-project.org/
GNU General Public License v3.0
504 stars 34 forks source link

Shutter crashes on startup on NixOS #486

Open refaelsh opened 2 years ago

refaelsh commented 2 years ago

I use NixOS. Version: 0.99.2 Rev.1593. Here is the error when I run shutter:

> shutter
.
.
.
Current window manager: i3

type_changed was emitted by widget Gtk3::ComboBoxText=HASH(0x6186ca8)

qvalue_changed was emitted by widget Gtk3::HScale=HASH(0x6186df8)
Can't use an undefined value as an ARRAY reference at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 4932, <DATA> line 19.
    Shutter::App::fct_get_program_model() called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 1408
    Shutter::App::STARTUP(Shutter::App=HASH(0x5ddc6e8)) called at /nix/store/gl2h6v49mk4zn6y0kk88id2kr32d9fjl-perl5.34.1-Glib-Object-Introspection-0.049/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 67
    Glib::Object::Introspection::__ANON__(Shutter::App=HASH(0x5ddc6e8)) called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 10943
fish: Job 1, 'shutter' terminated by signal SIGSEGV (Address boundary error)

>

Help please :-)

Photon89 commented 2 years ago

Sounds similar to https://github.com/shutter-project/shutter/issues/349

refaelsh commented 2 years ago

Sounds similar to #349

Similar, but:

  1. The error in my case is different.
  2. I use NixOS and there he uses Arch.

P.S. I will subscribe to that issue.

Photon89 commented 2 years ago

The last few lines of the output in https://github.com/shutter-project/shutter/issues/349#issuecomment-856599930 are actually almost identical. I think, we need to wait for @DarthGandalf to have a look, but I'd boldly assume that he will ask for a gdb trace (directions see in https://github.com/shutter-project/shutter/issues/349#issuecomment-856557091 and thereafter).

refaelsh commented 2 years ago

Here is what happens when I run gdb:

> gdb --args perl /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from perl...
(No debugging symbols found in perl)
(gdb) run
Starting program: /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/perl /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/libthread_db.so.1".
Unrecognized character \x7F; marked by <-- HERE after <-- HERE near column 1 at /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter line 1.
[Inferior 1 (process 25615) exited with code 0377]
(gdb)
Photon89 commented 2 years ago

Might be some NixOS specific problem which breaks the gdb output, see https://github.com/NixOS/hydra/issues/200 Is there some way to report this bug against the NixOS Shutter package? Possibly the NixOS guys know the packaging specifics which enter the game here better.

refaelsh commented 2 years ago

Might be some NixOS specific problem which breaks the gdb output, see NixOS/hydra#200 Is there some way to report this bug against the NixOS Shutter package? Possibly the NixOS guys know the packaging specifics which enter the game here better.

Hmm... Good theory. I will go and google gdb on NixOS.

refaelsh commented 2 years ago

Might be some NixOS specific problem which breaks the gdb output, see NixOS/hydra#200 Is there some way to report this bug against the NixOS Shutter package? Possibly the NixOS guys know the packaging specifics which enter the game here better.

I've dropped an email to the NixOS package maintainer of shutter.

Photon89 commented 2 years ago

Great, keep us posted! Maybe point the package maintainer to this report so we can figure out a solution together, if you haven't done so already.

bjornfor commented 2 years ago

Hi @refaelsh, I got your email. (I'm a maintainer of shutter in nixpkgs.)

I just ran Shutter in NixOS 22.05 with a GNOME desktop environment, and it seems to work fine there -- no crash, I was able to make a screenshot.

Some questions to hopefully narrow things down:

bjornfor commented 2 years ago

@refaelsh: I was able to obtain the very same shutter as you run, with nix-store -r /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2. That one also works for me in NixOS 22.05 with GNOME desktop. I think that means something in the runtime environment of the program breaks it.

Can you try running env -i DISPLAY=$DISPLAY /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/shutter? What happens then? On my side the app starts up, but with a more "barebones" theme. When I try to take a screenshot it shows an error message -- probably it lacks one or more environment variables to hook it up to something on the system (dbus?) -- but the point is with such a minimal env the app at least shouldn't fail by itself with a SEGFAULT and we can shrink the problem space further.

Photon89 commented 2 years ago

@bjornfor Thanks for the quick reply! I think, the original problem is related to the i3 environment, but what might be a problem in NixOS is the gdb failure in https://github.com/shutter-project/shutter/issues/486#issuecomment-1171560810.

DarthGandalf commented 2 years ago

DBus should be necessary only if you use wayland. X shouldn't require dbus... You're using X or wayland?

bjornfor commented 2 years ago

[...] but what might be a problem in NixOS is the gdb failure in https://github.com/shutter-project/shutter/issues/486#issuecomment-1171560810.

Ah, that's because nixpkgs recently switched to binary wrappers. So drop perl from the command line and do this instead:

$ gdb --args /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/shutter

When using binary wrappers that shutter program is actually a small ELF file that sets a few env vars and then invokes perl /the/real/shutter.

The wrapper invocation can be extracted from the program like this:

strings /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/shutter | sed -n '/------------------------------------------------------------------------------------/,/------------------------------------------------------------------------------------/p'
# ------------------------------------------------------------------------------------
# The C-code for this binary wrapper has been generated using the following command:
makeCWrapper '/nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped' \
[...]

(Wrappers are not as transparent as I'd like them to be.)

bjornfor commented 2 years ago

I just learned about gdb set follow-exec-mode new, which is useful when debugging nixpkgs binary wrappers.

bjornfor commented 2 years ago

I just learned about gdb set follow-exec-mode new, which is useful when debugging nixpkgs binary wrappers.

Example:

$ gdb --args /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/shutter
[...]
(gdb) set follow-exec-mode new
(gdb) b main
Breakpoint 1 at 0x4010c0
(gdb) r
Starting program: /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/shutter
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/f6kvkdzp6qfjm6h94d0jgfvm4r06xcaq-glibc-2.34-210/lib/libthread_db.so.1".

Breakpoint 1, 0x00000000004010c0 in main ()
(gdb) c
Continuing.
process 1169505 is executing new program: /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/bin/perl
[New inferior 2]
[New process 1169505]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/f6kvkdzp6qfjm6h94d0jgfvm4r06xcaq-glibc-2.34-210/lib/libthread_db.so.1".

Thread 2.1 ".shutter-wrappe" hit Breakpoint 1, 0x0000000000401100 in main ()
(gdb)

So now we're in the perl process.

refaelsh commented 2 years ago
* Which NixOS version are you using?

22.05

* Which desktop environment?

i3

* Are you mixing nixpkgs versions (like stable and unstable channel) in your system?

Not as far as I know. During installation I choose stable, then about 2 weeks after changed to unstable. That's it.

refaelsh commented 2 years ago

Here what happens when I run what you asked:

❯ env -i DISPLAY=$DISPLAY /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/shutter
Subroutine Pango::Layout::set_text redefined at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 2299.
    require Gtk3.pm called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    Shutter::App::BEGIN() called at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 2299
    eval {...} called at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 2299
Subroutine Pango::Layout::set_markup redefined at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 2305.
    require Gtk3.pm called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    Shutter::App::BEGIN() called at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 2305
    eval {...} called at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 2305
GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /nix/store/gl2h6v49mk4zn6y0kk88id2kr32d9fjl-perl5.34.1-Glib-Object-Introspection-0.049/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 110.
 at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    Shutter::App::BEGIN() called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    eval {...} called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed at /nix/store/gl2h6v49mk4zn6y0kk88id2kr32d9fjl-perl5.34.1-Glib-Object-Introspection-0.049/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 110.
 at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    Shutter::App::BEGIN() called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    eval {...} called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /nix/store/gl2h6v49mk4zn6y0kk88id2kr32d9fjl-perl5.34.1-Glib-Object-Introspection-0.049/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 110.
 at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    Shutter::App::BEGIN() called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    eval {...} called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed at /nix/store/gl2h6v49mk4zn6y0kk88id2kr32d9fjl-perl5.34.1-Glib-Object-Introspection-0.049/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 110.
 at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    Shutter::App::BEGIN() called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    eval {...} called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /nix/store/gl2h6v49mk4zn6y0kk88id2kr32d9fjl-perl5.34.1-Glib-Object-Introspection-0.049/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 110.
 at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    Shutter::App::BEGIN() called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    eval {...} called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed at /nix/store/gl2h6v49mk4zn6y0kk88id2kr32d9fjl-perl5.34.1-Glib-Object-Introspection-0.049/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 110.
 at /nix/store/bib30rikampg83z5krzksp4dak6pmdb5-perl5.34.1-Gtk3-0.038/lib/perl5/site_perl/5.34.1/Gtk3.pm line 489.
    Gtk3::import("Gtk3", "-init") called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    Shutter::App::BEGIN() called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
    eval {...} called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 72
No protocol specified

(.shutter-wrapped:148957): Gtk-WARNING **: 21:15:41.008: cannot open display: :0

❯
refaelsh commented 2 years ago

DBus should be necessary only if you use wayland. X shouldn't require dbus... You're using X or wayland?

I am using X.

refaelsh commented 2 years ago

[...] but what might be a problem in NixOS is the gdb failure in #486 (comment).

Ah, that's because nixpkgs recently switched to binary wrappers. So drop perl from the command line and do this instead:

$ gdb --args /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/shutter

When using binary wrappers that shutter program is actually a small ELF file that sets a few env vars and then invokes perl /the/real/shutter.

The wrapper invocation can be extracted from the program like this:

strings /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/shutter | sed -n '/------------------------------------------------------------------------------------/,/------------------------------------------------------------------------------------/p'
# ------------------------------------------------------------------------------------
# The C-code for this binary wrapper has been generated using the following command:
makeCWrapper '/nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped' \
[...]

(Wrappers are not as transparent as I'd like them to be.)

Here is the result of gdb:

$ gdb --args /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter
.
.
.
Current window manager: i3
Current window manager: i3
Current window manager: i3
Current window manager: i3
[New Thread 0x7fffda54b640 (LWP 149481)]

type_changed was emitted by widget Gtk3::ComboBoxText=HASH(0x4e1d518)

qvalue_changed was emitted by widget Gtk3::HScale=HASH(0x4e14e90)
[New Thread 0x7fffdad4c640 (LWP 149482)]
[New Thread 0x7fffdb54d640 (LWP 149483)]
Can't use an undefined value as an ARRAY reference at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 4932, <DATA> line 19.
    Shutter::App::fct_get_program_model() called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 1408
    Shutter::App::STARTUP(Shutter::App=HASH(0x4becc08)) called at /nix/store/gl2h6v49mk4zn6y0kk88id2kr32d9fjl-perl5.34.1-Glib-Object-Introspection-0.049/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 67
    Glib::Object::Introspection::__ANON__(Shutter::App=HASH(0x4becc08)) called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 10943
[New Thread 0x7fffd97ee640 (LWP 149484)]
[New Thread 0x7fffd8fed640 (LWP 149485)]
[New Thread 0x7fffc3fff640 (LWP 149486)]
[Thread 0x7fffd97ee640 (LWP 149484) exited]
[New Thread 0x7fffd97ee640 (LWP 149487)]
[Thread 0x7fffc3fff640 (LWP 149486) exited]
[Thread 0x7fffd97ee640 (LWP 149487) exited]
[Thread 0x7fffd8fed640 (LWP 149485) exited]

Thread 1 ".shutter-wrappe" received signal SIGSEGV, Segmentation fault.
0x00007fffea181acc in signal_emit_unlocked_R () from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
(gdb)
Photon89 commented 2 years ago

I think, we need the steps described by @bjornfor in https://github.com/shutter-project/shutter/issues/486#issuecomment-1172872461 now!

refaelsh commented 2 years ago

I think, we need the steps described by @bjornfor in #486 (comment) now!

Sure. Here it is:

❯ gdb --args /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter...
(No debugging symbols found in /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter)
(gdb) set follow-exec-mode new
(gdb) b main
Breakpoint 1 at 0x4010c0
(gdb) r
Starting program: /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/libthread_db.so.1".

Breakpoint 1, 0x00000000004010c0 in main ()
(gdb) c
Continuing.
process 169959 is executing new program: /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/bin/perl
[New inferior 2]
[New process 169959]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/libthread_db.so.1".

Thread 2.1 ".shutter-wrappe" hit Breakpoint 1, 0x0000000000401100 in main ()
(gdb)
Photon89 commented 2 years ago

Ok! I think, now we want

(gdb) run

then it will crash and then we get a

(gdb) bt full

refaelsh commented 2 years ago

Ok! I think, now we want

(gdb) run

then it will crash and then we get a

(gdb) bt full

Here is what happens when I type run:

.
.
.
Breakpoint 1, 0x00000000004010c0 in main ()
(gdb) c
Continuing.
process 172043 is executing new program: /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/bin/perl
[New inferior 2]
[New process 172043]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/libthread_db.so.1".

Thread 2.1 ".shutter-wrappe" hit Breakpoint 1, 0x0000000000401100 in main ()
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n)

Should I press y or n?

Photon89 commented 2 years ago

I'm not really sure how it works in this setting, but let's try it with y! :smiley:

refaelsh commented 2 years ago

I'm not really sure how it works in this setting, but let's try it with y! smiley

Here is what happens when pressing y:

(gdb) c
Continuing.
process 172043 is executing new program: /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/bin/perl
[New inferior 2]
[New process 172043]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/libthread_db.so.1".

Thread 2.1 ".shutter-wrappe" hit Breakpoint 1, 0x0000000000401100 in main ()
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/bin/perl
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/libthread_db.so.1".

Breakpoint 1, 0x0000000000401100 in main ()
(gdb)
Photon89 commented 2 years ago

Ok, since it is stuck at a breakpoint again, let's give it a

(gdb) c

to continue

refaelsh commented 2 years ago

Ok, since it is stuck at a breakpoint again, let's give it a

(gdb) c

to continue

(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/bin/perl
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/libthread_db.so.1".

Breakpoint 1, 0x0000000000401100 in main ()
(gdb) c
Continuing.

This is stuck like this for the last 15 minutes approximately.

Photon89 commented 2 years ago

I fear, I'm out of ideas, things seem to work in strange ways in NixOS, maybe @bjornfor can help again!

bjornfor commented 2 years ago

@refaelsh: So you don't get the SEGFAULT when running under GDB?

I was going to suggest using set follow-exec-mode new again, but I did a little test locally with some dummy code and if the program being exec'd hits a SEGFAULT then GDB stops where the program is anyway (and you can run bt full). (So I guess set follow-exec-mode new is more useful when you want to single-step / debug before receiving a fatal signal.)

refaelsh commented 2 years ago

@refaelsh: So you don't get the SEGFAULT when running under GDB?

No, I do not get a SEGFAULT under GDB. But:

  1. I dont see shutter being executed.
  2. The GDB thingy stays stuck for at least 15 minutes. I just kill it afterwards.

Here is the full output of GDB:

❯ gdb --args /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter...
(No debugging symbols found in /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter)
(gdb) set follow-exec-mode new
(gdb) b main
Breakpoint 1 at 0x4010c0
(gdb) r
Starting program: /nix/store/hhgjkv7di1hbzd1rm95wbwk1zz1bn7a7-system-path/bin/shutter
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/libthread_db.so.1".

Breakpoint 1, 0x00000000004010c0 in main ()
(gdb) c
Continuing.
process 252894 is executing new program: /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/bin/perl
[New inferior 2]
[New process 252894]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/libthread_db.so.1".

Thread 2.1 ".shutter-wrappe" hit Breakpoint 1, 0x0000000000401100 in main ()
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/bin/perl
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/libthread_db.so.1".

Breakpoint 1, 0x0000000000401100 in main ()
(gdb) c
Continuing.
bjornfor commented 2 years ago

Seems like you're starting the process again after hitting the main function in perl, instead of continuing? I think the follow-exec-mode was a red herring, I think simply starting gdb and doing 'run' should get you to the segfault.

refaelsh commented 2 years ago

Seems like you're starting the process again after hitting the main function in perl, instead of continuing? I think the follow-exec-mode was a red herring, I think simply starting gdb and doing 'run' should get you to the segfault.

Sure. Here is the output (its long, I will post only the ending):

[Detaching after fork from child process 256896]
[Detaching after fork from child process 256897]
[Detaching after fork from child process 256898]
Current window manager: i3
Current window manager: i3
Current window manager: i3
Current window manager: i3
[New Thread 0x7fffdb54d640 (LWP 256899)]

type_changed was emitted by widget Gtk3::ComboBoxText=HASH(0x4d6a900)

qvalue_changed was emitted by widget Gtk3::HScale=HASH(0x4df0878)
[New Thread 0x7fffdad4c640 (LWP 256900)]
Can't use an undefined value as an ARRAY reference at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 4932, <DATA> line 19.
    Shutter::App::fct_get_program_model() called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 1408
    Shutter::App::STARTUP(Shutter::App=HASH(0x4beddb8)) called at /nix/store/gl2h6v49mk4zn6y0kk88id2kr32d9fjl-perl5.34.1-Glib-Object-Introspection-0.049/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 67
    Glib::Object::Introspection::__ANON__(Shutter::App=HASH(0x4beddb8)) called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 10943
[New Thread 0x7fffda54b640 (LWP 256901)]
[New Thread 0x7fffd97ee640 (LWP 256902)]
[New Thread 0x7fffd8fed640 (LWP 256903)]
[Thread 0x7fffda54b640 (LWP 256901) exited]
[New Thread 0x7fffda54b640 (LWP 256904)]
[Thread 0x7fffd8fed640 (LWP 256903) exited]

Thread 1 ".shutter-wrappe" received signal SIGSEGV, Segmentation fault.
0x00007fffea181acc in signal_emit_unlocked_R () from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
(gdb)
bjornfor commented 2 years ago

And then run 'bt full' to get the backtrace.

refaelsh commented 2 years ago

And then run 'bt full' to get the backtrace.

(gdb) bt full
#0  0x00007fffea181acc in signal_emit_unlocked_R ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#1  0x00007fffea187e71 in g_signal_emit_valist ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#2  0x00007fffea18841f in g_signal_emit ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#3  0x00007fffe8b24100 in gtk_widget_dispose ()
   from /nix/store/34gizkg2d1p27ym1rfcihxncpdi5vham-gtk+3-3.24.34/lib/libgtk-3.so.0
No symbol table info available.
#4  0x00007fffea174781 in g_object_unref ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#5  0x00007fffe88f8048 in gtk_container_remove ()
   from /nix/store/34gizkg2d1p27ym1rfcihxncpdi5vham-gtk+3-3.24.34/lib/libgtk-3.so.0
No symbol table info available.
#6  0x00007fffe8b24024 in gtk_widget_dispose ()
   from /nix/store/34gizkg2d1p27ym1rfcihxncpdi5vham-gtk+3-3.24.34/lib/libgtk-3.so.0
No symbol table info available.
#7  0x00007fffea174781 in g_object_unref ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#8  0x00007fffea1dbc2a in XS_Glib__Object_DESTROY ()
   from /nix/store/2srwgy7jsiqimwl44s11pfhsixbcbbwg-perl5.34.1-Glib-1.3293/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/auto/Glib/Glib.so
No symbol table info available.
#9  0x00007ffff7d4b047 in Perl_pp_entersub ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#10 0x00007ffff7ca67c7 in Perl_call_sv ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#11 0x00007ffff7d4efa9 in S_curse ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#12 0x00007ffff7d4f6a0 in Perl_sv_clear ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#13 0x00007ffff7d4fc9e in Perl_sv_free2 ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#14 0x00007ffff7d504e8 in Perl_sv_clean_objs ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#15 0x00007ffff7ca9698 in perl_destruct ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
--Type <RET> for more, q to quit, c to continue without paging--c
#16 0x0000000000401234 in main ()
No symbol table info available.
(gdb)
Photon89 commented 2 years ago

Looks like no debugging symbols are available for all of the libraries. @bjornfor, how to obtain them in NixOS?

bjornfor commented 2 years ago

Looks like no debugging symbols are available for all of the libraries. @bjornfor, how to obtain them in NixOS?

Short answer: add environment.enableDebugInfo = true; to /etc/nixos/configuration.nix.

Longer answer: Not all packages are built with debugging by default, but it seems at least glib and gtk is, so it should provide better traceback. If there are packages lacking debugging info then one must build locally, see https://nixos.org/manual/nixos/stable/options.html#opt-environment.enableDebugInfo.

refaelsh commented 2 years ago

Looks like no debugging symbols are available for all of the libraries. @bjornfor, how to obtain them in NixOS?

Short answer: add environment.enableDebugInfo = true; to /etc/nixos/configuration.nix.

Longer answer: Not all packages are built with debugging by default, but it seems at least glib and gtk is, so it should provide better traceback. If there are packages lacking debugging info then one must build locally, see https://nixos.org/manual/nixos/stable/options.html#opt-environment.enableDebugInfo.

When I add environment.enableDebugInfo = true; to my /etc/nixos/configuration.nix, I get the same output as before:

.
.
.
[New Thread 0x7fffc3fff640 (LWP 2031)]
[Thread 0x7fffd97ee640 (LWP 2030) exited]
[Thread 0x7fffd8fed640 (LWP 2029) exited]

Thread 1 ".shutter-wrappe" received signal SIGSEGV, Segmentation fault.
0x00007fffea181acc in signal_emit_unlocked_R () from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
(gdb) bt full
#0  0x00007fffea181acc in signal_emit_unlocked_R ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#1  0x00007fffea187e71 in g_signal_emit_valist ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#2  0x00007fffea18841f in g_signal_emit ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#3  0x00007fffe8b24100 in gtk_widget_dispose ()
   from /nix/store/34gizkg2d1p27ym1rfcihxncpdi5vham-gtk+3-3.24.34/lib/libgtk-3.so.0
No symbol table info available.
#4  0x00007fffea174781 in g_object_unref ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#5  0x00007fffe88f8048 in gtk_container_remove ()
   from /nix/store/34gizkg2d1p27ym1rfcihxncpdi5vham-gtk+3-3.24.34/lib/libgtk-3.so.0
No symbol table info available.
#6  0x00007fffe8b24024 in gtk_widget_dispose ()
   from /nix/store/34gizkg2d1p27ym1rfcihxncpdi5vham-gtk+3-3.24.34/lib/libgtk-3.so.0
No symbol table info available.
#7  0x00007fffea174781 in g_object_unref ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#8  0x00007fffea1dbc2a in XS_Glib__Object_DESTROY ()
   from /nix/store/2srwgy7jsiqimwl44s11pfhsixbcbbwg-perl5.34.1-Glib-1.3293/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/auto/Glib/Glib.so
No symbol table info available.
#9  0x00007ffff7d4b047 in Perl_pp_entersub ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#10 0x00007ffff7ca67c7 in Perl_call_sv ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#11 0x00007ffff7d4efa9 in S_curse ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#12 0x00007ffff7d4f6a0 in Perl_sv_clear ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#13 0x00007ffff7d4fc9e in Perl_sv_free2 ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#14 0x00007ffff7d504e8 in Perl_sv_clean_objs ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#15 0x00007ffff7ca9698 in perl_destruct ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
--Type <RET> for more, q to quit, c to continue without paging--
#16 0x0000000000401234 in main ()
No symbol table info available.
(gdb)
bjornfor commented 2 years ago

When I add environment.enableDebugInfo = true; to my /etc/nixos/configuration.nix, I get the same output as before:

Did you also activate the new config (sudo nixos-rebuild switch)?

refaelsh commented 2 years ago

When I add environment.enableDebugInfo = true; to my /etc/nixos/configuration.nix, I get the same output as before:

Did you also activate the new config (sudo nixos-rebuild switch)?

Yes.

bjornfor commented 2 years ago

@refaelsh : what's in /run/current-system/sw/lib/debug/?

refaelsh commented 2 years ago

@refaelsh : what's in /run/current-system/sw/lib/debug/?

Here it is:

❯ ls -a /run/current-system/sw/lib/debug/
.                      GREEK7.so         IBM891.so               librt.so.1
..                     GREEK-CCITT.so    IBM901.so               libSegFault.so
addpart                hardlink          IBM902.so               libsmartcols.so.1.1.0
agetty                 hexdump           IBM9030.so              libstdbuf.so
ANSI_X3.110.so         HP-GREEK8.so      IBM903.so               libthread_db.so.1
ARMSCII-8.so           HP-ROMAN8.so      IBM904.so               libutil.so.1
ASMO_449.so            HP-ROMAN9.so      IBM905.so               libuuid.so.1.3.0
BIG5HKSCS.so           HP-THAI8.so       IBM9066.so              locale
BIG5.so                HP-TURKISH8.so    IBM918.so               localedef
blkdiscard             hwclock           IBM921.so               logger
blkid                  i3                IBM922.so               login
blkzone                i3bar             IBM930.so               look
blockdev               i3-config-wizard  IBM932.so               losetup
BRF.so                 i3-dump-log       IBM933.so               lsblk
.build-id              i3-input          IBM935.so               lscpu
cal                    i3-msg            IBM937.so               lsipc
cfdisk                 i3-nagbar         IBM939.so               lsirq
chcpu                  IBM037.so         IBM943.so               lslocks
chfn                   IBM038.so         IBM9448.so              lslogins
chmem                  IBM1004.so        iconv                   lsmem
choom                  IBM1008_420.so    iconvconfig             lsns
chrt                   IBM1008.so        IEC_P27-1.so            MAC-CENTRALEUROPE.so
chsh                   IBM1025.so        INIS-8.so               MACINTOSH.so
col                    IBM1026.so        INIS-CYRILLIC.so        MAC-IS.so
colcrt                 IBM1046.so        INIS.so                 MAC-SAMI.so
colrm                  IBM1047.so        ionice                  MAC-UK.so
column                 IBM1097.so        ipcmk                   makedb
coreutils              IBM1112.so        ipcrm                   mcookie
CP10007.so             IBM1122.so        ipcs                    mesg
CP1125.so              IBM1123.so        irqtop                  MIK.so
CP1250.so              IBM1124.so        ISIRI-3342.so           mkfs
CP1251.so              IBM1129.so        ISO_10367-BOX.so        mkfs.bfs
CP1252.so              IBM1130.so        ISO_11548-1.so          mkfs.cramfs
CP1253.so              IBM1132.so        ISO-2022-CN-EXT.so      mkfs.minix
CP1254.so              IBM1133.so        ISO-2022-CN.so          mkswap
CP1255.so              IBM1137.so        ISO-2022-JP-3.so        more
CP1256.so              IBM1140.so        ISO-2022-JP.so          mount
CP1257.so              IBM1141.so        ISO-2022-KR.so          mountpoint
CP1258.so              IBM1142.so        ISO_2033.so             namei
CP737.so               IBM1143.so        ISO_5427-EXT.so         NATS-DANO.so
CP770.so               IBM1144.so        ISO_5427.so             NATS-SEFI.so
CP771.so               IBM1145.so        ISO_5428.so             nix
CP772.so               IBM1146.so        ISO646.so               nologin
CP773.so               IBM1147.so        ISO_6937-2.so           nscd
CP774.so               IBM1148.so        ISO_6937.so             nsenter
CP775.so               IBM1149.so        ISO8859-10.so           partx
CP932.so               IBM1153.so        ISO8859-11.so           pcprofiledump
cpio                   IBM1154.so        ISO8859-13.so           pivot_root
CSN_369103.so          IBM1155.so        ISO8859-14.so           pldd
ctrlaltdel             IBM1156.so        ISO8859-15.so           POSIX_V6_LP64_OFF64
curl                   IBM1157.so        ISO8859-16.so           POSIX_V7_LP64_OFF64
CWI.so                 IBM1158.so        ISO8859-1.so            prlimit
DEC-MCS.so             IBM1160.so        ISO8859-2.so            PT154.so
delpart                IBM1161.so        ISO8859-3.so            readprofile
dmesg                  IBM1162.so        ISO8859-4.so            rename
EBCDIC-AT-DE-A.so      IBM1163.so        ISO8859-5.so            renice
EBCDIC-AT-DE.so        IBM1164.so        ISO8859-6.so            resizepart
EBCDIC-CA-FR.so        IBM1166.so        ISO8859-7.so            rev
EBCDIC-DK-NO-A.so      IBM1167.so        ISO8859-8.so            rfkill
EBCDIC-DK-NO.so        IBM12712.so       ISO8859-9E.so           RK1048.so
EBCDIC-ES-A.so         IBM1364.so        ISO8859-9.so            rmt
EBCDIC-ES.so           IBM1371.so        ISO-IR-197.so           rtcwake
EBCDIC-ES-S.so         IBM1388.so        ISO-IR-209.so           runuser
EBCDIC-FI-SE-A.so      IBM1390.so        isosize                 SAMI-WS2.so
EBCDIC-FI-SE.so        IBM1399.so        JOHAB.so                script
EBCDIC-FR.so           IBM16804.so       kill                    scriptlive
EBCDIC-IS-FRISS.so     IBM256.so         KOI8-R.so               scriptreplay
EBCDIC-IT.so           IBM273.so         KOI8-RU.so              setarch
EBCDIC-PT.so           IBM274.so         KOI-8.so                setpriv
EBCDIC-UK.so           IBM275.so         KOI8-T.so               setsid
EBCDIC-US.so           IBM277.so         KOI8-U.so               setterm
ECMA-CYRILLIC.so       IBM278.so         last                    sfdisk
eject                  IBM280.so         LATIN-GREEK-1.so        SHIFT_JISX0213.so
EUC-CN.so              IBM281.so         LATIN-GREEK.so          SJIS.so
EUC-JISX0213.so        IBM284.so         ldattach                sln
EUC-JP-MS.so           IBM285.so         ldconfig                sotruss-lib.so
EUC-JP.so              IBM290.so         ld-linux-x86-64.so.2    sprof
EUC-KR.so              IBM297.so         libanl.so.1             sulogin
EUC-TW.so              IBM420.so         libblkid.so.1.1.0       swaplabel
fallocate              IBM423.so         libBrokenLocale.so.1    swapoff
fdisk                  IBM424.so         libc_malloc_debug.so.0  swapon
fincore                IBM437.so         libCNS.so               switch_root
findfs                 IBM4517.so        libcrypt.so.1           T.61.so
findmnt                IBM4899.so        libc.so.6               taskset
flock                  IBM4909.so        libcurl.so.4.8.0        TCVN5712-1.so
fsck                   IBM4971.so        libdl.so.2              TIS-620.so
fsck.cramfs            IBM500.so         libfdisk.so.1.1.0       TSCII.so
fsck.minix             IBM5347.so        libGB.so                uclampset
fsfreeze               IBM803.so         libISOIR165.so          UHC.so
fstrim                 IBM850.so         libJIS.so               ul
GB18030.so             IBM851.so         libJISX0213.so          umount
GBBIG5.so              IBM852.so         libKSC.so               UNICODE.so
GBGBK.so               IBM855.so         libmemusage.so          unshare
GBK.so                 IBM856.so         libmount.so.1.1.0       UTF-16.so
gencat                 IBM857.so         libm.so.6               UTF-32.so
GEORGIAN-ACADEMY.so    IBM858.so         libmvec.so.1            UTF-7.so
GEORGIAN-PS.so         IBM860.so         libnixcmd.so            utmpdump
getconf                IBM861.so         libnixexpr.so           uuidd
getent                 IBM862.so         libnixfetchers.so       uuidgen
getopt                 IBM863.so         libnixmain.so           uuidparse
git                    IBM864.so         libnixstore.so          VISCII.so
git-daemon             IBM865.so         libnixutil.so           wall
git-http-backend       IBM866NAV.so      libnsl.so.1             wdctl
git-http-fetch         IBM866.so         libnss_compat.so.2      whereis
git-http-push          IBM868.so         libnss_db.so.2          wipefs
git-imap-send          IBM869.so         libnss_dns.so.2         write
git-remote-http        IBM870.so         libnss_files.so.2       XBS5_LP64_OFF64
git-shell              IBM871.so         libnss_hesiod.so.2      zdump
git-sh-i18n--envsubst  IBM874.so         libpcprofile.so         zic
GOST_19768-74.so       IBM875.so         libpthread.so.0         zramctl
GREEK7-OLD.so          IBM880.so         libresolv.so.2

❯
bjornfor commented 2 years ago

@refaelsh: I don't see any "gtk" or "glib" strings in your output. That looks wrong, as they do appear for me.

Are you sure you have activated NixOS with environment.enableDebugInfo = true; and environment.systemPackages = [ pkgs.shutter ];? (I think packages must be listed in environment.systemPackages for the debug symbols to be set up.)

refaelsh commented 2 years ago

@refaelsh: I don't see any "gtk" or "glib" strings in your output. That looks wrong, as they do appear for me.

Are you sure you have activated NixOS with environment.enableDebugInfo = true; and environment.systemPackages = [ pkgs.shutter ];? (I think packages must be listed in environment.systemPackages for the debug symbols to be set up.)

Yes, I am sure. Here is my entire configuration.nix file:

{ config, pkgs, ... }:

{
  imports =
    [
      # Include the results of the hardware scan.
      ./hardware-configuration.nix
      <home-manager/nixos>
    ];

  system.copySystemConfiguration = true;

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  networking.hostName = "nixos"; # Define your hostname.

  # Enable networking (this is ethernet).
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "Asia/Jerusalem";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  services.xserver.windowManager.i3.enable = true;
  services.xserver.displayManager.lightdm.enable = true;
  services.xserver.displayManager.defaultSession = "none+i3";
  services.xserver.displayManager.autoLogin.enable = true;
  services.xserver.displayManager.autoLogin.user = "refaelsh";

  programs.dconf.enable = true;

  # Configure keymap in X11
  services.xserver = {
    layout = "us";
    xkbVariant = "";
  };

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable sound with pipewire.
  sound.enable = true;
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    jack.enable = true;

    # use the example session manager (no others are packaged yet so this is enabled by default,
    # no need to redefine it in your config for now)
    #media-session.enable = true;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.refaelsh = {
    isNormalUser = true;
    description = "Refael Sheinker";
    extraGroups = [ "networkmanager" "wheel" ];
  };

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  nix.extraOptions = ''
    keep-outputs = true
    keep-derivations = true
  '';

  environment.enableDebugInfo = true;

  environment.systemPackages = with pkgs; [
    bat
    wget
    neovim
    xclip
    rnix-lsp
    wget
    firefox
    git
    kdiff3
    bitwarden
    alacritty
    dmenu
    cmake
    clipmenu
    shutter
    i3status-rust
    kbdd
    xorg.setxkbmap
    fish
    starship
    gcc
    pkg-config
    cmake-language-server
    nodePackages.bash-language-server
    nodePackages.vim-language-server
    clang
    clang-tools
    htop
    kdeconnect
    ripgrep
    fd
    networkmanagerapplet
    rustup
    rust-analyzer
    grcov
    gdb
    (writeShellScriptBin "update.sh"
      ''
        sudo nixos-rebuild switch --upgrade
        rustup update 
      '')
  ];

  programs.nm-applet.enable = true;

  programs.fish.enable = true;
  users.defaultUserShell = pkgs.fish;

  fonts.fonts = with pkgs; [
    nerdfonts
    font-awesome
    line-awesome
  ];

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  environment.variables.EDITOR = "nvim";
  environment.variables.TERMINAL = "alacritty";

  security.sudo.extraConfig = "Defaults env_keep += \"HOME\"";
  security.sudo.extraRules = [
    {
      users = [ "refaelsh" ];
      commands = [
        {
          command = "ALL";
          options = [ "NOPASSWD" ]; # "SETENV" # Adding the following could be a good idea
        }
      ];
    }
  ];

  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "22.05"; # Did you read the comment?

  home-manager.verbose = true;
  home-manager.users.refaelsh = { pkgs, ... }: {
    programs.home-manager.enable = true;

    programs.alacritty.enable = true;
    programs.alacritty.settings = {
      key_bindings = [
        {
          key = "V";
          mods = "Control";
          action = "Paste";
        }
        {
          key = "C";
          mods = "Control";
          action = "Copy";
        }
      ];
      font.normal = { family = "Consolas"; style = "Regular"; };
    };

    programs.fish.enable = true;
    programs.fish.interactiveShellInit = "set -g fish_greeting";

    programs.starship.enable = true;
    programs.starship.enableBashIntegration = true;
    programs.starship.enableFishIntegration = true;
    programs.starship.settings =
      {
        package = { disabled = true; };
        nodejs = { disabled = true; };
        rust = { disabled = true; };
        cmd_duration = { disabled = true; };
        git_commit = { tag_disabled = false; };
        dotnet = { disabled = true; };
        cmake = { disabled = true; };
        gcloud = { disabled = true; };
        directory = {
          home_symbol = "🏠";
          truncation_length = 8;
          truncation_symbol = "…/";
        };
      };

    xsession.windowManager.i3.enable = true;
    xsession.windowManager.i3.config.modifier = "Mod4";
    xsession.windowManager.i3.config.terminal = "alacritty";
    xsession.windowManager.i3.config.bars =
      [{
        statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml";
        fonts = {
          names = [ "FiraCode Nerd Font" ];
          size = 12.0;
        };
      }];
    xsession.windowManager.i3.extraConfig =
      ''
        exec "CM_IGNORE_WINDOW=keepass clipmenud"
        bindsym Mod1+c exec clipmenu
        bindsym Print exec shutter --full
        exec firefox
        exec kbdd
        exec --no-startup-id setxkbmap -layout us,il -option grp:alt_shift_toggle
      '';

    programs.i3status-rust.enable = true;
    programs.i3status-rust.bars = {
      default = {
        theme = "solarized-dark";
        icons = "awesome6";
        blocks = [
          {
            block = "disk_space";
            info_type = "free";
            interval = 1;
          }
          {
            block = "load";
            format = "{1m} {5m} {15m}";
            interval = 1;
          }
          {
            block = "net";
            device = "enp0s3";
          }
          {
            block = "memory";
            format_swap = "{swap_used_percents}";
            clickable = false;
            display_type = "swap";
            interval = 1;
          }
          {
            block = "memory";
            format_mem = "{mem_total_used_percents}";
            clickable = false;
            display_type = "memory";
            interval = 1;
          }
          {
            block = "cpu";
            format = "{barchart}";
            interval = 1;
          }
          {
            block = "temperature";
            collapsed = false;
            interval = 1;
            format = "{min} min, {max} max, {average} avg";
            chip = "*-isa-*";
            inputs = [ "CPUTIN" "SYSTIN" ];
          }
          {
            block = "battery";
            interval = 1;
            format = "{percentage}";
          }
          {
            block = "keyboard_layout";
            driver = "kbddbus";
          }
          {
            block = "time";
            interval = 1;
            format = "%T";
          }
        ];
      };
    };

    programs.git.enable = true;
    programs.git.userEmail = "refaelsh@pm.me";
    programs.git.userName = "refaelsh";
    programs.git.extraConfig = {
      safe = { directory = "*"; };
      color = {
        diff = "always";
        branch = "always";
        interactive = "always";
        ui = "always";
      };
      color.status = {
        status = "always";
        added = "green";
        branch = "magenta";
        untracked = "cyan";
        unmerged = "yellow";
      };
      merge = {
        ff = "no";
        tool = "kdiff3";
      };
      pull = {
        rebase = "false";
      };
    };
    programs.git.aliases =
      {
        lg = "log --date-order --color-moved --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all";
        st = "status";
        diff = "diff --color-moved --submodule";
        show = "show --color-moved";
        ch = "checkout";

      };

    programs.neovim.enable = true;
    programs.neovim.viAlias = true;
    programs.neovim.vimAlias = true;
    programs.neovim.withNodeJs = true;
    programs.neovim.withPython3 = true;
    programs.neovim.withRuby = true;
    programs.neovim.plugins = with pkgs.vimPlugins; [
      vim-airline
      nerdtree
      tcomment_vim
      vim-fugitive
      #vim-asciidoctor
      vim-repeat
      vim-surround
      vim-fish
      nvim-lspconfig
      rust-tools-nvim
      cmp-nvim-lsp
      cmp-buffer
      nvim-cmp
      telescope-nvim
      plenary-nvim
      telescope-fzf-native-nvim
      nvim-web-devicons
      nvim-treesitter
      dressing-nvim
      nvim-notify
      #vim-browser-reload-linux
      vim-nerdtree-syntax-highlight
      vim-cpp-enhanced-highlight
      #vim-fswitch
      vim-devicons
      nvim-web-devicons
      vim-code-dark
      vim-highlightedyank
      # Improved vim spelling plugin (with camel case support)!
      #spelunker.vim
      # Popup-menu for Neovim! 
      #popup-menu.nvim
      # Colorizes RGBs.
      vim-hexokinase
      plantuml-syntax
      rust-vim
      vim-nix
    ];

    programs.neovim.extraConfig =
      ''  
      " LSP  remapings
      nnoremap <leader>d :lua vim.lsp.buf.definition()<CR>
      nnoremap <leader>a :lua vim.lsp.buf.code_action()<CR>
      nnoremap <leader>i :lua vim.lsp.buf.implementation()<CR>
      nnoremap <leader>c :lua vim.lsp.buf.incoming_calls()<CR>
      nnoremap <leader>f :lua vim.lsp.buf.formatting_seq_sync()<CR>
      nnoremap <leader>h :lua vim.lsp.buf.hover()<CR>
      nnoremap <leader>r :lua vim.lsp.buf.rename()<CR>
      vnoremap <leader>r :lua vim.lsp.buf.range_code_action()<CR>

      " General remapings
      nnoremap <leader><space> :noh<cr>
      nnoremap <tab> % 
      vnoremap <tab> %
      nnoremap <up> <nop> 
      nnoremap <down> <nop> 
      nnoremap <left> <nop>
      nnoremap <right> <nop>
      inoremap <up> <nop>
      inoremap <down> <nop> 
      inoremap <left> <nop>
      inoremap <right> <nop>
      nnoremap j gj
      nnoremap k gk
      nnoremap : ; 
      nnoremap ; :
      nnoremap <C-s> :wa<CR>
      nmap <Enter> o<ESC> 
      nmap <S-Enter> O<ESC>

      " vim-fswitch
      nnoremap <leader>s :FSHere<CR>

      " Rust snippets 
      nnoremap ,t i#[test]<CR>fn () {<CR>}<ESC>kwi
      nnoremap ,tm i#[cfg(test)]<CR>mod tests {<CR>use super::*;<CR><CR>#[test]<CR>fn () {<CR>}<CR><ESC>xxxxi}<ESC>kkwwi

      " Auto commands
      autocmd BufEnter, CursorHold, InsertLeave * . * lua vim.lsp.codelens.refresh ()
      " autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh()
      autocmd BufWritePre *.* lua vim.lsp.buf.formatting_sync()
      au FocusLost * :wa

      " Trigger `autoread` when files changes on disk.
      set autoread
      autocmd FocusGained, BufEnter, CursorHold, CursorHoldI * if mode () != 'c' | checktime | endif
      " Notification after file change.
      autocmd FileChangedShellPost * echohl WarningMsg | echo " File changed on disk.Buffer reloaded." | echohl None

      " General settings
      set mouse=a
      set completeopt=menu,menuone,noselect
      set foldmethod=marker
      syntax on
      filetype plugin indent on
      syntax enable
      set noswapfile
      set hlsearch " Highlight all results. 
      set ignorecase 
      set smartcase
      set incsearch " Show search results as you type.
      set showmatch
      set gdefault " Applies substitutions globally on lines.
      set nocompatible
      set termguicolors
      set clipboard=unnamedplus
      set tabstop=4
      set shiftwidth=4
      set expandtab
      set number
      " set nospell
      set spell spelllang=en_us
      set confirm 
      set encoding=UTF-8
      set wrap!
      set spellcapcheck=
      set spellsuggest+=10 
      set exrc 
      set secure

      autocmd BufWritePost configuration.nix !cp /etc/nixos/configuration.nix ~/repos/dotfiles/ && cd ~/repos/dotfiles/ && git add . && git commit -m "Automatic configuration.nix back up" && git push

      " This will detect vimrc changes and reloads it.
      augroup myvimrc
      au!
      au BufWritePost init.vim,.vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
      augroup END

      " Search down into subfolders. Provides tab-completion for all file-related tasks. 
      set path+=** 
      " Display all matching files when we tab complete.
      set wildmenu

      " No idea what does it do.
      if &shell =~# 'fish$'     
          set shell=bash 
      endif

      " https://stackoverflow.com/questions/72826129/in-neovim-how-do-i-get-a-file-to-open-at-the-same-line-number-i-closed-it-at-la
      au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

      " For opening the quickfix automatically after :make.
      " https://vim.fandom.com/wiki/Automatically_open_the_quickfix_window_on_:make#Automatically_open_the_quickfix_window_on_:make 
      autocmd QuickFixCmdPost [^l]* nested cwindow 
      autocmd QuickFixCmdPost    l* nested lwindow

      " Automatically fitting a quickfix window height.
      " https://vim.fandom.com/wiki/Automatically_fitting_a_quickfix_window_height
      au FileType qf call AdjustWindowHeight(3, 10)
      function! AdjustWindowHeight(minheight, maxheight) 
          exe max([min([line("$"), a:maxheight]), a:minheight]) . "wincmd _"
      endfunction "

      " vim-cpp-enhanced-highlight 
      let g:cpp_class_scope_highlight = 1
      let g:cpp_member_variable_highlight = 1
      let g:cpp_class_decl_highlight = 1
      let g:cpp_posix_standard = 1 
      let g:cpp_experimental_simple_template_highlight = 1
      let g:cpp_concepts_highlight = 1

      " Airline. Set this. Airline will handle the rest.
      let g:airline#extensions#ale#enabled = 1 
      let g:airline_powerline_fonts = 1
      let g:airline#extensions#tabline#enabled = 1 
      let g:airline#extensions#tabline#buffer_nr_show = 1

      " NERDTree.
      let NERDTreeShowHidden = 1
      autocmd BufEnter * if bufname('#') =~# "^NERD_tree_" && winnr('$') > 1 | b# | endif
      let g:plug_window = 'noautocmd vertical topleft new'
      autocmd StdinReadPre * let s:std_in=
      autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
      \ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif

      " vim-code-dark
      set t_Co=256
      set t_ut=
      colorscheme codedark
      let g:airline_theme = 'codedark'

      lua << EOF
      require'lspconfig'.rnix.setup{}
      -- require'rust-tools'.setup({})
      -- require('rust-tools.inlay_hints').set_inlay_hints()
      require'lspconfig'.vimls.setup{}
      require'lspconfig'.rust_analyzer.setup{}
      require'lspconfig'.yamlls.setup{}
      require'lspconfig'.bashls.setup{}
      require'lspconfig'.dockerls.setup{}
      require'lspconfig'.eslint.setup{}
      require'lspconfig'.stylelint_lsp.setup{}
      require'lspconfig'.cmake.setup{}
      -- require'lspconfig'.ccls.setup{}
      require'lspconfig'.kotlin_language_server.setup{}
      require'lspconfig'.clangd.setup{}
      require'lspconfig'.zk.setup{}
      require'lspconfig'.pylsp.setup{}

      local cmp = require'cmp'

      cmp.setup({
        snippet = {
          expand = function(args)
            vim.fn["vsnip#anonymous"](args.body) 
          end,
        },
        mapping = {
          ['<C-d>'] = cmp.mapping.scroll_docs(-4),
          ['<C-f>'] = cmp.mapping.scroll_docs(4),
          ['<C-Space>'] = cmp.mapping.complete(),
          ['<C-e>'] = cmp.mapping.close(),
          ['<CR>'] = cmp.mapping.confirm({ select = true }),
        },
        sources = cmp.config.sources({
          { name = 'nvim_lsp' },
          { name = 'vsnip' }, 
        }, {
          { name = 'buffer' },
        })
      })
      EOF
    '';
  };
}

P.S. An idea. Since its NixOS, one can take this file and perfectly recreate the environment. This way, one can have a reproducible problem.

bjornfor commented 2 years ago

@refaelsh:

P.S. An idea. Since its NixOS, one can take this file and perfectly recreate the environment. This way, one can have a reproducible problem.

Hehe, yes, I forgot about that. NixOS is brilliant!

I got your system in a QEMU VM. I've commented out ./hardware-configuration.nix (missing, and not needed in a VM) and provided nixpkgs=latest-nixos-22.05 and home-manager=latest-release-22.05. I started the VM with 4GiB of RAM.

Once booted, I saw a black screen and the message failed to determine default battery - please set your battery device in the configuration file in red text in the bottom of the screen. In the lower left corner I see a small widget with the text "10" and in the lower right corner I see a network manager widget. I don't think the failed to determine default battery ... message is fatal so I continue to look up how to use i3 (which I haven't used before).

It seems I'm supposed to get a terminal by pressing $mod + Enter? And your $mod is mod4 which is the Super / Windows key? I've tried Super/Alt/Control + Enter and nothing happens. Is QEMU eating my modifier keys or did I misunderstand what mod4 is?

refaelsh commented 2 years ago

Hehe, yes, I forgot about that. NixOS is brilliant!

:-)

not needed in a VM

Interesting. This is new to me.

I saw a black screen and the message failed to determine default battery - please set your battery device in the configuration file in red text in the bottom of the screen

No idea. Best guess: its i3status-rust (a status bar for i3) misbehaving because its trying to display battery status and I guess that is bacause your VM simulates a desktop machine and not a laptop.

In the lower left corner I see a small widget with the text "10"

That is perfectly fine. Its a default I set for i3: start with a Firefox windows on desktop #10.

in the lower right corner I see a network manager widget

Yes, correct, as you should.

I don't think the failed to determine default battery ... message is fatal

I concur.

It seems I'm supposed to get a terminal by pressing $mod + Enter?

Yes.

And your $mod is mod4 which is the Super / Windows key?

Yes.

I've tried Super/Alt/Control + Enter and nothing happens.

Strange. It should work. I dont know what to tell you. Please try mod4+d, it should open (in the top left corner) a launcher (called dmenu) for typing programs that are on PATH.

Is QEMU eating my modifier keys

Interesting theory. Possible. Use mod4+d as mentioned above to launch a terminal (I use alacritty).

did I misunderstand what mod4 is?

You understood correctly, it is the windows key.

bjornfor commented 2 years ago

Ah, in QEMU I must select "View" -> "Grab Input (Ctrl+Alt+G)". Now I have a terminal. Also, Firefox did start on desktop 10. (I think the first time it opened at the same time as I was clicking the "10" widget and I thought I did it. But on the next boot it became clear that Firefox starts automatically.)

I see there are no debug symbols for glib/gtk in /run/current-systems/sw/lib/debug, like you said. I don't understand why yet. But at least I was able to reproduce the SEGFAULT with a simple gdb --args shutter + "run" in gdb. So the next thing is getting debug symbols for your setup.

bjornfor commented 2 years ago

@refaelsh: Workaround(?) to get debug symbols: environment.systemPackages = with pkgs; [ gtk3 glib ];. (Perhaps something in my config propagates those already?)

refaelsh commented 2 years ago

@refaelsh: Workaround(?) to get debug symbols: environment.systemPackages = with pkgs; [ gtk3 glib ];. (Perhaps something in my config propagates those already?)

Here is the output of ls -a /run/current-system/sw/lib/debug/:

❯ ls -a /run/current-system/sw/lib/debug/
.                                 IBM1129.so               KOI8-T.so
..                                IBM1130.so               KOI8-U.so
addpart                           IBM1132.so               last
agetty                            IBM1133.so               LATIN-GREEK-1.so
ANSI_X3.110.so                    IBM1137.so               LATIN-GREEK.so
ARMSCII-8.so                      IBM1140.so               ldattach
ASMO_449.so                       IBM1141.so               ldconfig
BIG5HKSCS.so                      IBM1142.so               ld-linux-x86-64.so.2
BIG5.so                           IBM1143.so               libanl.so.1
blkdiscard                        IBM1144.so               libblkid.so.1.1.0
blkid                             IBM1145.so               libBrokenLocale.so.1
blkzone                           IBM1146.so               libc_malloc_debug.so.0
blockdev                          IBM1147.so               libCNS.so
BRF.so                            IBM1148.so               libcrypt.so.1
broadwayd                         IBM1149.so               libc.so.6
.build-id                         IBM1153.so               libcurl.so.4.8.0
cal                               IBM1154.so               libdl.so.2
cfdisk                            IBM1155.so               libfdisk.so.1.1.0
chcpu                             IBM1156.so               libgailutil-3.so.0.0.0
chfn                              IBM1157.so               libGB.so
chmem                             IBM1158.so               libgdk-3.so.0.2404.30
choom                             IBM1160.so               libgio-2.0.so.0.7200.2
chrt                              IBM1161.so               libglib-2.0.so.0.7200.2
chsh                              IBM1162.so               libgmodule-2.0.so.0.7200.2
col                               IBM1163.so               libgobject-2.0.so.0.7200.2
colcrt                            IBM1164.so               libgthread-2.0.so.0.7200.2
colrm                             IBM1166.so               libgtk-3.so.0.2404.30
column                            IBM1167.so               libISOIR165.so
coreutils                         IBM12712.so              libJIS.so
CP10007.so                        IBM1364.so               libJISX0213.so
CP1125.so                         IBM1371.so               libKSC.so
CP1250.so                         IBM1388.so               libmemusage.so
CP1251.so                         IBM1390.so               libmount.so.1.1.0
CP1252.so                         IBM1399.so               libm.so.6
CP1253.so                         IBM16804.so              libmvec.so.1
CP1254.so                         IBM256.so                libnixcmd.so
CP1255.so                         IBM273.so                libnixexpr.so
CP1256.so                         IBM274.so                libnixfetchers.so
CP1257.so                         IBM275.so                libnixmain.so
CP1258.so                         IBM277.so                libnixstore.so
CP737.so                          IBM278.so                libnixutil.so
CP770.so                          IBM280.so                libnsl.so.1
CP771.so                          IBM281.so                libnss_compat.so.2
CP772.so                          IBM284.so                libnss_db.so.2
CP773.so                          IBM285.so                libnss_dns.so.2
CP774.so                          IBM290.so                libnss_files.so.2
CP775.so                          IBM297.so                libnss_hesiod.so.2
CP932.so                          IBM420.so                libpcprofile.so
cpio                              IBM423.so                libprintbackend-cups.so
CSN_369103.so                     IBM424.so                libprintbackend-file.so
ctrlaltdel                        IBM437.so                libprintbackend-lpr.so
curl                              IBM4517.so               libpthread.so.0
CWI.so                            IBM4899.so               libresolv.so.2
DEC-MCS.so                        IBM4909.so               librt.so.1
delpart                           IBM4971.so               libSegFault.so
dmesg                             IBM500.so                libsmartcols.so.1.1.0
EBCDIC-AT-DE-A.so                 IBM5347.so               libstdbuf.so
EBCDIC-AT-DE.so                   IBM803.so                libthread_db.so.1
EBCDIC-CA-FR.so                   IBM850.so                libutil.so.1
EBCDIC-DK-NO-A.so                 IBM851.so                libuuid.so.1.3.0
EBCDIC-DK-NO.so                   IBM852.so                locale
EBCDIC-ES-A.so                    IBM855.so                localedef
EBCDIC-ES.so                      IBM856.so                logger
EBCDIC-ES-S.so                    IBM857.so                login
EBCDIC-FI-SE-A.so                 IBM858.so                look
EBCDIC-FI-SE.so                   IBM860.so                losetup
EBCDIC-FR.so                      IBM861.so                lsblk
EBCDIC-IS-FRISS.so                IBM862.so                lscpu
EBCDIC-IT.so                      IBM863.so                lsipc
EBCDIC-PT.so                      IBM864.so                lsirq
EBCDIC-UK.so                      IBM865.so                lslocks
EBCDIC-US.so                      IBM866NAV.so             lslogins
ECMA-CYRILLIC.so                  IBM866.so                lsmem
eject                             IBM868.so                lsns
EUC-CN.so                         IBM869.so                MAC-CENTRALEUROPE.so
EUC-JISX0213.so                   IBM870.so                MACINTOSH.so
EUC-JP-MS.so                      IBM871.so                MAC-IS.so
EUC-JP.so                         IBM874.so                MAC-SAMI.so
EUC-KR.so                         IBM875.so                MAC-UK.so
EUC-TW.so                         IBM880.so                makedb
fallocate                         IBM891.so                mcookie
fdisk                             IBM901.so                mesg
fincore                           IBM902.so                MIK.so
findfs                            IBM9030.so               mkfs
findmnt                           IBM903.so                mkfs.bfs
flock                             IBM904.so                mkfs.cramfs
fsck                              IBM905.so                mkfs.minix
fsck.cramfs                       IBM9066.so               mkswap
fsck.minix                        IBM918.so                more
fsfreeze                          IBM921.so                mount
fstrim                            IBM922.so                mountpoint
gapplication                      IBM930.so                namei
GB18030.so                        IBM932.so                NATS-DANO.so
GBBIG5.so                         IBM933.so                NATS-SEFI.so
GBGBK.so                          IBM935.so                nix
GBK.so                            IBM937.so                nologin
gdbus                             IBM939.so                nscd
gencat                            IBM943.so                nsenter
GEORGIAN-ACADEMY.so               IBM9448.so               partx
GEORGIAN-PS.so                    iconv                    pcprofiledump
getconf                           iconvconfig              pivot_root
getent                            IEC_P27-1.so             pldd
getopt                            im-am-et.so              POSIX_V6_LP64_OFF64
gio                               im-broadway.so           POSIX_V7_LP64_OFF64
gio-querymodules                  im-cedilla.so            prlimit
git                               im-cyrillic-translit.so  PT154.so
git-daemon                        im-inuktitut.so          readprofile
git-http-backend                  im-ipa.so                rename
git-http-fetch                    im-multipress.so         renice
git-http-push                     im-thai.so               resizepart
git-imap-send                     im-ti-er.so              rev
git-remote-http                   im-ti-et.so              rfkill
git-shell                         im-viqr.so               RK1048.so
git-sh-i18n--envsubst             im-waylandgtk.so         rmt
glib-compile-resources            im-wayland.so            rtcwake
glib-compile-schemas              im-xim.so                runuser
gobject-query                     INIS-8.so                SAMI-WS2.so
GOST_19768-74.so                  INIS-CYRILLIC.so         script
GREEK7-OLD.so                     INIS.so                  scriptlive
GREEK7.so                         ionice                   scriptreplay
GREEK-CCITT.so                    ipcmk                    setarch
gresource                         ipcrm                    setpriv
gsettings                         ipcs                     setsid
gtester                           irqtop                   setterm
gtk3-demo                         ISIRI-3342.so            sfdisk
gtk3-demo-application             ISO_10367-BOX.so         SHIFT_JISX0213.so
gtk3-icon-browser                 ISO_11548-1.so           SJIS.so
gtk3-widget-factory               ISO-2022-CN-EXT.so       sln
gtk-builder-tool                  ISO-2022-CN.so           sotruss-lib.so
.gtk-encode-symbolic-svg-wrapped  ISO-2022-JP-3.so         sprof
gtk-launch                        ISO-2022-JP.so           sulogin
gtk-query-immodules-3.0           ISO-2022-KR.so           swaplabel
gtk-query-settings                ISO_2033.so              swapoff
gtk-update-icon-cache             ISO_5427-EXT.so          swapon
hardlink                          ISO_5427.so              switch_root
hexdump                           ISO_5428.so              T.61.so
HP-GREEK8.so                      ISO646.so                taskset
HP-ROMAN8.so                      ISO_6937-2.so            TCVN5712-1.so
HP-ROMAN9.so                      ISO_6937.so              TIS-620.so
HP-THAI8.so                       ISO8859-10.so            TSCII.so
HP-TURKISH8.so                    ISO8859-11.so            uclampset
hwclock                           ISO8859-13.so            UHC.so
i3                                ISO8859-14.so            ul
i3bar                             ISO8859-15.so            umount
i3-config-wizard                  ISO8859-16.so            UNICODE.so
i3-dump-log                       ISO8859-1.so             unshare
i3-input                          ISO8859-2.so             UTF-16.so
i3-msg                            ISO8859-3.so             UTF-32.so
i3-nagbar                         ISO8859-4.so             UTF-7.so
IBM037.so                         ISO8859-5.so             utmpdump
IBM038.so                         ISO8859-6.so             uuidd
IBM1004.so                        ISO8859-7.so             uuidgen
IBM1008_420.so                    ISO8859-8.so             uuidparse
IBM1008.so                        ISO8859-9E.so            VISCII.so
IBM1025.so                        ISO8859-9.so             wall
IBM1026.so                        ISO-IR-197.so            wdctl
IBM1046.so                        ISO-IR-209.so            whereis
IBM1047.so                        isosize                  wipefs
IBM1097.so                        JOHAB.so                 write
IBM1112.so                        kill                     XBS5_LP64_OFF64
IBM1122.so                        KOI8-R.so                zdump
IBM1123.so                        KOI8-RU.so               zic
IBM1124.so                        KOI-8.so                 zramctl

❯

And here is the output of gdb bt full:

(gdb) bt full
#0  0x00007fffea181acc in signal_emit_unlocked_R ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#1  0x00007fffea187e71 in g_signal_emit_valist ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#2  0x00007fffea18841f in g_signal_emit ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#3  0x00007fffe8b24100 in gtk_widget_dispose ()
   from /nix/store/34gizkg2d1p27ym1rfcihxncpdi5vham-gtk+3-3.24.34/lib/libgtk-3.so.0
No symbol table info available.
#4  0x00007fffea174781 in g_object_unref ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#5  0x00007fffe88f8048 in gtk_container_remove ()
   from /nix/store/34gizkg2d1p27ym1rfcihxncpdi5vham-gtk+3-3.24.34/lib/libgtk-3.so.0
No symbol table info available.
#6  0x00007fffe8b24024 in gtk_widget_dispose ()
   from /nix/store/34gizkg2d1p27ym1rfcihxncpdi5vham-gtk+3-3.24.34/lib/libgtk-3.so.0
No symbol table info available.
#7  0x00007fffea174781 in g_object_unref ()
   from /nix/store/qcxx5ch0sl467gmlkrdzkwxl1j4l11xi-glib-2.72.2/lib/libgobject-2.0.so.0
No symbol table info available.
#8  0x00007fffea1dbc2a in XS_Glib__Object_DESTROY ()
   from /nix/store/2srwgy7jsiqimwl44s11pfhsixbcbbwg-perl5.34.1-Glib-1.3293/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/auto/Glib/Glib.so
No symbol table info available.
#9  0x00007ffff7d4b047 in Perl_pp_entersub ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#10 0x00007ffff7ca67c7 in Perl_call_sv ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#11 0x00007ffff7d4efa9 in S_curse ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#12 0x00007ffff7d4f6a0 in Perl_sv_clear ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#13 0x00007ffff7d4fc9e in Perl_sv_free2 ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#14 0x00007ffff7d504e8 in Perl_sv_clean_objs ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#15 0x00007ffff7ca9698 in perl_destruct ()
   from /nix/store/4xsci42xn5qaim4r8mwhfqz5x6xikjwg-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
--Type <RET> for more, q to quit, c to continue without paging--
#16 0x0000000000401234 in main ()
No symbol table info available.
(gdb)
bjornfor commented 2 years ago

@refaelsh: How weird that you don't get any debug symbols, even though you have glib and gtk3 in your debug dir.

For comparison, here's my gdb session from the VM using your nixos configuration.nix:

Starting program: /nix/store/js8rbc9naxw62i1l05j5lw7xy9fq36h6-system-path/bin/shutter 
[...snipped...]
Thread 1 ".shutter-wrappe" received signal SIGSEGV, Segmentation fault.
emission_find (instance=0x4e31f60, detail=0, signal_id=35) at ../gobject/gsignal.c:893
893 ../gobject/gsignal.c: No such file or directory.

(I run `bt full` here.)

#0  emission_find (instance=0x4e31f60, detail=0, signal_id=35) at ../gobject/gsignal.c:893
        emission = 0x4c8b491824448b41
#1  signal_emit_unlocked_R (node=node@entry=0x1e5eef0, detail=detail@entry=0, instance=instance@entry=0x4e31f60, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffb750) at ../gobject/gsignal.c:3627
        emission_node = <optimized out>
        accumulator = <optimized out>
        emission = {next = 0x4e31f60, instance = 0x1e65110, ihint = {signal_id = 82107616, detail = 0, run_type = G_SIGNAL_RUN_FIRST}, state = EMISSION_STOP, chain_type = 31871248}
        class_closure = <optimized out>
        hlist = <optimized out>
        handler_list = 0x0
        return_accu = <optimized out>
        accu = {g_type = 0, data = {{v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}, {v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}}}
        signal_id = 35
        max_sequential_handler_number = <optimized out>
        return_value_altered = 0
        EMIT_RESTART = <optimized out>
#2  0x00007fffea187e71 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffb8d0) at ../gobject/gsignal.c:3496
        instance_and_params = 0x7fffffffb750
        signal_return_type = <optimized out>
        param_values = 0x7fffffffb768
        node = <optimized out>
        i = <optimized out>
        n_params = <optimized out>
        __func__ = "g_signal_emit_valist"
#3  0x00007fffea18841f in g_signal_emit (instance=instance@entry=0x4e31f60, signal_id=<optimized out>, detail=detail@entry=0) at ../gobject/gsignal.c:3553
        var_args = {{gp_offset = 24, fp_offset = 48, overflow_arg_area = 0x7fffffffb9b0, reg_save_area = 0x7fffffffb8f0}}
#4  0x00007fffe8b24100 in gtk_widget_dispose (object=0x4e31f60) at ../gtk/gtkwidget.c:12166
        widget = 0x4e31f60
        priv = 0x4e31e70
        sizegroups = <optimized out>
#5  0x00007fffea174781 in g_object_unref (_object=<optimized out>) at ../gobject/gobject.c:3636
        weak_locations = <optimized out>
        nqueue = 0x4e46380
        object = <optimized out>
        old_ref = <optimized out>
        retry_atomic_decrement1 = <optimized out>
        object = <optimized out>
        old_ref = <optimized out>
        __func__ = "g_object_unref"
        retry_atomic_decrement1 = <optimized out>
        retry_atomic_decrement2 = <optimized out>
        _g_boolean_var_ = <optimized out>
        gaig_temp = <optimized out>
        has_toggle_ref = <optimized out>
        gaicae_oldval = <optimized out>
        weak_locations = <optimized out>
        nqueue = <optimized out>
        gaig_temp = <optimized out>
        _pp = <optimized out>
        _ptr = <optimized out>
        gaig_temp = <optimized out>
        has_toggle_ref = <optimized out>
        gaicae_oldval = <optimized out>
        _g_boolean_var_ = <optimized out>
        _g_boolean_var_ = <optimized out>
        was_present = <optimized out>
#6  g_object_unref (_object=0x4e31f60) at ../gobject/gobject.c:3553
        object = 0x4e31f60
        old_ref = <optimized out>
        __func__ = "g_object_unref"
        retry_atomic_decrement1 = <optimized out>
        retry_atomic_decrement2 = <optimized out>
        gaig_temp = <optimized out>
        has_toggle_ref = <optimized out>
        gaicae_oldval = <optimized out>
        weak_locations = <optimized out>
        nqueue = <optimized out>
        gaig_temp = <optimized out>
        _pp = <optimized out>
        _ptr = <optimized out>
        gaig_temp = <optimized out>
        has_toggle_ref = <optimized out>
        gaicae_oldval = <optimized out>
        _g_boolean_var_ = <optimized out>
        _g_boolean_var_ = <optimized out>
        was_present = <optimized out>
#7  0x00007fffe88f8048 in gtk_container_remove (container=0x4e4dce0, widget=0x4e31f60) at ../gtk/gtkcontainer.c:1911
        __func__ = "gtk_container_remove"
#8  0x00007fffe8b24024 in gtk_widget_dispose (object=0x4e31f60) at ../gtk/gtkwidget.c:12155
        widget = 0x4e31f60
        priv = 0x4e31e70
        sizegroups = <optimized out>
#9  0x00007fffea174781 in g_object_unref (_object=<optimized out>) at ../gobject/gobject.c:3636
        weak_locations = <optimized out>
        nqueue = 0x4e46380
        object = <optimized out>
        old_ref = <optimized out>
        retry_atomic_decrement1 = <optimized out>
        object = <optimized out>
        old_ref = <optimized out>
        __func__ = "g_object_unref"
        retry_atomic_decrement1 = <optimized out>
        retry_atomic_decrement2 = <optimized out>
        _g_boolean_var_ = <optimized out>
        gaig_temp = <optimized out>
        has_toggle_ref = <optimized out>
        gaicae_oldval = <optimized out>
        weak_locations = <optimized out>
        nqueue = <optimized out>
        gaig_temp = <optimized out>
        _pp = <optimized out>
        _ptr = <optimized out>
        gaig_temp = <optimized out>
        has_toggle_ref = <optimized out>
        gaicae_oldval = <optimized out>
        _g_boolean_var_ = <optimized out>
        _g_boolean_var_ = <optimized out>
        was_present = <optimized out>
#10 g_object_unref (_object=0x4e31f60) at ../gobject/gobject.c:3553
        object = 0x4e31f60
        old_ref = <optimized out>
        __func__ = "g_object_unref"
        retry_atomic_decrement1 = <optimized out>
        retry_atomic_decrement2 = <optimized out>
        gaig_temp = <optimized out>
        has_toggle_ref = <optimized out>
        gaicae_oldval = <optimized out>
        weak_locations = <optimized out>
        nqueue = <optimized out>
        gaig_temp = <optimized out>
        _pp = <optimized out>
        _ptr = <optimized out>
        gaig_temp = <optimized out>
        has_toggle_ref = <optimized out>
        gaicae_oldval = <optimized out>
        _g_boolean_var_ = <optimized out>
        _g_boolean_var_ = <optimized out>
        was_present = <optimized out>
#11 0x00007fffea1dbc2a in XS_Glib__Object_DESTROY () from /nix/store/d8lhgjj0i1c07cxgffq2f3rbph1j3lhk-perl5.34.1-Glib-1.3293/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/auto/Glib/Glib.so
No symbol table info available.
#12 0x00007ffff7d4b047 in Perl_pp_entersub () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#13 0x00007ffff7ca67c7 in Perl_call_sv () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#14 0x00007ffff7d4efa9 in S_curse () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#15 0x00007ffff7d4f6a0 in Perl_sv_clear () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#16 0x00007ffff7d4fc9e in Perl_sv_free2 () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#17 0x00007ffff7d504e8 in Perl_sv_clean_objs () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#18 0x00007ffff7ca9698 in perl_destruct () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#19 0x0000000000401234 in main ()
No symbol table info available.

quit
EOF [assumed Y]

Config diff:

$ diff -u op-nixos-config.nix op-nixos-config-modified.nix
--- op-nixos-config.nix 2022-07-05 20:09:48.800611918 +0200
+++ op-nixos-config-modified.nix        2022-07-07 21:52:34.949474055 +0200
@@ -4,7 +4,7 @@
   imports =
     [
       # Include the results of the hardware scan.
-      ./hardware-configuration.nix
+      #./hardware-configuration.nix
       <home-manager/nixos>
     ];

@@ -130,7 +130,7 @@
         sudo nixos-rebuild switch --upgrade
         rustup update
       '')
-  ];
+  ] ++ [ gtk3 glib ];

   programs.nm-applet.enable = true;

Script to build and launch VM:

#!/usr/bin/env bash
set -euo pipefail
set -x

# Tip of nixos-22.05 and release-22.05 branches @ 2022-07-05
export NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/e8d47977286a44955262adbc76f2c8a66e7419d5.tar.gz:home-manager=https://github.com/nix-community/home-manager/archive/4a3d01fb53f52ac83194081272795aa4612c2381.tar.gz

# Some eval impurities in the original file, so use a slightly modified one.
#export NIXOS_CONFIG=$PWD/op-nixos-config.nix
export NIXOS_CONFIG=$PWD/op-nixos-config-modified.nix

shared_dir=$PWD/vm_shared
mkdir -p "$shared_dir"

nixos-rebuild build-vm && SHARED_DIR="$shared_dir" ./result/bin/run-nixos-vm -m 4096

Files can be shared between host:$PWD/vm_shared and guest:/tmp/shared.

refaelsh commented 2 years ago

How weird that you don't get any debug symbols, even though you have glib and gtk3 in your debug dir.

Indeed.

So, how does the bt full thingy helps us here? I have no idea how to read it.