You are not logged in.

#1 2020-07-11 07:26:38

hoalacanhdk
Member
Registered: 2020-07-11
Posts: 5

[SOLVED]Segmentation fault when using SUDO

Dear all,

I am stuck in a problem and need your help.
***
Description: whenever I use 'sudo' in command, such as
- sudo pacman -Syu
- sudo xbacklight set
- sudo mount
etc.
it turns out this message: Segmentation fault
***
Not so bad, I still can use 'su' command to become a root and update my system totally.

Thank you for your help.

Last edited by hoalacanhdk (2020-07-12 10:11:06)

Offline

#2 2020-07-11 13:50:29

finoderi
Member
Registered: 2020-06-12
Posts: 76

Re: [SOLVED]Segmentation fault when using SUDO

Could you show the content of /etc/sudoers file?

Offline

#3 2020-07-11 14:25:47

seth
Member
Registered: 2012-09-03
Posts: 55,993

Re: [SOLVED]Segmentation fault when using SUDO

# strace sudo /bin/ls
# strace gdb --args /bin/ls

"#" because you must run those as root, for gdb usage see https://wiki.archlinux.org/index.php/De … _the_trace

Offline

#4 2020-07-11 15:30:38

hoalacanhdk
Member
Registered: 2020-07-11
Posts: 5

Re: [SOLVED]Segmentation fault when using SUDO

finoderi wrote:

Could you show the content of /etc/sudoers file?

Here it is.
---------------------------------------------------------------------------------------------------------------
root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: /usr/bin/systemctl
gpasswd -a *** wheel
gpasswd -a *** adm
## Uncomment to allow members of group sudo to execute any command
# %sudo    ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d
-------------------------------------------------------------------------------------------------------------------------
where I have hidden the password.

Offline

#5 2020-07-11 15:31:44

hoalacanhdk
Member
Registered: 2020-07-11
Posts: 5

Re: [SOLVED]Segmentation fault when using SUDO

seth wrote:
# strace sudo /bin/ls
# strace gdb --args /bin/ls

"#" because you must run those as root, for gdb usage see https://wiki.archlinux.org/index.php/De … _the_trace

Sorry, I don't get your point, can you explain more?

Offline

#6 2020-07-11 15:36:46

seth
Member
Registered: 2012-09-03
Posts: 55,993

Re: [SOLVED]Segmentation fault when using SUDO

You shall run a debugger or stack tracer to see where sudo fails, however:

gpasswd -a *** wheel
gpasswd -a *** adm

If that's supposed to go for "wheel ALL=(ALL) NOPASSWD", you need to provide a comma separated lilst. No (unescaped) newlines.

Offline

#7 2020-07-11 16:24:01

finoderi
Member
Registered: 2020-06-12
Posts: 76

Re: [SOLVED]Segmentation fault when using SUDO

Passwords should be stored in /etc/shadow. I suggest to remove that plain text bullshit from /etc/sudoers altogether. And make sure you properly edit /etc/sudoers with visudo command.
Also it might be useful to add

Defaults rootpw

at the end of the file.

Offline

#8 2020-07-11 16:39:55

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

Re: [SOLVED]Segmentation fault when using SUDO

finoderi wrote:

Passwords should be stored in /etc/shadow.

How is this either relevant or even true?

finoderi wrote:

Also it might be useful to add

Defaults rootpw

at the end of the file.

Why would that be useful?  Don't recommend irrelevant settings simply because they are your preference for your machines.


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

Offline

#9 2020-07-11 17:14:53

finoderi
Member
Registered: 2020-06-12
Posts: 76

Re: [SOLVED]Segmentation fault when using SUDO

Trilby wrote:

How is this either relevant or even true?

It's true but I agree it's not very relevant in this case, although it was enough to mess up sudoers file.

Trilby wrote:

Why would that be useful?

Because it's more convenient to type root password instead of user password when you need root privilege.

Offline

#10 2020-07-11 17:18:46

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

