Telnet inside chroot evironment - linux

I have set up a chroot jail inside a folder using debootstrap. Inisde this jail, I installed telnetd. But when I try to login from a remote host, the connection is closed just after login.
administrator#ubuntu:/$ telnet 192.168.1.100
Trying 192.168.1.100...
Connected to 192.168.1.100.
Escape character is '^]'.
Ubuntu 12.04 LTS
dchub login: trail
Password:
Last login: Mon Sep 9 09:51:47 UTC 2013 from 192.168.1.200 on pts/3
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.9.9-1-ARCH x86_64)
* Documentation: https://help.ubuntu.com/
Cannot execute /bin/bash: Resource temporarily unavailable
Connection closed by foreign host.
administrator#ubuntu:/$
I have already mounted /proc and /dev/pts.

I finally figured out what the problem was.
My host system has zsh as default shell and I used it to go inside chroot jail and start the telnet server, which has bash as its default shell. So when I used bash to go inside chroot jail and start the telnet server, it worked!
This error message still shown to me on each login but everything else works fine.
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: Resource temporarily unavailable

Related

Ubuntu 16 gives "fork: retry: Resource temporarily unavailable", Ubuntu 20 doesn't

I have 2 similar machines in terms of HW. One has Ubuntu 16, the other Ubuntu 20.
I'm running a python program that is meant to open 30K TCP connections to an end point. The Ubuntu 20 machine machine was able to do the job well just by doing these 2 commands before executing the program:
#ulimit -n 1000000
#ulimit -u 1000000
However the Ubuntu 16 machine after creating 12K connections gives this:
-su: fork: retry: No child processes
-su: fork: retry: Resource temporarily unavailable
-su: fork: retry: Resource temporarily unavailable
-su: fork: retry: Resource temporarily unavailable
Any idea what may be causing Ubuntu 16 to behave like that while Ubuntu 20 seems fine?
Note: I tried to do few things now from different posts but none has worked.
Thanks in advance.
I think the maximum number of processes overall is lower on Ubuntu 16.04 vs 20.04
i.e. On Ubuntu 16.04 /proc/sys/kernel/pid_max is 32768, while on 18.04 it's 131072
I think you might have enough other processes to hit this limit, at least it's worth checking pid_max to see.
Also it would be better to write your test program to make many connections from a single process/thread using async code, as that would allow higher limits.
PS: Ubuntu 16.04 is end-of-life (unless you're paying for the extension), so you might want to ensure you upgrade.
PS: Ubuntu versions (except the minimial-types) need to second digit block to be correct.
OK the solution here was to stay away from Ubuntu 16

dovecot unable to start due to address already in use

I upgraded my Linux kernel and dovecot failed to start with the following error messages:
Error: service(managesieve-login): listen(*, 4190) failed: Address already in use
Error: service(pop3-login): listen(*, 110) failed: Address already in use
Error: service(pop3-login): listen(*, 995) failed: Address already in use
Error: service(imap-login): listen(*, 143) failed: Address already in use
Error: service(imap-login): listen(*, 993) failed: Address already in use
Fatal: Failed to start listeners
Strangely enough, I couldn't find any process bounded to those port numbers. All commands below return nothing.
# netstat -tulpn | grep 110
# ss -tulpn |grep 110
# fuser 110/tcp
# lsof -i :110
I also tried to change the listen setting to my specific IP address and it still failed the same way.
Any idea how I can solve this problem? Here's my version info:
# uname -a
Linux ip-172-31-26-222 4.14.177-107.254.amzn1.x86_64 #1 SMP Thu May 7 18:30:14 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# dovecot --version
2.2.36 (1f10bfa63)
Hi it looks like you are using AWS as I am. I recently updated via Yum as well. I noticed that a new package named 'portreserve' was also installed. I killed that process, left the /etc/dovecot/dovecot.conf as it was before and then started Dovecot successfully. I was also immediately able to reconnect my mail clients connection. I hope that helps you.
I also restarted the portreserve program since it seems useful to limit port access.

Forked Processes When Rsyncing via SSH

I'm having an issue where when I try to send a file to my remote web server via rsync on my Linux OS, I receive the following error message:
/etc/profile.d/locallib.sh: fork: retry: No child processes
/etc/profile.d/locallib.sh: fork: retry: No child processes
/etc/profile.d/locallib.sh: fork: retry: No child processes
/etc/profile.d/locallib.sh: fork: retry: No child processes
/etc/profile.d/locallib.sh: fork: Resource temporarily unavailable
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 254) at io.c(226) [sender=3.1.1]
rsync Code
rsync -vzhe ssh some.file user#remote.server:remote.dir/
Issue is not with rsync command, actual issue with remote server , unable to do ssh to remote server due to resources are exhausted from it.
Contact System Administrator in this case.

sudo ./jetty Stop or Start Failure

The jetty on our linux server is not installed as a service as we have multiple jetty servers on different ports. And we use command./jetty.sh stop and ./jetty.sh start to stop and start jetty.
However, when I add sudo to the command, the server never stop/start successfully. When I run sudo ./jetty.sh stop, it shows
Stopping Jetty: start-stop-daemon: warning: failed to kill 18772: No such process
1 pids were not killed
No process in pidfile '/var/run/jetty.pid' found running; none killed.
and the server was not stopped.
When I run sudo ./jetty.sh start, it shows
Starting Jetty: FAILED Tue Apr 23 23:07:15 CST 2019
How could this happen? From my understanding. Using sudo gives you more power and privilege to run commands. If you can successfully execute without sudo, then the command should never fail with sudo, since it only grants superuser privilege.
As a user it uses $HOME.
As root it uses system paths.
The error you got ..
Stopping Jetty: start-stop-daemon: warning: failed to kill 18772: No such process
1 pids were not killed
No process in pidfile '/var/run/jetty.pid' found running; none killed.
... means that there was a bad pid file sitting around for a process that no longer exists.
Short answer, the processing is different if you are root (a service) vs a user (just an application).

linux glxgears throws "X11 connection rejected because of wrong authentication"

Logged in to a linux redhat-6 machine using ssh -X root#machineip and then running glxgears works.
However switching to another user "su - notes" and then trying to run glx gears does not work.
** This works**
# ssh -X root#15.218.114.240
[root#iwf1114240 ~]# glxgears
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server "localhost:10.0"
after 123 requests (42 known processed) with 0 events remaining.
** The below commands does not work**
[root#iwf1114240 ~]# su - notes
[notes#iwf1114240 ~]$ glxgears
X11 connection rejected because of wrong authentication.
Error: couldn't open display localhost:10.0
Copy root's .Xauthority file over to note's home directory.

Resources