Now when I log in I see this at the end of the greeting message:
Code: Select all
Last login: Thu Dec 26 10:25:55 2019 from 192.168.119.166
-bash: fg: no job control
Code: Select all
Last login: Thu Dec 26 10:25:55 2019 from 192.168.119.166
-bash: fg: no job control
Code: Select all
date +`%d`
Code: Select all
$ ls -l /etc/profile.d/
total 20
-rw-r--r-- 1 root root 95 Apr 29 2019 at-dbus-fix.sh
-rw-r--r-- 1 root root 664 Mar 1 2019 bash_completion.sh
-rw-r--r-- 1 root root 324 May 9 2019 sshpwd.sh
-rw-r--r-- 1 root root 1945 Dec 28 2018 vte-2.91.sh
-rw-r--r-- 1 root root 450 Jul 22 11:22 wifi-check.sh
Code: Select all
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
fi
export PATH
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
Code: Select all
set -x
I've seen it before and it was definitely because something was broken, but I can't remember what. Maybe something like the /tmp filesystem being full or the wrong permissions in some part of the home directory or maybe related to the allocation of pty devices. I do remember that it took more than an hour one evening to fix, because it was not clear what was causing the problem. I would try a forced reinstall of ssh to begin with.dickon wrote: ↑Sun Jan 19, 2020 8:47 pmStickingsomewhere at the top of the usual login scripts -- .login, .bashrc, .bash_login etc. -- might be useful.Code: Select all
set -x
Since it suddenly appeared out of the blue I am worried that there is some underlying problem that might cause damage.GlowInTheDark wrote: ↑Sun Jan 19, 2020 8:37 pmFirst, a couple of bits of meta-question:
1) Is it causing you any actual reduction in utility? This is not meant to minimize the importance of it, but it helps to contextualize whether this is just a "That's weird; why is it doing this?" vs. "This is stopping me from getting work done".
This is how a terminal window on Raspbian Buster looks like when opened from the button at the top.The same message is displayed in PuTTY when I connect with SSH right above the cursor line. But in the PuTTY session there are also a number of lines above that, which deal with the state of the system.2) Could you provide a screenshot? I know you've described it pretty well, but it is likely that somebody else might be able to spot it better if given an actual "look over your shoulder".
As far as I can remember I did not, I had been using the VNC connection for a while from my Win 7 laptop while developing code on the RPi.Next, it sounds to me like this is coming from one of the bash startup files. Did you modify (or did you install any software that might have modified) any of the private bash startup files (.profile, .bashrc, .bash_profile) or the public ones (/etc/profile and the contents of /etc/profile.d)
How can that be done? Where should I put the echo statements? Do you mean on top of each of the mentioned files and see which echoed id comes before and which after the offending line?Finally, you will need to debug this. I.e., start putting "echo" statements in the various startup files and see where the message is coming from.
Unfortunately I am not really very used to Linux that I know which files are in fact executed on start of a terminal session....BTW, the bit about "no job control" usually comes from running a shell with its stdin redirected to a non-terminal device (e.g., a file). So, you might want to be thinking along those lines, as to how that might have happened.
Code: Select all
Last login: Mon Jan 20 00:19:25 2020 from 192.168.119.166
From /etc/profile/
From /etc/profile.d/bash_completion.sh
From /etc/profile.d/vte-2.91.sh
From /etc/profile.d/wifi-check.sh
From .profile
From .bashrc
-bash: fg: no job control
Leaving .bashrc
pi@rpi4-gui:~ $
Code: Select all
echo ".bashrc at: 13"
( %F = yyyy-mm-dd %T = hh:mm:ss)
echo "At: 14"
# Add timestamp to history lines
export HISTTIMEFORMAT="%F %T "
echo "Leaving .bashrc"
Code: Select all
Last login: Mon Jan 20 00:48:25 2020 from 192.168.119.166
.bashrc at: 13
-bash: fg: no job control
At: 14
Leaving .bashrc
pi@rpi4-gui:~ $
Code: Select all
( %F = yyyy-mm-dd %T = hh:mm:ss)
The line that starts with ( %F is what is causing bash to warn about no job control. Bash is starting a new sub-shell (the opening bracket) and the first instruction is %F which says look for a background job that starts with a capital F and bring it to the foreground. Since there is no such background process to match it to, it bails out. I assume that line is a continuation of a previous line but has somehow been separated to make it a line all on its own.Bosse_B wrote: ↑Sun Jan 19, 2020 11:39 pmSo I have narrowed down where the actual source of the problem is:
At the bottom of .bashrc I have entered a formatting config to be used with the history command:This causes the following output when I log on:Code: Select all
echo ".bashrc at: 13" ( %F = yyyy-mm-dd %T = hh:mm:ss) echo "At: 14" # Add timestamp to history lines export HISTTIMEFORMAT="%F %T " echo "Leaving .bashrc"So it seems like this line is causing the problem, why?:Code: Select all
Last login: Mon Jan 20 00:48:25 2020 from 192.168.119.166 .bashrc at: 13 -bash: fg: no job control At: 14 Leaving .bashrc pi@rpi4-gui:~ $Code: Select all
( %F = yyyy-mm-dd %T = hh:mm:ss)
Code: Select all
export HISTTIMEFORMAT="%F %T "
I would also guess you inadvertently copy-and-pasted some of a preceding comment when bringing in the 'export' line into your file. It was probably something like below in the original -Bosse_B wrote: ↑Sun Jan 19, 2020 11:39 pmSo it seems like this line is causing the problem, why?:Code: Select all
( %F = yyyy-mm-dd %T = hh:mm:ss)
Code: Select all
# Set the time ( %F = yyyy-mm-dd %T = hh:mm:ss)
export HISTTIMEFORMAT="%F %T "
Code: Select all
# don't put duplicate lines or lines starting with space in the history.
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=15000
HISTFILESIZE=20000
# Add timestamp to history lines
export HISTTIMEFORMAT="%F %T "
#Save command to history immediately instead of at session end
PROMPT_COMMAND='history -a'
Code: Select all
PROMPT_COMMAND='history -a; history -n'
Code: Select all
(cd /mnt/oldroot && dpkg --get-selections) | dpkg --set-selections
apt-get dselect-upgrade
QUESTIONS:dickon wrote: ↑Mon Jan 20, 2020 1:41 pmNext time you need to reinstall, have a look atas this gets you all the packages you've previously installed, and removes any you removed.Code: Select all
(cd /mnt/oldroot && dpkg --get-selections) | dpkg --set-selections apt-get dselect-upgrade
Code: Select all
(cd /mnt/oldroot && dpkg --get-selections) > oldinstalledsoftware.txt
#edit oldinstalledsoftware.txt and remove the offending entries
dpkg --set-selections < oldinstalledsoftware.txt
apt-get dselect-upgrade
Brackets just make the command(s) run in a sub-shell. This means that the 'cd' command won't have any impact outside of them.
Code: Select all
(chroot /mnt/oldroot && dpkg --get-selections) | dpkg --set-selections
Yes, but again: chroot, sorry. I clearly wasn't paying enough attention.2) If the cause of the system failure was actually installing (via apt) some package, how can I view the list of packages so I can edit it?
In my case I was trying to make WiFi create an access point for a tablet to connect to in order to access the RPi website, but not out onto the Internet. After some tests using googled howto:s my Pi would not revert to a stable state concerning WiFi. So I had to rebuild it.
Based on this I would like to know what was installed up to but not including the experimental installs.
Can I just do this (and again, what about the parentheses?):Code: Select all
(cd /mnt/oldroot && dpkg --get-selections) > oldinstalledsoftware.txt #edit oldinstalledsoftware.txt and remove the offending entries dpkg --set-selections < oldinstalledsoftware.txt apt-get dselect-upgrade
Alphabetical, I'm afraid.I hope that dpkg --get-selections produces a time sorted list....
orRecovering from a Pi SD card crash
I'm actually serious, because this is a frequently endured problem and it would be good for there to be a good write-up on how to do this sort of thing. Burying it in an un-related thread makes it hard to find.How to install all the packages to my new system that were installed on my old system