Resource temporarily unavailable linux read

Содержание
  1. Работа с COM-портом : resourse temporarily unavailable
  2. Re: Работа с COM-портом : resourse temporarily unavailable
  3. Re: Работа с COM-портом : resourse temporarily unavailable
  4. Re: Работа с COM-портом : resourse temporarily unavailable
  5. Re: Работа с COM-портом : resourse temporarily unavailable
  6. Re: Работа с COM-портом : resourse temporarily unavailable
  7. Re: Работа с COM-портом : resourse temporarily unavailable
  8. Re: Работа с COM-портом : resourse temporarily unavailable
  9. Re: Работа с COM-портом : resourse temporarily unavailable
  10. Re: Работа с COM-портом : resourse temporarily unavailable
  11. Re: Работа с COM-портом : resourse temporarily unavailable
  12. Re: Работа с COM-портом : resourse temporarily unavailable
  13. Re: Работа с COM-портом : resourse temporarily unavailable
  14. How to resolve -bash: fork: retry: Resource temporarily unavailable in Linux ?
  15. ssh connection to host resource temporarily unavailable #4888
  16. Comments
  17. aclifton314 commented Feb 12, 2020 •
  18. nunix commented Feb 12, 2020
  19. nunix commented Feb 12, 2020
  20. aclifton314 commented Feb 12, 2020
  21. nunix commented Feb 12, 2020
  22. aclifton314 commented Feb 12, 2020
  23. nunix commented Feb 12, 2020
  24. aclifton314 commented Feb 12, 2020
  25. nunix commented Feb 12, 2020
  26. aclifton314 commented Feb 17, 2020 •
  27. Как исправить Resource Temprorarily unvailable при ssh подключении к любому адресу?
  28. Error: READ: Resource temporarily unavailable #50
  29. Comments
  30. Azaaaad commented Jun 1, 2018 •

Работа с COM-портом : resourse temporarily unavailable

Пишу программу под Debian, для взаимодействия с устройством через СОМ-порт. Порт нормально открывается, я его конфиурирую, но при попытке чтония получаю -1. В errno — «resourse temporarily unavailable»

fd = open(«/dev/ttyS0», O_RDWR | O_NOCTTY | O_NDELAY);
printf(«Дескриптор порта: %d \n «, fd);

options.c_cflag |= CS8 | CLOCAL | CREAD;
tcsetattr(fd, TCSANOW, &options);

int buf[5];
int flg;

flg = read(fd, buf,1);

Почему ресурс может быть недоступен?

Re: Работа с COM-портом : resourse temporarily unavailable

кто-то захватил лизу.

Re: Работа с COM-портом : resourse temporarily unavailable

Вроде бы, «resourse temporarily unavailable» это было EAGAIN. А он вылазит в случае, когда нет данных, а устройство открыто в режиме O_NONBLOCK == O_NDELAY. То есть у вас просто не успевают придти данные в порт.

P.S. Лучше приводите код ошибки (значение errno), чем то, что дает strerror().

Re: Работа с COM-портом : resourse temporarily unavailable

и потом fopen(«/dev/ttyS0», . )

Re: Работа с COM-портом : resourse temporarily unavailable

Да кажись ты прав. то я наверное с утра не успел проснутся

Re: Работа с COM-портом : resourse temporarily unavailable

Пробовал fcntl(fd, F_SETFL, FNDELAY) перед read — эффект тот же. с fcntl(fd, F_SETFL, 0) прога засыпает.

Насколько я понимаю, при fcntl(fd, F_SETFL, FNDELAY) read должен возвращать 0, если данных просто нет?

Re: Работа с COM-портом : resourse temporarily unavailable

>fcntl(fd, F_SETFL, FNDELAY)

я бы не стал применять эту штучку к COM-портам

Re: Работа с COM-портом : resourse temporarily unavailable

>я бы не стал применять эту штучку к COM-портам а почему? Собственно, такую рекомендацию я нашел в Serial Programming Guide for POSIX Operating Systems

Re: Работа с COM-портом : resourse temporarily unavailable

Да, есть там такая рекомендация. Но, в старом Serial Port Programming How-To советовали использовать seletc() перед чтением. В моей версии glibc объявлено «# define FNDELAY O_NDELAY».

ИМХО, используйте select() на порту открытом с O_NDELAY и считайте, что если read() вернул -1, а errno == EAGAIN, то это нормально.

Re: Работа с COM-портом : resourse temporarily unavailable

во первых потому что эта настройка конфликтует с настройками сделанными tcsetattr и как следствие проще запутатся и сложнее сделать разбор полёта.

во вторых режим блокирования я предпочитаю выставлять при открытиии порта и больше не изменять.

Читайте также:  Mac os python default version

Re: Работа с COM-портом : resourse temporarily unavailable

Re: Работа с COM-портом : resourse temporarily unavailable

>хотя unistd.h и termios.h подключены.

этого не достаточно. как минимум ещё нужны

если не хватит — пройдись поиском по /usr/include/

>POSIX-функций для этих вызовов, кажется, нет?

да не существует

Re: Работа с COM-портом : resourse temporarily unavailable

которую ночь тружусь — прибор все не отвечает. Есть программа под Винду, которая нормально с ним работает. Просмотр ее работы портмоном выдал ряд запросов, которые мне не совсем понятны. Вот что творится под виндой:

IOCTL_SERIAL_SET_WAIT_MASK Serial0 Mask: RXCHAR RXFLAG TXEMPTY CTS DSR RLSD BRK ERR RING IOCTL_SERIAL_SET_TIMEOUTS Serial0 RI:-1 RM:0 RC:0 WM:0 WC:0 IOCTL_SERIAL_GET_BAUD_RATE Serial0 IOCTL_SERIAL_GET_LINE_CONTROL Serial0 IOCTL_SERIAL_GET_CHARS Serial0 IOCTL_SERIAL_GET_HANDFLOW Serial0 IOCTL_SERIAL_GET_BAUD_RATE Serial0 IOCTL_SERIAL_GET_LINE_CONTROL Serial0 IOCTL_SERIAL_GET_CHARS Serial0 IOCTL_SERIAL_GET_HANDFLOW Serial0 IOCTL_SERIAL_SET_BAUD_RATE Serial0 Rate: 4800 IOCTL_SERIAL_SET_RTS Serial0 IOCTL_SERIAL_SET_DTR Serial0 IOCTL_SERIAL_SET_LINE_CONTROL Serial0 StopBits: 1 Parity: NONE WordLength: 8 IOCTL_SERIAL_SET_CHAR Serial0 EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13 IOCTL_SERIAL_SET_HANDFLOW Serial0 Shake:1 Replace:40 XonLimit:1024 XoffLimit:1024 IOCTL_SERIAL_SET_QUEUE_SIZE Serial0 InSize: 4096 OutSize: 2048 IOCTL_SERIAL_SET_RTS Serial0 IOCTL_SERIAL_CLR_RTS Serial0 IRP_MJ_WRITE Serial0 Length 10: 7E 02 01 00 3B 3D 01 12 B4 0D IOCTL_SERIAL_WAIT_ON_MASK Serial0 IOCTL_SERIAL_GET_COMMSTATUS Serial0 IOCTL_SERIAL_SET_RTS Serial0 IOCTL_SERIAL_WAIT_ON_MASK Serial0 IOCTL_SERIAL_GET_COMMSTATUS Serial0 IRP_MJ_READ Serial0 Length 7 SUCCESS Length 7: 6F 59 7F 63 67 EB EF

Источник

How to resolve -bash: fork: retry: Resource temporarily unavailable in Linux ?

In Linux, we have several ways to put limitations on complete system or for a particular user.

In this article, we will discuss how to resolve -bash: fork: retry: Resource temporarily unavailable error in Linux ?

So the best way is to replicate the issue and understand its root cause.

We will first limit number of processes a user can initiate for a particular user/group and then fork processes more than the limit and observe the behavior.

To start with, we will discuss about a file called /etc/security/limits.conf.

The file imposes limits on a
a. particular domain(it could be either a user or group)
b. type is either hard(maximum limit after which usage is not allowed) or soft(soft limit after which warning starts).
c. Item could be one of the following:
# – core – limits the core file size (KB)
# – data – max data size (KB)
# – fsize – maximum filesize (KB)
# – memlock – max locked-in-memory address space (KB)
# – nofile – max number of open file descriptors
# – rss – max resident set size (KB)
# – stack – max stack size (KB)
# – cpu – max CPU time (MIN)
# – nproc – max number of processes
# – as – address space limit (KB)
# – maxlogins – max number of logins for this user
# – maxsyslogins – max number of logins on the system
# – priority – the priority to run user process with
# – locks – max number of file locks the user can hold
# – sigpending – max number of pending signals
# – msgqueue – max memory used by POSIX message queues (bytes)
# – nice – max nice priority allowed to raise to values: [-20, 19]
# – rtprio – max realtime priority

d. Value contains the value in decimal number format.

Limit number of processes i.e. nproc
Now lets check how to limit number of processes by a particular user on Linux.

1. First lets create a new user.

2. Now lets make entry in /etc/security/limits.conf

3. Now switch to saket user and test the scenario by creating more processes than 20 for this user.

Читайте также:  Linux с exception handling

Now if you try to check the running processes you will receive error, resource temporary unavailable, it means the resources got exhausted for this particular user i.e. number of processes got exceeded.

And now you can’t even fork any other command and hence ps fails.

And if you try to run the above command with any other user, you can run it successfully.

Seems interesting. Just try it by yourself and do post your valuable comments here.

In case you receive similar message, you now know what to check first and resolve the issue.

Источник

ssh connection to host resource temporarily unavailable #4888

Comments

aclifton314 commented Feb 12, 2020 •

Windows Version: Microsoft Windows [10.0.17763.973]
Linux Version: Ubuntu 18.04 LTS

I am trying to ssh from a laptop into a desktop using WSL. Both machines run the above Windows version and both run Ubuntu 18.04 LTS. I can ssh localhost into both machines with no issues. When I try to ssh into the desktop from the laptop, I get:

ssh: connect to host port 22: Resource temporarily unavailable

I have tried a few things from the issues open and closed here, but they haven’t worked. Below is the verbose output from the laptop:

Thanks in advance for your help!

The text was updated successfully, but these errors were encountered:

nunix commented Feb 12, 2020

hi, please note that if you have the developer mode active, the port 22 is already in use.

What you can do as a test, is to modify the /etc/ssh/sshd_config > Port 2222
Then restart the sshd service sudo service sshd restart

Finally, try to login with ssh -p2222 desktop.address.com

hope it helps
The Corsair

nunix commented Feb 12, 2020

@aclifton314 indeed, if I understood correctly, it is the endpoint you want to connect to, therefore the sshd daemon is running on your desktop.

aclifton314 commented Feb 12, 2020

@nunix Thanks for your response.
I edited the /etc/ssh/sshd_config file on the desktop, uncommented Port , set it to 2222, saved, and restarted the sshd service. sudo service sshd restart threw sshd: Unrecognized service , but sudo service ssh restart worked.

Here is the output from ssh-ing from the laptop:

nunix commented Feb 12, 2020

hmm ok, from the desktop directly, can you do a ssh -p2222 localhost
and ensure the sshd process is running fine: ps -ef | grep ssh (I didn’t add the d on purpose)

aclifton314 commented Feb 12, 2020

And here is ssh -p2222 localhost

nunix commented Feb 12, 2020

ok good news it works with localhost , so the server is definitively running and accepting the connections.

now, try the local ssh -p2222 but with the «public ip» instead of localhost. it should work also.
if it’s the case, then my guess is that the Windows firewall might need to have a new inbound and outbound rule for the port 2222

oh, and from powershell try netstat -an | select-string 2222 , this will ensure that the port 2222 has correctly been also open on the Windows side

aclifton314 commented Feb 12, 2020

and from Powershell:

nunix commented Feb 12, 2020

ok, so finally I would say to add a rule in the Windows firewall for the port 2222 and try again from your other computer. add the rule to all profiles: Domain,Public,Private

Читайте также:  После переустановки windows компьютер постоянно перезагружается

ps: not recommended to keep it, but you can try deactivating the firewalls via powershell Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
and don’t forget to re-enable it Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True

aclifton314 commented Feb 17, 2020 •

I set an inbound rule for port 2222 that allows all connections and set it for all profiles as you said above. It is also set for the TCP protocol and I restarted the desktop machine.

I ran ssh -p 2222 desktop.address.com from my laptop and still get the Resource temporarily unavailable error.

One thing I noticed was when I open the Windows Defender Firewall and click «Allow an app or feature through Windows Defender Firewall», the rule I set is selected only for Domain and Private. But when I go to the advanced settings and look for the inbound rule, there are 2 of them.

One of them has a green check mark next to it and is set for Domain and Private under profile and the other has no green check mark and is set Public under profile.

One thing I noticed was when I open the Windows Defender Firewall and click «Allow an app or feature through Windows Defender Firewall», the rule I set is selected only for Domain and Private. But when I go to the advanced settings and look for the inbound rule, the profile says All.

Источник

Как исправить Resource Temprorarily unvailable при ssh подключении к любому адресу?

При ssh подключении выходит ошибка, что ресурс временно недоступен, например:
При вводе
ssh root@46.229.215.47

То есть, не доходит до пароля.
Использую Windows и установленный Ubuntu 18.04, терминал Bash.
Тоже самое происходит и в родной консоли Windows.
Порт 22 принудительно открыл в брандмауре.
Перерыл весь интернет, темы закрываются так и не дав решения.

  • Вопрос задан более двух лет назад
  • 1573 просмотра

cehka Вы как-то странно вопросы задаете.

> Уже понял что это от машины. Только вот всё равно не подключается))

Что к чему не подключается? Я так понимаю, пароль к ssh вы сменили и у вас что-то с гитом не получается? Или вы не можете подключиться к ssh чтобы сменить пароль? Откорректируйте вопрос так, чтобы он был актуальным. Что вы пытаетесь сделать, какие команды выполняете и какой вывод вы получаете.

К слову, для авторизации по ssh рекомендую настроить авторизацию по RSA ключу, вместо пароля, но это так, на будущее =)

Источник

Error: READ: Resource temporarily unavailable #50

Comments

Azaaaad commented Jun 1, 2018 •

After this command:
./mtproto-proxy -u nobody -p 8888 -H 443 -S 69529dc4287accaefedc4aee6cc46eb4 —aes-pwd proxy-secret proxy-multi.conf -M 1

I face this message and client cant connect to the proxy server:

[root@static bin]# ./mtproto-proxy -u nobody -p 8888 -H 443 -S 69529dc4287accaefedc4aee6cc46eb4 —aes-pwd proxy-secret proxy-multi.conf -M 1
[25098][2018-06-01 11:05:28.779760 local] Invoking engine mtproxy-0.01 compiled at Jun 1 2018 03:58:18 by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) 64-bit after commit e231d04
[25098][2018-06-01 11:05:28.780387 local] config_filename = ‘proxy-multi.conf’
[25098][2018-06-01 11:05:28.781581 local] creating 1 workers
[25098][2018-06-01 11:05:28.784651 local] Started as [xxx.xxx.xxx.xxx:8888:25098:1527865528]
[25098][2018-06-01 11:05:28.784771 local] configuration file proxy-multi.conf re-read successfully (797 bytes parsed), new configuration active
[25098][2018-06-01 11:05:28.785102 local] main loop
READ: Resource temporarily unavailable
[25099][2018-06-01 11:05:28.796551 local] Started as [xxx.xxx.xxx.xxx:8888:25099:1527865528]
[25099][2018-06-01 11:05:28.796658 local] configuration file proxy-multi.conf re-read successfully (797 bytes parsed), new configuration active
[25099][2018-06-01 11:05:28.796890 local] main loop

The text was updated successfully, but these errors were encountered:

Источник

Оцените статью