You are not logged in.

#1 2024-01-22 16:21:49

Flapper
Member
Registered: 2019-02-10
Posts: 28

[SOLVED] Only one line in /etc/passwd.pacnew?

I have just run pacman -Syu, and one update,
filesystem   2023.09.18-1  ->  2024.01.19-1
generated the message:

warning: /etc/passwd installed as /etc/passwd.pacnew

The passwd.pacnew has ony one line:

root:x:0:0::/root:/usr/bin/bash

but the old passwd was

root:x:0:0::/root:/bin/bash
bin:x:1:1::/:/usr/bin/nologin
daemon:x:2:2::/:/usr/bin/nologin
mail:x:8:12::/var/spool/mail:/usr/bin/nologin
ftp:x:14:11::/srv/ftp:/usr/bin/nologin
http:x:33:33::/srv/http:/usr/bin/nologin
nobody:x:65534:65534:Nobody:/:/usr/bin/nologin
dbus:x:81:81:System Message Bus:/:/usr/bin/nologin
systemd-coredump:x:981:981:systemd Core Dumper:/:/usr/bin/nologin
systemd-network:x:980:980:systemd Network Management:/:/usr/bin/nologin
systemd-oom:x:979:979:systemd Userspace OOM Killer:/:/usr/bin/nologin
systemd-journal-remote:x:978:978:systemd Journal Remote:/:/usr/bin/nologin
systemd-resolve:x:977:977:systemd Resolver:/:/usr/bin/nologin
systemd-timesync:x:976:976:systemd Time Synchronization:/:/usr/bin/nologin
tss:x:975:975:tss user for tpm2:/:/usr/bin/nologin
uuidd:x:68:68::/:/usr/bin/nologin
dhcpcd:x:974:974:dhcpcd privilege separation:/:/usr/bin/nologin
andy:x:1000:1000::/home/andy:/bin/bash
avahi:x:973:973:Avahi mDNS/DNS-SD daemon:/:/usr/bin/nologin
colord:x:972:972:Color management daemon:/var/lib/colord:/usr/bin/nologin
polkitd:x:102:102:PolicyKit daemon:/:/usr/bin/nologin
usbmux:x:140:140:usbmux user:/:/usr/bin/nologin
lightdm:x:971:971:Light Display Manager:/var/lib/lightdm:/usr/bin/nologin
cups:x:209:209:cups helper user:/:/usr/bin/nologin
git:x:970:970:git daemon user:/:/usr/bin/git-shell
saned:x:969:969:SANE daemon user:/:/usr/bin/nologin
sddm:x:967:967:Simple Desktop Display Manager:/var/lib/sddm:/usr/bin/nologin
geoclue:x:966:966:Geoinformation service:/var/lib/geoclue:/usr/bin/nologin
systemd-journal-upload:x:965:965:systemd Journal Upload:/:/usr/bin/nologin
rtkit:x:133:133:RealtimeKit:/proc:/usr/bin/nologin

Is this correct? Will the other "users" lose access?

Last edited by Flapper (2024-01-29 08:47:24)

Offline

#2 2024-01-22 16:30:53

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,628

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

It's correct that you're supposed to merge changes. https://gitlab.archlinux.org/archlinux/ … 0d4d8effd4 . YOU NEVER JUST REPLACE the file with the .pacnew file.

Realistically, you usually ignore pacnew files for /etc/passwd

Offline

#3 2024-01-22 23:02:00

860lacov
Member
Registered: 2020-05-02
Posts: 459

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

Scimmia wrote:

It's correct that you're supposed to merge changes. https://gitlab.archlinux.org/archlinux/ … 0d4d8effd4 . YOU NEVER JUST REPLACE the file with the .pacnew file.

Realistically, you usually ignore pacnew files for /etc/passwd

Could you elaborate a bit?

In my case, I learned that I should be careful with passwd (the hard way).

The change
from

root:x:0:0::/root:/bin/bash

to

root:x:0:0::/root:/usr/bin/bash

Is that a new policy Arch devs made?

And for example.
For my user there is a line:

jm:x:1000:1000::/home/jm:/bin/bash

So should I change it to

jm:x:1000:1000::/home/jm:/usr/bin/bash

?

I've checked and it seems that only users (root and jm) don't use /usr/bin/bash

cat /etc/passwd | grep -v "/usr/"
root:x:0:0::/root:/bin/bash
jm:x:1000:1000::/home/jm:/bin/bash

p.s.
In /etc/ there is a file passwd-
What is that?

Last edited by 860lacov (2024-01-22 23:06:22)

Offline

#4 2024-01-23 07:04:51

d.ALT
Member
Registered: 2019-05-10
Posts: 920

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

860lacov wrote:

For my user there is a line:

jm:x:1000:1000::/home/jm:/bin/bash

So should I change it to

jm:x:1000:1000::/home/jm:/usr/bin/bash

?

I've checked and it seems that only users (root and jm) don't use /usr/bin/bash

According to Package Contents of bash:

[...]
usr/
usr/bin/
usr/bin/bash
usr/bin/bashbug
usr/bin/rbash
usr/bin/sh
[...]

Last edited by d.ALT (2024-01-23 07:05:00)


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#5 2024-01-23 07:13:44

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 1,997
Website

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

The files that the bash package is providing are not sufficient.

860lacov wrote:

Is that a new policy Arch devs made?

No. After the so-called /usr-move, /bin is usually linked to /usr/bin anyways.
Most importantly, your shell's full path must be listed in /etc/shells for it to work properly.

860lacov wrote:

In /etc/ there is a file passwd-
What is that?

It's a backup file for /etc/passwd.

tl;dr
You can ignore /etc/passwd.pacnew and/or remove it when invoking pacdiff.


macro_rules! yolo { { $($tokens:tt)* } => { unsafe { $($tokens)* } }; }

Offline

#6 2024-01-23 07:38:31

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,771
Website

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

I'm going to wildly speculate that the change from /bin/bash to /usr/bin/bash is motivated by the dropping of support for separate /usr/ partitions by the most recent version of systemd. As mentioned /bin/bash is a symlink to /usr/bin/bash so either will work just fine, both are added to /etc/shells by the bash.install script supplied by the bash package.

Offline

#7 2024-01-23 09:31:12

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 609

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

Head_on_a_Stick wrote:

I'm going to wildly speculate that the change from /bin/bash to /usr/bin/bash is motivated by the dropping of support for separate /usr/ partitions by the most recent version of systemd.

Baseless speculation.

The reason for the change is very simple: /bin/bash looks and feels wrong.
After /usr/bin/bash was added to /etc/shells (and it only took a decade), both /etc/default/useradd and the default /etc/passwd could finally be updated.

Since it hasn't been mentioned, https://wiki.archlinux.org/title/Users_ … r_database has instructions for situations where there's a /etc/passwd.pacnew:

Users and groups#User database wrote:

Warning: Arch Linux defaults of the files are created as pacnew files by new releases of the filesystem package. Unless Pacman outputs related messages for action, these .pacnew files can, and should, be disregarded/removed. New required default users and groups are added or re-added as needed by systemd-sysusers(8) or the package install script.

Last edited by nl6720 (2024-01-23 09:32:46)

Offline

#8 2024-01-23 10:07:24

frostschutz
Member
Registered: 2013-11-15
Posts: 1,425

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

nl6720 wrote:

The reason for the change is very simple: /bin/bash looks and feels wrong.

I don't think I've seen /usr/bin/bash much outside of ArchLinux. It nearly doesn't exist at all.

Shellscripts (and everything else) still quite dominantly refer to /bin paths.

$ head -n 1 /usr/bin/* | grep -aP '^#!' | sort | uniq -c | sort -rn
    396 #!/bin/sh
     90 #!/usr/bin/python
     77 #! /bin/sh
     52 #!/usr/bin/perl
     48 #!/usr/bin/env python3
     39 #!/bin/bash
     23 #!/usr/bin/python3
     23 #!/usr/bin/env bash
     16 #!/usr/bin/env perl
     15 #!/usr/bin/perl -w
      9 #!/bin/sh -f
      8 #!/usr/bin/python3.11
      7 #!/usr/bin/bash
...

/bin/sh wins by a huge margin, /bin/bash is common, /usr/bin/env bash less common, /usr/bin/bash nearly doesn't exist at all - the 7 matches for /usr/bin/bash are nearly all pacman scripts. makepkg, pacman-db-upgrade, pacman-key, repo-add, repo-remove, ... so it's completely ArchLinux specific.

Adding a user with $(which bash) seems to be a constructed example. It's longer to type than either /bin/bash or /usr/bin/bash ... and it could prefer /usr/local/bin over /usr/bin ... leading to unexpected results. So it's wrong to use $(which) in useradd...

It's both the same thing either way.

Last edited by frostschutz (2024-01-23 10:08:00)

Offline

#9 2024-01-23 10:10:32

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 1,997
Website

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

Many Linux distros have made the so-called /usr-move.
The issue in /etc/passwd is that the user's shell needs to be registered in /etc/shells.
It does not matter what path shell scripts use, as long as there is the symlink /bin to /usr/bin for backwards compatibility.

Last edited by schard (2024-01-23 10:12:55)


macro_rules! yolo { { $($tokens:tt)* } => { unsafe { $($tokens)* } }; }

Offline

#10 2024-01-26 08:05:49

micronetic
Member
Registered: 2020-02-26
Posts: 40

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

I wasn't sure and just deleted the one line in the old /etc/passwd

root:x:0:0::/root:/bin/bash

and copied and pasted the new line from the .pacnew in the /etc/passwd

root:x:0:0::/root:/usr/bin/bash

.
I hope this was okay.

Last edited by micronetic (2024-01-26 09:55:00)

Offline

#11 2024-01-26 09:44:40

seth
Member
Registered: 2012-09-03
Posts: 52,030

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

What one line? Please don't paraphrase, https://bbs.archlinux.org/viewtopic.php?id=57855

frostschutz wrote:

So it's wrong to use $(which) in useradd...

Friendly reminder to better not engage in whichcraft at all

Offline

#12 2024-01-27 17:30:06

hoschi
Member
From: Ulm (Germany)
Registered: 2008-11-03
Posts: 458

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

Action
I've replaced /bin/bash for user root by /usr/bin/bash in the existing /etc/passwd. All other users had already either /usr/bin/bash or /usr/bin/nologin.
Rationale
I want it tidy.
Recommendation
Comply with the instructions by Scimmia. A manual merge isn't necessary, and it is safe to ignore the pacnew. The warning in the wiki mentioned by nl2670 also recommends acting only when Pacman requires it.

Last edited by hoschi (2024-01-27 20:51:19)

Offline

#13 2024-01-27 19:28:39

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

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

It's fun to see alleged "baseless speculation" confronted with vague and completely subjective assertions of something "feeling wrong" to one individual wiki admin.  Personally I subjectively find /usr/bin/bash ugly, redundant, excessively long, etc.  All bash scripts I write use #!/bin/bash as the shebang.  They'll work on any system that links /usr/bin to /bin ... and they'll work on any systems that don't.  If you specify #!/usr/bin/bash you are limiting portability for no benefit whatsoever.  But hey, if that "looks and feels" right to you, you do you - but perhaps reserve the tone of superiority to when you have more than your gut feeling.

Last edited by Trilby (2024-01-27 19:36:26)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#14 2024-01-27 20:33:18

seth
Member
Registered: 2012-09-03
Posts: 52,030

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

https://en.wikipedia.org/wiki/Filesyste … _structure

Edit: to add some facts to a feelings-driven conversation.
/bin/bash is the canonical path, the /usr move didn't change anything about that.
It's cool to have /usr/bin and /bin the same and it's perfectly fine to set /usr/bin/zsh tongue as one's loginshell, but the canonical, traditional, and predominant path is /bin/bash and if you unsymlink /bin from /usr/bin, your system will fall apart. So in doubt don't get creative about that.

Last edited by seth (2024-01-27 20:40:29)

Offline

#15 2024-01-27 20:56:53

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,771
Website

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

The FHS doesn't really apply to Arch because it uses systemd so file-hierarchy(7) is the reference and that specifies /bin/ as a compatibility symlink. Having said that, I do agree with seth & Trilby's posts above entirely.

And I think my baseless speculation offered a better rationale than that provided by our Beloved Wiki Admin tongue

Offline

#16 2024-01-27 21:08:19

seth
Member
Registered: 2012-09-03
Posts: 52,030

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

I actually had a snarky comment about lennart breaking the FHS, then breaking it again and whining to not blame him because it was already broken but figured  I had exceeded my lennart-trashing quota for this week already wink

Even though arch/systemd no longer follows the FHS, that in this case only means that /bin/bash and /usr/bin/bash are interchangeable, just like "pacman -Syu" and pacman "-Suy". Still, there's a clear and obvious answer which version is to be preferred smile

Offline

#17 2024-01-27 21:34:40

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 659

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

I ran `pacdiff -s` today and saw that change of `/bin/bash` to `/usr/bin/bash` then carelessly did a `dp` in vim to merge that change then exited before noticing it pushed the entire file. Doh! So I ended up with `/etc/passwd` with only a single root line. Luckily something on Arch must maintain a `/etc/passwd-` backup which I found and restored. Did a `cut` and `comm` with `/etc/shadow` and found I was missing only 1 user line which I recovered by re-installing the associated package.

In short, be careful editing/merging your `/etc/passwd`!

Offline

#18 2024-01-28 11:20:00

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 609

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

I was just explaining my motivation for creating FS#79768 and archlinux/packaging/packages/filesystem!3 which led to this change.
If that's not satisfactory, everyone is free to continue making up elaborate reasons for why this change was made.

Edit: Mind that I can't answer why my bug report and merge request was accepted by the package maintainer. Their motivation may differ from mine.

Last edited by nl6720 (2024-01-28 11:23:36)

Offline

#19 2024-01-29 01:06:21

Flapper
Member
Registered: 2019-02-10
Posts: 28

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

Well, I really set the cat among the pigeons here..
I just took Scimmia's advice in #2.

Should I mark this as solved?

Offline

#20 2024-01-29 07:40:38

seth
Member
Registered: 2012-09-03
Posts: 52,030

Re: [SOLVED] Only one line in /etc/passwd.pacnew?

Yes. You got an answer, applied it and your problem is solved.

Don't worry too much about the other stuff.
Pointless argues about whether /bin/bash or /usr/bin/bash is correct when both reference the same inode is what nerds do wink

Offline

Board footer

Powered by FluxBB