I'm trying to add ssmtp into initramfs. However, I can not find (or compile at the moment) the statically linked version. I guess my only option is adding the current, dynamically linked version.

I'm trying to add the binary (which ssmtp) and its dependencies (ldd $(which ssmtp)) to the initramfs. Although ssmtp works fine in my system, I can not find one of the ldd /usr/sbin/ssmtp output in anywhere:

$ ldd /usr/sbin/ssmtp
    linux-vdso.so.1 (0x00007ffc661ca000)
    libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fd8ffc7e000)
    libgnutls-openssl.so.27 => /usr/lib/x86_64-linux-gnu/libgnutls-openssl.so.27 (0x00007fd8ffa75000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd8ff8b8000)
    libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007fd8ff54d000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fd8ffefa000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd8ff32f000)
    libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007fd8ff002000)
    libidn2.so.0 => /usr/lib/x86_64-linux-gnu/libidn2.so.0 (0x00007fd8fede3000)
    libunistring.so.2 => /usr/lib/x86_64-linux-gnu/libunistring.so.2 (0x00007fd8fec5f000)
    libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007fd8fea4c000)
    libnettle.so.6 => /usr/lib/x86_64-linux-gnu/libnettle.so.6 (0x00007fd8fe815000)
    libhogweed.so.4 => /usr/lib/x86_64-linux-gnu/libhogweed.so.4 (0x00007fd8fe5df000)
    libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007fd8fe35b000)
    libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fd8fe150000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd8fe14b000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd8fe12a000)

$ find / -name linux-vdso.so.1 2> /dev/null
# finds nothing

So, how can I install ssmtp into initramfs (or more generally, I can I install a dynamically linked binary into the initramfs)?

  • 3
    You can add libc to initramfs, but it is better if you recompile it with klibc. All the initramfs-based debian binaries have a micro klibc version and this is going into initramfs. – peterh Sep 25 '18 at 7:07
  • why are you adding ssmtp to initramfs? – Rui F Ribeiro Sep 25 '18 at 7:26
  • @peterh I may try again to compile and link it statically. Thanks. – ceremcem Sep 25 '18 at 7:29
  • @RuiFRibeiro I have a setup where the IP address is changed in random cases. If machine reboots, I need to know the IP address to connect and open the encrypted partition so the boot process can continue. – ceremcem Sep 25 '18 at 7:29
  • You want to send mails from the initramfs? It could work, but then you have to also set up networking already in the initramfs. If your goal is simply to get a mail on any reboot, then cron is your best option. (Cron can have things which will happen on boot and not on any time) – peterh Sep 26 '18 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.