Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
VPS, cant su, no PTY. Is it dead?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
MannyCalavera
n00b
n00b


Joined: 13 Nov 2005
Posts: 39
Location: New Zealand

PostPosted: Sat Aug 25, 2012 7:25 pm    Post subject: VPS, cant su, no PTY. Is it dead? Reply with quote

Hi all,

Not sure if this is the right forum, but here goes. I did a system update, and now have problems. I know, its my own fault, should never have done it, but its done now, and this is my last try at fixing it before reinstalling.

The good news is, I can ssh in, the bad news is, when I do, i get this:

Code:
PTY allocation request failed on channel 0


I dont have sudo and ssh for root is disabled, which leaves su but I cant su:

Code:
su: must be run from a terminal


Because theres no pty devices.

Code:
ls /dev/pt*
/dev/ptmx

/dev/pts:


Which puts me in a bit of a pickle; I need root to remount pty, and pty to get to root.

After googling like a madman, I came across MAKEDEV, which as I understood didn't need permissions in order to create devices.

I compiled it and can run it, but apparently it does need permissions.

Code:
./MAKEDEV -c /home/user/MAKEDEV-3.23/makedev.d pty
MAKEDEV: error making /dev/ptyp0: Operation not permitted


Busybox says this when i try and su:

Code:
busybox su
su: must be suid to work properly


Incase its any use, this is mount -l

Quote:
/dev/simfs on / type simfs (rw,relatime,usrquota,grpquota)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,gid=500)


So, I'm out of ideas. If anybody has any ideas I would be eternally grateful.
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2162

PostPosted: Sun Aug 26, 2012 2:30 am    Post subject: Reply with quote

MannyCalavera ...

does the following work?

Code:
ssh host "/bin/bash -l"
su --login

best ... khay
Back to top
View user's profile Send private message
MannyCalavera
n00b
n00b


Joined: 13 Nov 2005
Posts: 39
Location: New Zealand

PostPosted: Sun Aug 26, 2012 5:41 am    Post subject: Reply with quote

Thanks for your reply khay,

Unfortunately I still get "su: must be run from a terminal" when running the su --login line.
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2162

PostPosted: Sun Aug 26, 2012 7:54 am    Post subject: Reply with quote

MannyCalavera wrote:
Unfortunately I still get "su: must be run from a terminal" when running the su --login line.

MannyCalavera ...

OK, I acutually made a small mistake in the above ... I ment '-i' (interactive) rather than '-l' (login) but it should have worked either way. Anyhow, a somewhat more desperate attempt at getting a pty:

Code:
ssh host "/bin/bash -i"
echo "import pty; pty.spawn('/bin/bash')" > login.py && python ./login.py
su

HTH & best ... khay
Back to top
View user's profile Send private message
MannyCalavera
n00b
n00b


Joined: 13 Nov 2005
Posts: 39
Location: New Zealand

PostPosted: Sun Aug 26, 2012 9:52 am    Post subject: Reply with quote

Thanks again for your reply! Heres what I get after logging in:

Quote:
ssh user@server.com "/bin/bash -i"
bash: cannot set terminal process group (-1): Invalid argument


Then running the command:

Quote:

$ echo "import pty; pty.spawn('/bin/bash')" > login.py && python ./login.py


Prints this:

Quote:

<ty; pty.spawn('/bin/bash')" > login.py && python ./login.py
Traceback (most recent call last):
File "./login.py", line 1, in <module>
import pty; pty.spawn('/bin/bash')
File "/usr/lib/python2.7/pty.py", line 165, in spawn
pid, master_fd = fork()
File "/usr/lib/python2.7/pty.py", line 107, in fork
master_fd, slave_fd = openpty()
File "/usr/lib/python2.7/pty.py", line 29, in openpty
master_fd, slave_name = _open_terminal()
File "/usr/lib/python2.7/pty.py", line 70, in _open_terminal
raise os.error, 'out of pty devices'
OSError: out of pty devices
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2162

PostPosted: Sun Aug 26, 2012 7:27 pm    Post subject: Reply with quote

MannyCalavera ...

I did say 'desperate' ... as it stands I can't see anyway of fixing this, sorry.

best ... khay
Back to top
View user's profile Send private message
MannyCalavera
n00b
n00b


Joined: 13 Nov 2005
Posts: 39
Location: New Zealand

PostPosted: Mon Aug 27, 2012 6:27 am    Post subject: Reply with quote

Yes, I thought it was, but thanks a lot for your help anyway; really appreciated.
Back to top
View user's profile Send private message
drizzt
Guru
Guru


Joined: 21 Jul 2002
Posts: 337

PostPosted: Tue Nov 06, 2012 1:37 pm    Post subject: Reply with quote

How about booting from minimal install disc and chroot into the system ?
_________________
People don't have to earn my respect. I offer my respect to them, but be careful to lose my respect...
Back to top
View user's profile Send private message
agent_jdh
Veteran
Veteran


Joined: 08 Aug 2002
Posts: 1776
Location: Scotland

PostPosted: Tue Nov 06, 2012 7:33 pm    Post subject: Reply with quote

Sounds like https://bugs.gentoo.org/show_bug.cgi?id=438932

Basically, you need

Code:
rc-update add udev sysinit
rc-update add udev-mount sysinit


If you do not have physical access to the box, this may present difficulties.
_________________
Jingle Jangle Jewellery
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum