Missing progress bar when command is started via ssh

If I use pacman via ssh to maintain other machines progress bar (of download) is missing completely:

ssh remote_machine 'pacman -Syu'

Any ideas how to get the progress bar?

Best regards
df8oe

Start a remote terminal over ssh?

That would be possible - but the task is as following:
I have to maintain 75 laptops which are in our school net. Sometimes I have to install or remove software on all machines. So I write a bash script which is containing all neccessary commands in seperate ssh lines (and give the ip address of the client I want to maintain as a parameter) to the script. I cannot walk 75 machines by hand applying 5…10 commands. So I wonder if it is possible to access the output of the progress bar of commands via an ssh embedded command…

What is your ssh command in essential detail? Can you use option -X (hope I remember it right, I’m not at my linux box now).

It is doing everything but the progress bar of downloads is missing completely. I have checked option -X but it does not change anything.

How does it show the pacman output?

2021-07-01_17-37

I guess ssh is filtering special (non-printing) characters. So probably that’s why progress bar is missing. If ssh has an option to not filter them, then it just might work.

1 Like

I suspect the issue here is that when you run a command through ssh like that you are not connected to a terminal so you won’t get progress.

I think output of stdout (which I see except progress bar) is filtered by ssh. I have dug into man ssh but I have not found something useful for the problem. If there is a solution it is bured in a “-o option” - there are much of them.

By playing around I am completely astonished now. running

ssh remote_machine 'wget https:/path-to-a-downloadable-file'

I see progress dots!!! But not with pacman…

EDIT:
Additional: If I write stdout to a file with

pacman -Syy > log.txt

There are no progress informations , too. No need for --noprogress. It seems that progress is not on stdout at all. But what is the sense of --noprogress if it is not on stdout??

I don’t think so.

It looks to me like pacman is detecting if it is connected to a terminal or not and suppressing the progress.

From the pacman code:

	if(!isatty(fileno(stdout))) {
		/* disable progressbar if the output is redirected */
		config->noprogressbar = 1;
	} else {
		/* install signal handler to update output width */
		install_winch_handler();
	}

It looks like they are trying to catch redirection but also catching your ssh case as well.

1 Like

I got it:

ssh -t remote_machine 'pacman -Syy'

does the job.
Many thanks for inspiring. Without I would not have solved it!

4 Likes

5 posts were split to a new topic: Off-topic excerpt regarding the merits of pacman -Syy

The situation appears to have reached a solution. I am not sure we need to continue the topic of the relative merits of pacman -Syy and whether it would or wouldn’t cause issues in this situation.