Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After upgrading to ubuntu 22.04 sysctl changes are needed again #78

Closed
aseques opened this issue Feb 13, 2024 · 3 comments
Closed

After upgrading to ubuntu 22.04 sysctl changes are needed again #78

aseques opened this issue Feb 13, 2024 · 3 comments

Comments

@aseques
Copy link

aseques commented Feb 13, 2024

I have code I've written a few years ago that has been using icmplib since the beggining, on my system with ubuntu 22.04 it worked without any issues. A few days ago I updated to ubuntu 23.10 and I'm getting an error related to the permissions, it happens both on python 3.10 and 3.11 (on two different systems), and it only goes away after doing the sysctl net.ipv4.ping_group_range change. So I guess something has changed on the defaults since last version but I haven't been able to find it.

You could update the documentation here mentioning that after 22.04 it is capped again

*Since Ubuntu 20.04 LTS, this manipulation is no longer necessary.*

The error is the following

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/icmplib/sockets.py", line 88, in __init__
    self._sock = self._create_socket(
                 ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/icmplib/sockets.py", line 452, in _create_socket
    return socket.socket(
           ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 232, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/icmplib/sockets.py", line 97, in __init__
    raise SocketPermissionError
icmplib.exceptions.SocketPermissionError: Root privileges are required to create the socket```
@aseques aseques changed the title After upgrading to ubuntu 22.04 this is needed again After upgrading to ubuntu 22.04 sysctl changes are needed again Feb 13, 2024
@ValentinBELYN
Copy link
Owner

Thanks for the information, this will be fixed in the next version 😉

@kalvdans
Copy link

Digged some more into this.

The sysctl seems to be set in Ubuntu 22.04 by systemd 249.11-0ubuntu3.11 /usr/lib/sysctl.d/50-default.conf

This file does not exist in Ubuntu 24.04 in systemd 255.2-3ubuntu2.

The file seems was added by https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1721223 but later removed by some other merge in https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd

Please don't close the issue before the documentation update is checked into git.

@aseques
Copy link
Author

aseques commented May 27, 2024

I have just upgraded to 24.04 and I needed to change the values again I will propose a small change in the docs to make the change persistent across upgrades.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants