You are not logged in.

#1 2020-10-13 08:39:18

dogunbound
Member
Registered: 2020-04-20
Posts: 8

I ran an & command on accident on install

I ran this command on accident:

sudo pacman -Syu & sudo pacman -S <some_program>

intending to do this:

sudo pacman -Syu && sudo pacman -S <some_program>


Small typo, but had a weird effect where my root was now not owned by the root superuser. I managed to fix that, but I was wondering if there were any other problems that may have occurred other than that.

Offline

#2 2020-10-13 08:42:27

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,699
Website

Re: I ran an & command on accident on install

This should not be a problem, since one of the pacman processes will be executed first and acquire a lock file in /var/lib/pacman/db.lck.
The other instance then will fail to acquire the lock and exit with an error message.
I doubt that this particular mistake is the reason for your permission issues.

Furthermore the intended command is nonsense, since you can just run:

sudo pacman -Syu <some_program>

If you want your problem investigated, please post your entire /var/log/pacman.log.

Last edited by schard (2020-10-13 08:49:28)


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#3 2020-10-13 12:55:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: I ran an & command on accident on install

Actually the result could be more confusing that stated above.  If you hadn't recently run a command with sudo, the first "sudo pacman" would have required a password to be entered on an interactive terminal, but as it was backgrounded, it did not have an interactive terminal.  Shortly after running that command you would get a message like the following in the terminal:

[1]+  Stopped (tty output)       sudo pacman -Syu

And apparently, this will leave a zombie sudo process hanging waiting for input in the background.  In my case, it couldn't be killed with SIGTERM or oddly even with SIGKILL, but it did go away after the SIGHUP from closing the controlling terminal.

Then, as the first pacman command never actually ran - because sudo never got the password, the second one *would* be able to run.  Of course, it would only attempt to install the version of <some_program> already in the local sync database.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2020-10-13 13:06:41

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,699
Website

Re: I ran an & command on accident on install

@Trilby: No need to find out the PID and kill it if you're in an interactive shell:

$ sudo pacman -Syu & sudo pacman -S gimp
[1] 13499
[sudo] password for neumann: 
warning: gimp-2.10.22-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) gimp-2.10.22-1

Total Installed Size:  111.34 MiB
Net Upgrade Size:        0.00 MiB

:: Proceed with installation? [Y/n] n

[1]+  Stopped                 sudo pacman -Syu
$ fg
sudo pacman -Syu
[sudo] password for neumann:          # Pressed [Ctrl] + [D] here.
sudo: no password was provided

Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#5 2020-10-13 14:21:36

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,456

Re: I ran an & command on accident on install

dogunbound wrote:

... my root was now not owned by the root superuser...

I don't think this can be caused by "backgrounding" pacman -Syu, accidentally or not. To avoid confusion, what do you mean specifically by "my root" - are you talking about "/", "/root" or "/home/some_user"? And which user was the owner?

Offline

#6 2020-10-13 15:40:00

dogunbound
Member
Registered: 2020-04-20
Posts: 8

Re: I ran an & command on accident on install

I had to run this command @twelveeighty

sudo chown root /

That fixed the problem.
Also, @schard it's been a while since I did this. I just discovered this issue. I don't think my pacman logs are going to have it anymore, or it would be too far up there to look.

I think the process probably got killed because it ran as a background process and the sudo pacman -S command was run in the foreground.


Thanks. I just wanted to see if there would be bigger issues, but it seems as if it isn't that serious.

Offline

#7 2020-10-13 16:17:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,516
Website

Re: I ran an & command on accident on install

The problem with the ownership of your root directory defintely had nothing to do with this command.  Whatever changed ownership of your root directory was definitely a problem - and there's no way to know what other problems it caused ... as we have no idea what did that.

But I'd run `pacman -Qkk` and look for any suspicious ownership problems.  Or perhaps even cleaner:

find /usr /lib ! -user 0

That find command should not generally produce any results - if there are any results, they should be investigated (e.g., why is the file not owned by root - there might be a good reason, but you should know what it is).


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB