# VPS, cant su, no PTY. Is it dead?

## MannyCalavera

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:

```
PTY allocation request failed on channel 0
```

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

```
su: must be run from a terminal

```

Because theres no pty devices.

```
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.

```
./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:

```
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)
> ...

 

So, I'm out of ideas. If anybody has any ideas I would be eternally grateful.

----------

## khayyam

MannyCalavera ...

does the following work?

```
ssh host "/bin/bash -l"

su --login
```

best ... khay

----------

## MannyCalavera

Thanks for your reply khay,

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

----------

## khayyam

 *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:

```
ssh host "/bin/bash -i" 

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

su
```

HTH & best ... khay

----------

## MannyCalavera

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):
> ...

 

----------

## khayyam

MannyCalavera ...

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

best ... khay

----------

## MannyCalavera

Yes, I thought it was, but thanks a lot for your help anyway; really appreciated.

----------

## drizzt

How about booting from minimal install disc and chroot into the system ?

----------

## agent_jdh

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

Basically, you need

```
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.

----------