Re: [SOLVED]Segmentation fault when using SUDO

Hashes should be stored in /etc/shadow, not passwords.  But just the same, this has absolutely nothing to do with the current issues which seem to be just to having newlines instead of commas in a list.


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

Offline

#11 2020-07-11 18:38:58

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,115

Re: [SOLVED]Segmentation fault when using SUDO

It's likely Trilby and Seth are way ahead of me here, but I don't understand at all what these statements are doing in sudoers, where (I think) the asterisk is meant to be an actual password that OP has blacked out for us, so therefore:

gpasswd -a [OP's root? password] wheel
gpasswd -a [OP's root? password] adm

Removing those two lines would probably fix the segmentation faults? And I would be surprised if visudo doesn't complain about them?

Offline

#12 2020-07-11 18:43:39

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

Re: [SOLVED]Segmentation fault when using SUDO

No, those asterisks are not blacked out passwords, they are the -a argument to gpasswd which takes a username not a password.  I doubt they are blanked out, but are almost certainly meant as wildcards (why there are three I haven't a clue, one would suffice).

EDIT: Sorry, I missed the note that he "hid" the password - but just the same, a password makes absolutely no sense in the context of `gpasswd -a <password> wheel`, that's complete gibberish.  It does make sense that those might be commands one would have a wildcard for the user for and entered as a Cmnd argument in sudoers.

Last edited by Trilby (2020-07-11 18:53:55)


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

Offline

#13 2020-07-11 18:47:59

loqs
Member
Registered: 2014-03-06
Posts: 17,858

Re: [SOLVED]Segmentation fault when using SUDO

root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: /usr/bin/systemctl
gpasswd -a *** wheel
gpasswd -a *** adm
## Uncomment to allow members of group sudo to execute any command
# %sudo    ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d
hoalacanhdk wrote:

where I have hidden the password.

hoalacanhdk is *** indicating the password you have hidden?

Offline

#14 2020-07-12 02:01:36

hoalacanhdk
Member
Registered: 2020-07-11
Posts: 5

Re: [SOLVED]Segmentation fault when using SUDO

loqs wrote:
root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: /usr/bin/systemctl
gpasswd -a *** wheel
gpasswd -a *** adm
## Uncomment to allow members of group sudo to execute any command
# %sudo    ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d
hoalacanhdk wrote:

where I have hidden the password.

hoalacanhdk is *** indicating the password you have hidden?

Yes, I explicitly mentioned that.

Offline

#15 2020-07-12 02:10:41

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

Re: [SOLVED]Segmentation fault when using SUDO

Ok, then: first sorry to everyone else for assuming there was some sense in that file.  But hoalacanhdk, what on earth is that supposed to be?  Why would you have gpasswd commands in there with passwords in place of user names?  That'd be complete gibberish on a command line and makes less sense in a sudoers file.

I assume you've removed those lines by now - are the seg faults resolved?


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

Offline

#16 2020-07-12 04:56:12

hoalacanhdk
Member
Registered: 2020-07-11
Posts: 5

Re: [SOLVED]Segmentation fault when using SUDO

Trilby wrote:

Ok, then: first sorry to everyone else for assuming there was some sense in that file.  But hoalacanhdk, what on earth is that supposed to be?  Why would you have gpasswd commands in there with passwords in place of user names?  That'd be complete gibberish on a command line and makes less sense in a sudoers file.

I assume you've removed those lines by now - are the seg faults resolved?

It works, thank you very much!

Offline

#17 2020-07-12 04:59:02

finoderi
Member
Registered: 2020-06-12
Posts: 76

Re: [SOLVED]Segmentation fault when using SUDO

First mistake was made when this file was edited by something other than visudo. It would never allow such desecration to happen.

Last edited by finoderi (2020-07-12 05:17:39)

Offline

#18 2020-07-12 05:58:20

seth
Member
Registered: 2012-09-03
Posts: 55,993

Re: [SOLVED]Segmentation fault when using SUDO

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB