Change password error

17 views
Skip to first unread message

R D

unread,
Aug 29, 2018, 10:36:30 AM8/29/18
to stacki
Hi all, 

when i try to change the password i get this error:

# stack set password
current system password
:
new system password:
retype
new system password:
 
File "/opt/stack/bin/stack", line 155, in run_command
    rc
= command.runWrapper(name, args[i:])
 
File "/opt/stack/lib/python3.6/site-packages/stack/commands/__init__.py", line 2254, in runWrapper
    rc
= self.run(self._params, self._args)
 
File "/opt/stack/lib/python3.6/site-packages/stack/commands/set/password/__init__.py", line 54, in run
   
self.runPlugins( [ old_password, new_password ] )
 
File "/opt/stack/lib/python3.6/site-packages/stack/commands/__init__.py", line 1748, in runPlugins
    retval
= plugin.run(args)
 
File "/opt/stack/lib/python3.6/site-packages/stack/commands/set/password/plugin_unix.py", line 38, in run
    o
, e = p.communicate('root:%s' % new_password)
 
File "/opt/stack/lib/python3.6/subprocess.py", line 836, in communicate
    stdout
, stderr = self._communicate(input, endtime, timeout)
 
File "/opt/stack/lib/python3.6/subprocess.py", line 1481, in _communicate
    input_view
= memoryview(self._input)
stack
.commands.set.password: TypeError -- memoryview: a bytes-like object is required, not 'str'


Any idea?

Mason J. Katz

unread,
Aug 30, 2018, 8:15:13 AM8/30/18
to sta...@googlegroups.com
What version of Stacki? This sounds like a missing decode() left over from the move to python3.
--
You received this message because you are subscribed to the Google Groups "stacki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stacki+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bill Sanders

unread,
Aug 30, 2018, 12:56:03 PM8/30/18
to stacki
Hi R D,

@Mason this is actually in head of tree!

Sorry, I meant to reply to this yesterday.  We had a bit of a firedrill here in the office.

@R D, Mason is exactly right.  You can fix this yourself quite trivially, depending on how comfortable you are editing Python files.

What you need to do is open up

/opt/stack/lib/python3.6/site-packages/stack/commands/set/password/plugin_unix.py

And in the "subprocess.Popen()" call add an encoding parameter.

Basically, find the line in that file that looks like this (line 34 or so):
        p = subprocess.Popen(['/usr/sbin/chpasswd'],

and make it look like this.

        p = subprocess.Popen(['/usr/sbin/chpasswd'], encoding='utf-8',

Be sure the leading whitespace is still tabs, and don't forget the trailing comma.

I'll make the change in our codebase today and it will be in the next release of Stacki after rc7.

Bill
Reply all
Reply to author
Forward
0 new messages