No hint "You have new mail"

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Barney
Posts: 14
Joined: Sat Aug 01, 2020 10:39 pm

No hint "You have new mail"

Post by Barney »

Normally I get the hint "You have new mail", when I log in and there are new mails in /var/mail for my account (bash shell). But not with DietPi v6.33.3 (running on a ZeroPi).

I've set in my /etc/bash.bashrc the follwing environment variables:

Code: Select all

MAILCHECK=60
MAIL=/var/mail
In /etc/pam.d/login there is a line:

Code: Select all

session    optional   pam_mail.so standard
In Raspbian Buster this is enough to get the above mentioned hint. Why doesn't it work in DietPi?
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: No hint "You have new mail"

Post by Joulinar »

Hi,

can you give some hint what kind of mail you are expecting?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Barney
Posts: 14
Joined: Sat Aug 01, 2020 10:39 pm

Re: No hint "You have new mail"

Post by Barney »

Thanks for your reply.

I do not expect any mail. The mail is already sitting in /var/mail. I just want the bash shell to give me a notification, when I log in.

Under Raspbian-Buster I get this notification, but not with DietPi. Both use the same configurations in /etc/bash.bashrc and /etc/pam.d/login (see my original post).

What configuration and/or package do I need, to get the same behaviour as in Raspbian-Buster?
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: No hint "You have new mail"

Post by Joulinar »

still I don't get what mails you are expecting to see. Quite confusing that you don't expect a mail but you are looking for a mail notification. DietPi is a diet version of Raspberry OS with reduced amount of packages. Probably this functionality is not availably as the package was removed.

Maybe @MichaIng knows what you are looking for
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Barney
Posts: 14
Joined: Sat Aug 01, 2020 10:39 pm

Re: No hint "You have new mail"

Post by Barney »

If you don't understand my problem, you should read the bash man page (especially the chapter about the environment variables MAIL and MAILCHECK).
MAIL
If this parameter is set to a file or directory name and the MAILPATH variable is not set, bash informs the user of the arrival of mail in the specified file or Maildir-format directory.
MAILCHECK
Specifies how often (in seconds) bash checks for mail. The default is 60 seconds. When it is time to check for mail, the shell does so before displaying the primary prompt. If this variable is unset, or set to a value that is not a number greater than or equal to zero, the shell disables mail checking.
The above mentioned environment variables are correctly set and pam loads the module pam_mail.so, but the bash shell does not behave as expected (as it does with Raspbian-Buster). I think, something is broken or missing in DietPi.
User avatar
MichaIng
Site Admin
Posts: 2912
Joined: Sat Nov 18, 2017 6:21 pm

Re: No hint "You have new mail"

Post by MichaIng »

When you login, can you verify that those two variables are set correctly, and that MAILPATH is not set:

Code: Select all

echo $MAIL $MAILCHECK
echo $MAILPATH
And can you try to export those two variables instead on just assigning them:

Code: Select all

export MAILCHECK=60
export MAIL=/var/mail
And is it assured that you actually did get mails present in /var/mail/$USER?

Finally, I cannot see it being a systemd-logind feature, but if above is all fine, try this:

Code: Select all

systemctl unmask systemd-logind
apt install libpam-systemd
systemctl enable --now systemd-logind
Barney
Posts: 14
Joined: Sat Aug 01, 2020 10:39 pm

Re: No hint "You have new mail"

Post by Barney »

Thanks for your reply.

The environment variables MAIL, MAILCHECK and MAILPATH are set as you described.

This is the output of 'ls -l /var/mail':

Code: Select all

-rw------- 1 dgs mail 21748 13.02.2021 04:18:03 dgs
This is the output of 'systemctl status systemd-logind.service':

Code: Select all

● systemd-logind.service - Login Service
   Loaded: loaded (/lib/systemd/system/systemd-logind.service; static; vendor preset: enabled)
   Active: active (running) since Mon 2021-01-04 21:38:21 CET; 1 months 9 days ago
     Docs: man:systemd-logind.service(8)
           man:logind.conf(5)
           https://www.freedesktop.org/wiki/Software/systemd/logind
           https://www.freedesktop.org/wiki/Software/systemd/multiseat
 Main PID: 20441 (systemd-logind)
   Status: "Processing requests..."
    Tasks: 1 (limit: 908)
   Memory: 1.0M
   CGroup: /system.slice/systemd-logind.service
           └─20441 /lib/systemd/systemd-logind

Jan 04 21:38:21 dpi systemd[1]: Starting Login Service...
Jan 04 21:38:21 dpi systemd-logind[20441]: New seat seat0.
Jan 04 21:38:21 dpi systemd-logind[20441]: Watching system buttons on /dev/input/event0 (r_gpio_keys)
Jan 04 21:38:21 dpi systemd[1]: Started Login Service.
The package libpam-systemd is not installed. I'll give it a try and report.

Furthermore I noticed, that on login the content of /etc/issue[.net] is not shown on console. With Raspbian-Buster I see on login:

Code: Select all

Linux rpi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l
No mail.
Last login: Fri Feb 12 18:38:51 2021 from 10.91.25.13
With DietPi the first output line after the ssh command is the command prompt of the remote host. Maybe it's related to the missing "You have new mail" message.
User avatar
MichaIng
Site Admin
Posts: 2912
Joined: Sat Nov 18, 2017 6:21 pm

Re: No hint "You have new mail"

Post by MichaIng »

Ah lol, probably it's simply overwritten/moved up by the login banner. Did you try to scroll up to see if the mail hint is shown above the DietPi banner?

/etc/issue[.net] are btw not shown "after" the login, but before the login credentials prompt. On boot, we have an own login prompt which is printed after /etc/issue print. It's on the list to merge this, so that the little extra info are added/updated in /etc/issue itself. However, on a new login prompt, like a dedicated TTY or logging out from console, /etc/issue is shown as expected.

/etc/motd is what is shown after login, but it's moved up into scroll buffer by the DietPi banner. Probably we should find a way to do it the other way round, print DietPi-Banner first and /etc/motd (+ other info like mail hints) afterwards, or merge our banner into /etc/motd, if it supports colour codes :?.
Barney
Posts: 14
Joined: Sat Aug 01, 2020 10:39 pm

Re: No hint "You have new mail"

Post by Barney »

MichaIng wrote: Thu Feb 11, 2021 3:54 pm apt install libpam-systemd
I've installed libpam-systemd, but it didn't change anything. I get no hint "You have new mail".

During the last days I created on a new sdcard a plain vanilla armbian system. Et voilà : I get the hint "You have new mail".

I suppose, that the DietPi configuration on top of the armbian system has broken this regulary behaviour.

Regarding the /etc/issue[.net] issue I noticed, that DietPi uses dropbear as SSH server, while Raspbian-Buster uses OpenSSH. In DietPi's dropbear configuration the output of /etc/issue[.net] was disabled. That's the reason for the different behaviour.
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: No hint "You have new mail"

Post by Joulinar »

you can switch to OpenSSH Server as well using dietpi-software and adjust SSH server preference according your need
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply