Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

no ip_unprevileged_port_start found on Debian #20

Closed
kapitaali opened this issue Nov 5, 2020 · 8 comments
Closed

no ip_unprevileged_port_start found on Debian #20

kapitaali opened this issue Nov 5, 2020 · 8 comments
Labels
need more info Further information is requested

Comments

@kapitaali
Copy link

Hi,

trying this out but it's not working on Debian 9.9.

   😇    ❨site.js❩ Linux: about to disable privileged ports so we can bind to ports < 1024.
         ❨site.js❩ For details, see: https://source.small-tech.org/site.js/app/-/issues/169
sysctl: cannot stat /proc/sys/net/ipv4/ip_unprivileged_port_start: No such file or directory

   ❌    ❨site.js❩ Error: Could not disable privileged ports. Cannot bind to port 80 and 443. Exiting. Error: Command failed: sudo sysctl -w net.ipv4.ip_unprivileged_port_start=0
sysctl: cannot stat /proc/sys/net/ipv4/ip_unprivileged_port_start: No such file or directory

@kapitaali kapitaali changed the title no sysctl found on Debian no ip_unprevileged_port_start found on Debian Nov 5, 2020
@kapitaali
Copy link
Author

kapitaali commented Nov 5, 2020

If there's some info you need about my system; i can give it.

uname -a:
Linux 4.9.0-14-amd64 #1 SMP Debian 4.9.240-2 (2020-10-30) x86_64 GNU/Linux

The /proc/sys/net/ipv4 contains the following ip-parameters:

ip_default_ttl 
ip_dynaddr    
ip_early_demux
ip_forward         
ip_forward_use_pmtu
ipfrag_high_thresh
ipfrag_low_thresh 
ipfrag_max_dist    
ipfrag_secret_interval
ipfrag_time                
ip_local_port_range  
ip_local_reserved_ports
ip_nonlocal_bind
ip_no_pmtu_disc 

@kapitaali
Copy link
Author

Ok so I uninstalled this and tried installing with npm. It does install, but then when running site.js update, it says

fatal: Not a git repository (or any of the parent directories): .git
(node:3115) UnhandledPromiseRejectionWarning: Error: Command failed: pushd /home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js > /dev/null; git log -1 --oneline
fatal: Not a git repository (or any of the parent directories): .git

    at checkExecSyncError (child_process.js:611:11)
    at Object.execSync (child_process.js:647:15)
    at Function.readAndCacheManifest (/home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js/index.js:92:37)
    at Function.getFromManifest (/home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js/index.js:102:12)
    at Function.get releaseChannel [as releaseChannel] (/home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js/index.js:107:46)
    at update (/home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js/bin/commands/update.js:31:31)
    at Object.<anonymous> (/home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js/bin/site.js:11:23)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
(node:3115) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3115) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@aral
Copy link
Contributor

aral commented Nov 6, 2020

Thanks for the report. I’ll install a Debian image and test this out and see if I can reproduce it and report back.

@aral
Copy link
Contributor

aral commented Nov 6, 2020

Hi @kapitaali,

I just did the following and could not reproduce your error:

  • Installed latest Debian (10/buster).
  • Added my non-privileged account to sudoers as the Debian installer didn’t do this automatically for me.
  • In my non-privileged account, installed wget as Debian has neither wget or curl installed by default apparently. (sudo apt install wget)
  • Ran the Site.js installation command from sitejs.org. (wget -qO- https://sitejs.org/install | bash)
  • Created a simple site
    mkdir -p sandbox/hello-world
    echo 'Hello, world!' > sandbox/hello-world/index.html
    site sandbox/hello-world

And Site.js initialised and started serving the site at https://localhost without error.

I’m wondering what about your configuration is causing the issue.

A couple of questions:

  1. Did you change the permissions for sysctl (perhaps as part of hardening your system?)
  2. What command did you use to run Site.js via npm?

Thanks.

@aral aral added the need more info Further information is requested label Nov 6, 2020
@kapitaali
Copy link
Author

kapitaali commented Nov 6, 2020

Hi,

  1. no, did not touch sysctl, it is as it is
  2. used npm i -g @small-tech/site.js to install it and then site.js sandbox/hello-world to execute it

After having created the directories like you did, and having run the command site.js sandbox/hello-world I get an error:

   ❌    ❨site.js❩ Error: Could not disable privileged ports. Cannot bind to port 80 and 443. Exiting. Error: Command failed: pushd /home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js > /dev/null; git log -1 --oneline
fatal: Not a git repository (or any of the parent directories): .git

    at checkExecSyncError (child_process.js:611:11)
    at Object.execSync (child_process.js:647:15)
    at Function.readAndCacheManifest (/home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js/index.js:92:37)
    at Function.logAppNameAndVersion (/home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js/index.js:194:12)
    at Ensure.privilegedPortsAreDisabled (/home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js/bin/lib/ensure.js:127:14)
    at serve (/home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js/bin/commands/serve.js:189:10)
    at Object.<anonymous> (/home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js/bin/site.js:11:23)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32) {
  status: 128,
  signal: null,
  output: [
    null,
    <Buffer >,
    <Buffer 66 61 74 61 6c 3a 20 4e 6f 74 20 61 20 67 69 74 20 72 65 70 6f 73 69 74 6f 72 79 20 28 6f 72 20 61 6e 79 20 6f 66 20 74 68 65 20 70 61 72 65 6e 74 20 ... 19 more bytes>
  ],
  pid: 9292,
  stdout: <Buffer >,
  stderr: <Buffer 66 61 74 61 6c 3a 20 4e 6f 74 20 61 20 67 69 74 20 72 65 70 6f 73 69 74 6f 72 79 20 28 6f 72 20 61 6e 79 20 6f 66 20 74 68 65 20 70 61 72 65 6e 74 20 ... 19 more bytes>
}

@aral
Copy link
Contributor

aral commented Nov 7, 2020

  1. used npm i -g @small-tech/site.js to install it and then site.js sandbox/hello-world to execute it
   ❌    ❨site.js❩ Error: Could not disable privileged ports. Cannot bind to port 80 and 443. Exiting. Error: Command failed: pushd /home/linuxbrew/.linuxbrew/lib/node_modules/@small-tech/site.js > /dev/null; git log -1 --oneline

I’ve reproduced this second error by attempting to run Site.js via npx (basically equivalent to what you were doing).

Tracking internally here: https://source.small-tech.org/site.js/app/-/issues/250

The fix will be in the next release.

Thank you again for reporting this and apologies for the hassle. Since I’m either running it during development from my local git working directory or via the binary in production, I hadn’t considered this use case.

@aral
Copy link
Contributor

aral commented Nov 7, 2020

@kapitaali I just released version 16.0.1 that fixes your second issue. You should be able to run Site.js as a global module now and also, if you like, through npx. Thank you again for your help :)

Screenshot from 2020-11-07 15-00-55

@kapitaali
Copy link
Author

I have confirmed on my other system that it does in fact work with npm. This one needs inspecting, but it's not the site.js itself that is broken here. So thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants