Skip to content

Errors galore during apt-get dist-upgrade #1851

Closed

Description

I'm trying to get a working PHP 7.1 / NGINX stack set up on Ubuntu on Windows.

Is that possible, or am I out too soon with the status of the current beta?

I've gotten as far as a working PHP 7.1 CLI installation, and working SSH daemon, and have been able to run unit-tests etc. and debug with xdebug from my Windows-installation of PHP Storm, and I was pretty excited about that!

I did also manage to get a working NGINX set up, by using the master_process off directive, which I don't understand what is for, but something to do with IPv6 being not yet fully implemented or something, and this is a work-around of sorts?

I have been unable to run PHP scripts under NGINX, so that's the key piece missing for me at this time. I've gotten as far as to no error-messages showing up in NGINX's error.log, but all I've managed to get it to serve is the default index.html file that comes with NGINX, it won't serve PHP scripts.

I have all my installation notes here, hoping to eventually succeed and being able to share with others how to get this working.

Following my own instructions, I begin by doing the usual apt-get update, dist-upgrade, upgrade - but during the dist-upgrade, I'm getting a long list of errors - here's the tail of the output:

Preparing to unpack .../apport_2.14.1-0ubuntu3.23_all.deb ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of stop.
Unpacking apport (2.14.1-0ubuntu3.23) over (2.14.1-0ubuntu3.21) ...
Preparing to unpack .../w3m_0.5.3-15ubuntu0.1_amd64.deb ...
Unpacking w3m (0.5.3-15ubuntu0.1) over (0.5.3-15) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for shared-mime-info (1.2-0ubuntu3) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Setting up libgnutls26:amd64 (2.12.23-12ubuntu2.7) ...
Setting up libgnutls-openssl27:amd64 (2.12.23-12ubuntu2.7) ...
Setting up libssl1.0.0:amd64 (1.0.1f-1ubuntu2.22) ...
Setting up libdbus-1-3:amd64 (1.6.18-0ubuntu4.5) ...
Setting up libudev1:amd64 (204-5ubuntu20.24) ...
Setting up udev (204-5ubuntu20.24) ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of restart.
Removing 'diversion of /bin/udevadm to /bin/udevadm.upgrade by fake-udev'
update-initramfs: deferring update (trigger activated)
Setting up libkrb5support0:amd64 (1.12+dfsg-2ubuntu5.3) ...
Setting up libk5crypto3:amd64 (1.12+dfsg-2ubuntu5.3) ...
Setting up libkrb5-3:amd64 (1.12+dfsg-2ubuntu5.3) ...
Setting up libgssapi-krb5-2:amd64 (1.12+dfsg-2ubuntu5.3) ...
Setting up libsystemd-daemon0:amd64 (204-5ubuntu20.24) ...
Setting up libapparmor1:amd64 (2.10.95-0ubuntu2.6~14.04.1) ...
Setting up libsystemd-login0:amd64 (204-5ubuntu20.24) ...
Setting up dbus (1.6.18-0ubuntu4.5) ...
Failed to open connection to "system" message bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of start.
Setting up systemd-services (204-5ubuntu20.24) ...
Setting up libpam-systemd:amd64 (204-5ubuntu20.24) ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
invoke-rc.d: unknown initscript, /etc/init.d/systemd-logind not found.
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of start.
Setting up libxml2:amd64 (2.9.1+dfsg1-3ubuntu4.9) ...
Setting up libevent-2.0-5:amd64 (2.0.21-stable-1ubuntu1.14.04.2) ...
Setting up libfreetype6:amd64 (2.5.2-1ubuntu2.6) ...
Setting up libgc1c2:amd64 (1:7.2d-5ubuntu2.1) ...
Setting up libicu52:amd64 (52.1-3ubuntu0.5) ...
Setting up eject (2.1.5+deb1+cvs20081104-13.1ubuntu0.14.04.1) ...
Setting up initramfs-tools-bin (0.103ubuntu4.7) ...
Setting up initramfs-tools (0.103ubuntu4.7) ...
update-initramfs: deferring update (trigger activated)
Setting up makedev (2.3.1-93ubuntu2~ubuntu14.04.1) ...
grep: /proc/1/environ: No such file or directory
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘mem-’: Function not implemented
makedev mem c 1 1 root kmem 0640: failed
mknod: ‘kmem-’: Function not implemented
makedev kmem c 1 2 root kmem 0640: failed
mknod: ‘null-’: Function not implemented
makedev null c 1 3 root root 0666: failed
mknod: ‘port-’: Function not implemented
makedev port c 1 4 root kmem 0640: failed
mknod: ‘zero-’: Function not implemented
makedev zero c 1 5 root root 0666: failed
mknod: ‘full-’: Function not implemented
makedev full c 1 7 root root 0666: failed
mknod: ‘random-’: Function not implemented
makedev random c 1 8 root root 0666: failed
mknod: ‘urandom-’: Function not implemented
makedev urandom c 1 9 root root 0666: failed
mknod: ‘tty-’: Function not implemented
makedev tty c 5 0 root tty 0666: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘ram0-’: Function not implemented
makedev ram0 b 1 0 root disk 0660: failed
mknod: ‘ram1-’: Function not implemented
makedev ram1 b 1 1 root disk 0660: failed
mknod: ‘ram2-’: Function not implemented
makedev ram2 b 1 2 root disk 0660: failed
mknod: ‘ram3-’: Function not implemented
makedev ram3 b 1 3 root disk 0660: failed
mknod: ‘ram4-’: Function not implemented
makedev ram4 b 1 4 root disk 0660: failed
mknod: ‘ram5-’: Function not implemented
makedev ram5 b 1 5 root disk 0660: failed
mknod: ‘ram6-’: Function not implemented
makedev ram6 b 1 6 root disk 0660: failed
mknod: ‘ram7-’: Function not implemented
makedev ram7 b 1 7 root disk 0660: failed
mknod: ‘ram8-’: Function not implemented
makedev ram8 b 1 8 root disk 0660: failed
mknod: ‘ram9-’: Function not implemented
makedev ram9 b 1 9 root disk 0660: failed
mknod: ‘ram10-’: Function not implemented
makedev ram10 b 1 10 root disk 0660: failed
mknod: ‘ram11-’: Function not implemented
makedev ram11 b 1 11 root disk 0660: failed
mknod: ‘ram12-’: Function not implemented
makedev ram12 b 1 12 root disk 0660: failed
mknod: ‘ram13-’: Function not implemented
makedev ram13 b 1 13 root disk 0660: failed
mknod: ‘ram14-’: Function not implemented
makedev ram14 b 1 14 root disk 0660: failed
mknod: ‘ram15-’: Function not implemented
makedev ram15 b 1 15 root disk 0660: failed
mknod: ‘ram16-’: Function not implemented
makedev ram16 b 1 16 root disk 0660: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘loop0-’: Function not implemented
makedev loop0 b 7 0 root disk 0660: failed
mknod: ‘loop1-’: Function not implemented
makedev loop1 b 7 1 root disk 0660: failed
mknod: ‘loop2-’: Function not implemented
makedev loop2 b 7 2 root disk 0660: failed
mknod: ‘loop3-’: Function not implemented
makedev loop3 b 7 3 root disk 0660: failed
mknod: ‘loop4-’: Function not implemented
makedev loop4 b 7 4 root disk 0660: failed
mknod: ‘loop5-’: Function not implemented
makedev loop5 b 7 5 root disk 0660: failed
mknod: ‘loop6-’: Function not implemented
makedev loop6 b 7 6 root disk 0660: failed
mknod: ‘loop7-’: Function not implemented
makedev loop7 b 7 7 root disk 0660: failed
mknod: ‘tty0-’: Function not implemented
makedev tty0 c 4 0 root tty 0600: failed
mknod: ‘console-’: Function not implemented
makedev console c 5 1 root tty 0600: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘tty2-’: Function not implemented
makedev tty2 c 4 2 root tty 0600: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘tty3-’: Function not implemented
makedev tty3 c 4 3 root tty 0600: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘tty4-’: Function not implemented
makedev tty4 c 4 4 root tty 0600: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘tty5-’: Function not implemented
makedev tty5 c 4 5 root tty 0600: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘tty6-’: Function not implemented
makedev tty6 c 4 6 root tty 0600: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘tty7-’: Function not implemented
makedev tty7 c 4 7 root tty 0600: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘tty8-’: Function not implemented
makedev tty8 c 4 8 root tty 0600: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘tty9-’: Function not implemented
makedev tty9 c 4 9 root tty 0600: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘mixer-’: Function not implemented
makedev mixer c 14 0 root audio 0660: failed
mknod: ‘mixer1-’: Function not implemented
makedev mixer1 c 14 16 root audio 0660: failed
mknod: ‘mixer2-’: Function not implemented
makedev mixer2 c 14 32 root audio 0660: failed
mknod: ‘mixer3-’: Function not implemented
makedev mixer3 c 14 48 root audio 0660: failed
mknod: ‘sequencer-’: Function not implemented
makedev sequencer c 14 1 root audio 0660: failed
mknod: ‘midi00-’: Function not implemented
makedev midi00 c 14 2 root audio 0660: failed
mknod: ‘midi01-’: Function not implemented
makedev midi01 c 14 18 root audio 0660: failed
mknod: ‘midi02-’: Function not implemented
makedev midi02 c 14 34 root audio 0660: failed
mknod: ‘midi03-’: Function not implemented
makedev midi03 c 14 50 root audio 0660: failed
mknod: ‘dsp-’: Function not implemented
makedev dsp c 14 3 root audio 0660: failed
mknod: ‘dsp1-’: Function not implemented
makedev dsp1 c 14 19 root audio 0660: failed
mknod: ‘dsp2-’: Function not implemented
makedev dsp2 c 14 35 root audio 0660: failed
mknod: ‘dsp3-’: Function not implemented
makedev dsp3 c 14 51 root audio 0660: failed
mknod: ‘audio-’: Function not implemented
makedev audio c 14 4 root audio 0660: failed
mknod: ‘audio1-’: Function not implemented
makedev audio1 c 14 20 root audio 0660: failed
mknod: ‘audio2-’: Function not implemented
makedev audio2 c 14 36 root audio 0660: failed
mknod: ‘audio3-’: Function not implemented
makedev audio3 c 14 52 root audio 0660: failed
mknod: ‘sndstat-’: Function not implemented
makedev sndstat c 14 6 root audio 0660: failed
mknod: ‘audioctl-’: Function not implemented
makedev audioctl c 14 7 root audio 0660: failed
mknod: ‘mpu401data-’: Function not implemented
makedev mpu401data c 31 0 root audio 0660: failed
mknod: ‘mpu401stat-’: Function not implemented
makedev mpu401stat c 31 1 root audio 0660: failed
mknod: ‘midi0-’: Function not implemented
makedev midi0 c 35 0 root audio 0660: failed
mknod: ‘rmidi0-’: Function not implemented
makedev rmidi0 c 35 64 root audio 0660: failed
mknod: ‘smpte0-’: Function not implemented
makedev smpte0 c 35 128 root audio 0660: failed
mknod: ‘midi1-’: Function not implemented
makedev midi1 c 35 1 root audio 0660: failed
mknod: ‘rmidi1-’: Function not implemented
makedev rmidi1 c 35 65 root audio 0660: failed
mknod: ‘smpte1-’: Function not implemented
makedev smpte1 c 35 129 root audio 0660: failed
mknod: ‘midi2-’: Function not implemented
makedev midi2 c 35 2 root audio 0660: failed
mknod: ‘rmidi2-’: Function not implemented
makedev rmidi2 c 35 66 root audio 0660: failed
mknod: ‘smpte2-’: Function not implemented
makedev smpte2 c 35 130 root audio 0660: failed
mknod: ‘midi3-’: Function not implemented
makedev midi3 c 35 3 root audio 0660: failed
mknod: ‘rmidi3-’: Function not implemented
makedev rmidi3 c 35 67 root audio 0660: failed
mknod: ‘smpte3-’: Function not implemented
makedev smpte3 c 35 131 root audio 0660: failed
/sbin/MAKEDEV: warning: can't read /proc/devices
mknod: ‘agpgart-’: Function not implemented
makedev agpgart c 10 175 root video 0660: failed
Setting up libapparmor-perl (2.10.95-0ubuntu2.6~14.04.1) ...
Setting up apparmor (2.10.95-0ubuntu2.6~14.04.1) ...
Installing new version of config file /etc/init.d/apparmor ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of start.
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of reload.
Setting up libisc95 (1:9.9.5.dfsg-3ubuntu0.13) ...
Setting up libdns100 (1:9.9.5.dfsg-3ubuntu0.13) ...
Setting up libisccc90 (1:9.9.5.dfsg-3ubuntu0.13) ...
Setting up libisccfg90 (1:9.9.5.dfsg-3ubuntu0.13) ...
Setting up libbind9-90 (1:9.9.5.dfsg-3ubuntu0.13) ...
Setting up liblwres90 (1:9.9.5.dfsg-3ubuntu0.13) ...
Setting up bind9-host (1:9.9.5.dfsg-3ubuntu0.13) ...
Setting up dnsutils (1:9.9.5.dfsg-3ubuntu0.13) ...
Setting up krb5-locales (1.12+dfsg-2ubuntu5.3) ...
Setting up openssl (1.0.1f-1ubuntu2.22) ...
Setting up tcpdump (4.9.0-1ubuntu1~ubuntu14.04.1) ...
Installing new version of config file /etc/apparmor.d/usr.sbin.tcpdump ...
Setting up python3-problem-report (2.14.1-0ubuntu3.23) ...
Setting up python3-apport (2.14.1-0ubuntu3.23) ...
Setting up apport (2.14.1-0ubuntu3.23) ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of start.
Setting up w3m (0.5.3-15ubuntu0.1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.11) ...
Processing triggers for initramfs-tools (0.103ubuntu4.7) ...
Processing triggers for ureadahead (0.100.0-16) ...

Specifically, I'm concerned about the following messages:

  • mknod: ‘ram0-’: Function not implemented
    makedev ram0 b 1 0 root disk 0660: failed etc.
  • runlevel:/var/run/utmp: No such file or directory
  • /sbin/MAKEDEV: warning: can't read /proc/devices
  • invoke-rc.d: policy-rc.d denied execution of start
  • /com/ubuntu/upstart: Connection refused

Is any of this "serious"? Could any of it explain why I can't seem to get NGINX to play nice with FPM?

I'm not a Linux dude, I'm a Windows user, so this is pretty adventurous for me - don't expect me to understand very technical descriptions of any details, but please let me know if you have any ideas or clues on how to get past this last speedbump to a working installation?

Activity

  1. aseering commented on Apr 3, 2017

    @aseering
    Contributor

    Hm... So, I have not tried to run PHP 7 under WSL, but I can comment about those particular warnings.

    The /com/ubuntu/upstart: Connection refused error is a legitimate failure. It has been reported several other times; I think #791 is possibly the most-relevant ticket. It essentially means that Linux init scripts, the scripts that cause system services to run at system boot, are not being run. Some init scripts don't work at all with WSL. Others do work, but they don't work automatically; you have to manually do sudo service <servicename> start to start the service.

    If I had to guess, I would guess that this is the issue that you are hitting: I believe nginx runs as a system service, and FPM also runs as a system service. So I suspect that neither is starting automatically. You'll probably have to do sudo service nginx start and sudo service php-fpm start, or something similar. (I've seen the nginx init script work this way; I haven't tried the FPM one myself.) Anyway, if both of them are running, then if you run ps ax at a bash prompt to list all Linux processes, you should see at least one nginx process and one php-fpm process in the process list.

    All of the rest of the errors are occurring when apt tries to rebuild your initramfs, a package used for the first stage of Linux's boot that contains the core kernel and hardware drivers. This happens if you get an update to your Linux kernel, such as during a dist-upgrade. On a real Linux system, those errors would be severe; they would probably result in an unbootable system. However, WSL doesn't boot :-) It doesn't use the initramfs at all. The dist-upgrade still tries to build an initramfs, but it's vestigial; you can ignore these failures.

    Aside: your problem may be that you're trying to use PHP 7 :-) The last time I tried (with either 7.0 or 7.1), I promptly hit a deterministic segfault in the core PHP interpreter which, after a few months, the PHP folks have apparently not yet had a chance to start looking into. Maybe my perspective is skewed. But to my thinking, trying to run a buggy language interpreter on top of a beta runtime environment is something that has some risk of ending badly :-) Though if you do get it working, please post back here; I'd be curious to hear your results!

  2. aseering commented on Apr 3, 2017

    @aseering
    Contributor

    Also, one other aside: Microsoft has announced that the next Windows release, Windows 10 "Creators", will ship on April 11. (It is already available to people who have opted into Insider builds.) The next release contains a huge number of changes and improvements. If you use WSL a lot, I would strongly advise you to upgrade as soon as you are comfortable doing so. For example, there are a bunch of bugs in WSL's network stack that are fixed in the new version. Those could certainly cause problems for something like PHP.

  3. mindplay-dk commented on Apr 3, 2017

    @mindplay-dk
    Author

    So I suspect that neither is starting automatically. You'll probably have to do sudo service nginx start and sudo service php-fpm start, or something similar.

    I've been doing that, and the error-log was helpful to resolve some of the initial issues with NGINX, the IPv6 stuff - but with FPM, I haven't been able to get it to launch, and there's nothing in the error-log. I wonder if it's affected by the same IPv6 issues maybe? Though I think I had it configured to use a /var/run socket rather than an IP port, so that probably shouldn't be the issue... I might should have tried to reconfigured it to serve on an IP port and connect NGINX that way?

    Anyway, I rage nuked the whole thing from orbit thinking it was beyond fixing, so I'll have to find the time to set everything up again from scratch first...

    Aside: your problem may be that you're trying to use PHP 7 :-)

    Well, I am happy to report PHP 7.1 works very well at least under CLI - I can't speak to the FPM module because I don't have it working yet, but everything works under CLI, including opcache and xdebug, and I've been successfully running my integration test-suites with PostgreSQL queries and whatnot.

    So far so good :-)

    Maybe my perspective is skewed. But to my thinking, trying to run a buggy language interpreter on top of a beta runtime environment is something that has some risk of ending badly :-)

    I don't think PHP 7.1 is buggy? It has been stable for a while now. Me and my coworkers have been running PHP 7 for about six months now without problems, some have been running PHP 7.1 for a little while now without problems too.

    I realize trying to run this under a beta environment is risky, but PHP on Windows in general is already a shoddy affair - and this is for development of course, I don't plan on actually hosting anything on my Windows workstation ;-)

    Anyways, thanks for the input.

    Will definitely post updates here if I figure it out.

  4. mindplay-dk commented on Apr 4, 2017

    @mindplay-dk
    Author

    Adam Seering (@aseering) if I get these services to run, is there any way to "daemonize" them and keep them running in the background? Or does everything live and die with the bash window at the moment?

  5. MikeGitb commented on Apr 4, 2017

    @MikeGitb

    Or does everything live and die with the bash window at the moment?

    Pretty much.Latest dupe on that topic: #1849

  6. aseering commented on Apr 4, 2017

    @aseering
    Contributor

    Rasmus Schultz (@mindplay-dk) -- it's slightly better than that: Everything dies when the last bash window closes. So if you can cause there to be a "hidden" bash window somewhere (using a few lines of vbscript, the third-party "run.exe", etc), you can help apps to stay alive for longer. Still a hack, though :-)

  7. mindplay-dk commented on Apr 5, 2017

    @mindplay-dk
    Author

    Adam Seering (@aseering) in your opinion, should I continue struggling with this, or would it be easier to just use Docker? Performance should be on par with UOW in the latest versions, which use the same virtualization technology, right? Maybe Docker is more stable, having been around longer? (this is for development only.)

  8. fpqc commented on Apr 5, 2017

    @fpqc

    By the way, upstart was dropped in 16.04, and hints have been dropped about container support, which means systemd support a fortiori. If they're supporting the kernel features for containers, then it's really just a matter of them changing the way that init works (which was at least discussed by Ben Hillis in the interop video (he said maybe MS's init daemon, which manages interop, marshalling, and unmarshalling, could be run without being PID=1)).

  9. aseering commented on Apr 6, 2017

    @aseering
    Contributor

    Rasmus Schultz (@mindplay-dk) -- WSL actually does not use virtualization technology at all. It is running Linux binaries on bare metal by modifying the Windows kernel to understand and handle Linux system calls natively. Docker actually has a virtual machine and a heavily stripped-down Linux kernel under the hood.

    That said, Docker has already been pretty well performance-tuned, and WSL has not yet... So I think it's a toss-up.

    If you just want to get your code running, and you know it runs in Docker, then yeah, I would go ahead and use Docker. WSL's real utility comes if you want to edit your Linux code files using Windows apps (though I hear that works acceptably in Windows Docker these days too?), call Windows apps from your Linux scripts, etc.

  10. aseering commented on Apr 6, 2017

    @aseering
    Contributor

    Incidentally, Rasmus Schultz (@mindplay-dk) -- how are you going about installing php-fpm? I just did the following and it seems to work fine for me on Ubuntu 16.04, as used on the prerelease Creators update:

    sudo apt install php7.0-fpm
    sudo service php7.0-fpm start
    

    With that, I see the service started and listening on /run/php/php7.0-fpm.sock.

  11. Dragory commented on Apr 9, 2017

    @Dragory

    Adam Seering (@aseering) In my case, php-fpm starts up fine (socket file shows up in /run/php), but crashes(?) when used through nginx's fastcgi_pass. More specifically, when browsing to a PHP file, it loads partially and then stops loading, eventually timing out. Nothing in php7.0-fpm.log (except the startup notices), nginx logs show the timeout (upstream timed out). This happens with any file, even if it only contains one echo. Should I make a separate issue for this?

  12. mindplay-dk commented on Apr 9, 2017

    @mindplay-dk
    Author

    Adam Seering (@aseering) I don't have the Creators update yet, and I'm installing PHP 7.1 not 7.0, otherwise same, yeah.

  13. mindplay-dk commented on Apr 9, 2017

    @mindplay-dk
    Author

    I took another stab at this, starting from scratch, this time with just setting my hostname and language, then installing PHP 7.1 and NGINX, nothing more - so:

    sudo apt-get update
    sudo apt-get dist-upgrade
    sudo apt-get upgrade
    
    sudo apt-get remove apache
    sudo apt-get remove ^php.*
    sudo apt-get autoremove
    
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    
    sudo apt-get install php7.1 php7.1-curl php7.1-gd php7.1-intl php7.1-fpm php7.1-cli php7.1-opcache php7.1-mbstring php7.1-xml php7.1-zip php7.1-mysql php7.1-pgsql php-xdebug
    
    sudo apt-get install nginx
    
    sudo service php7.1-fpm start
    sudo service nginx start
    

    Without adding the master_process off; directive to /etc/nginx/nginx.conf it doesn't launch at all, so I had to do that.

    I've created a sample config file /etc/nginx/sites-enabled/test.conf:

    server {
        listen       80;
        server_name  test;
        root         /mnt/c/workspace/test;
        index        index.php;
    
        location / {
            try_files /$uri /index.php?$query_string;
            autoindex on;
        }
    
        location ~ \.php$ {
            try_files $uri /index.php =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass   unix:/var/run/php/php7.1-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }
    

    Pretty standard? C:\workspace is where I keep my projects, hence root /mnt/c/workspace/test, which seems to work. (see below.)

    I can confirm that both services are running:

    $ sudo service php7.1-fpm status && sudo service nginx status
     * php-fpm7.1 is running
     * nginx is running
    

    I can confirm that the fpm script creates the .sock file that the NGINX script is configured to look for:

    $ ls /var/run/php
    php7.1-fpm.pid  php7.1-fpm.sock
    

    I can confirm that it's serving files from that folder - I created a test.html file, and can see it with a local browser at http://test/test.html

    I've created a test.php file with <?php phpinfo(); but can not see it with a local browser at http://test/test.php - what I see is the 502 Bad Gateway page from NGINX.

    In /var/log/nginx/error.log, every time I request the PHP file, I see e.g.:

    2017/04/09 12:18:44 [alert] 204#0: *21 connect() failed (22: Invalid argument) while connecting to upstream, client: 127.0.0.1, server: test, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "test"
    

    There is nothing showing in /var/log/php7.1-fpm.log, which seems to suggests it's never getting the request in the first place, right?

    It seems others have had a similar issue but it sounds like they did basically what I did, and it fixed their problem then - but doesn't appear to fix my problem now. The only notable difference seems to be, they were running PHP 7.0, I'm trying to run PHP 7.1 - not sure if that could make a difference, but I need 7.1.

    Any idea what to try next?

  14. aseering commented on Apr 9, 2017

    @aseering
    Contributor

    Hm... Is there any way you could run php-fpm in the foreground and under strace -ff, and post the resulting trace? That could confirm whether php-fpm is receiving the connections or not receiving them at all.

    Also -- is your version of php-fpm configured to log directly to a file by itself, or is it configured to log using syslog/systemd? The latter isn't yet supported under WSL; programs need to use a simple log file.

  15. mindplay-dk commented on Apr 9, 2017

    @mindplay-dk
    Author

    Will try to answer those questions, but I just wiped my UOW again and installed the Creators update - going to try a reinstall with the latest and greatest. I'll let you know how this pans out.

  16. mindplay-dk commented on Apr 9, 2017

    @mindplay-dk
    Author

    Okay, much simpler, and almost no errors during install/upgrade after Creators update!

    I removed several steps from my installation notes:

    • the language setting: the installer now prompts and makes this optional
    • the hostname settings: the installer makes them for you
    • the removal of apache and PHP: they're not auto-installed anymore
    • the master_process off workaround: no longer needed (or no effect, see below)

    I don't see any of the upstart error notices anymore, and all of those driver/device-related error messages didn't appear this time.

    This time I did only precisely this:

    sudo apt-get update
    sudo apt-get dist-upgrade
    sudo apt-get upgrade
    
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    
    sudo apt-get install php7.1 php7.1-curl php7.1-gd php7.1-intl php7.1-fpm php7.1-cli php7.1-opcache php7.1-mbstring php7.1-xml php7.1-zip php7.1-mysql php7.1-pgsql php-xdebug
    
    sudo apt-get install nginx
    

    Then put in an NGINX config file, and then:

    sudo service php7.1-fpm start
    sudo service nginx start
    

    (Those were my exact steps - this should now be completely reproducible, e.g. on a system with Creators updated and a clean UOW install, or e.g. after lxrun /uninstall /full and a reinstall.)

    I'm much closer to something working now, but there is still a problem: after approximately 16K of output, the response stream appears to freeze - the browser stalls for like 5 minutes, and I then see net::ERR_INCOMPLETE_CHUNKED_ENCODING in Chrome.

    In the NGINX log, I now see a slightly different entry like this one:

    2017/04/09 20:38:07 [error] 107#107: *9 upstream timed out (110: Connection timed out) while reading upstream, client: 127.0.0.1, server: test, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "test"
    

    I did try the master_process off workaround, but it appears this is no longer necessary, and has no bearing on this issue.

    Any idea what to try next? I feel like we're very nearly there :-)

  17. mindplay-dk commented on Apr 9, 2017

    @mindplay-dk
    Author

    It's working! :-D

    I don't know what's up with the socket-based default FPM setting, but it doesn't work on this setup, so I've reconfigured FPM with listen = 127.0.0.1:9000 and using fastcgi_pass 127.0.0.1:9000 in my NGINX config files, and it works.

    Honestly, I don't know what I'm doing - I'm not a Linux or server (or network) guy, and I have no idea what difference it makes or why it matters if NGINX and FPM are talking via sockets or TCP.

    Either way, this should be good enough for a development setup? Whatever works, right? ;-)

    I suppose UOW ought to add some triggers or something to make sure this is the default setting at install? Unless they think whatever is causing the socket blockage will be fixed at a later time, probably better to override these settings with something that works?

  18. aseering commented on Apr 9, 2017

    @aseering
    Contributor

    Great! Glad it works :-D

    The WSL team generally doesn't seem to like overriding settings. Especially not for third-party packages -- PHP 7.1 is not yet supported by Canonical/Ubuntu, it's only available from third-party repositories, and since different people could package PHP with configuration files in different locations, there's no clear standard way to patch it.

    Fortunately, the WSL team's intent is to make everything work in WSL that works on regular Linux. So hopefully this will get fixed.

    In order to fix this, though, I think we would need an strace of php-fpm and nginx when this bug is happening. Most likely one of the two is using some feature of UNIX sockets that hasn't been fully implemented yet, but that works for TCP sockets. (Windows supports TCP natively and does not support UNIX sockets natively, so WSL's implementation of the former has a bit of a head start.)

    Ping Sunil Muthuswamy (@sunilmut) -- no trace yet, but this sounds like a WSL UNIX-sockets limitation. (Issue repro'able per above; nginx -> PHP 7.1 works over TCP but not UNIX sockets in Creators.)

  19. mindplay-dk commented on Apr 9, 2017

    @mindplay-dk
    Author

    In order to fix this, though, I think we would need an strace of php-fpm and nginx when this bug is happening.

    I don't know how to do a "strace", nor am I completely sure what that is. Did I mention I'm Linux illiterate?

    But you have exact steps to reproduce the issue now, I'm betting someone on the Microsoft side knows much better than I what to do with that... :-)

  20. mindplay-dk commented on Apr 9, 2017

    @mindplay-dk
    Author

    Oh and I guess I can close this now :-)

  21. mindplay-dk commented on Apr 10, 2017

    @mindplay-dk
    Author

    Adam Seering (@aseering) erm, is there a more general issue with sockets perhaps?

    I just tried to run php-pm, and it just exits with an error-message like:

    [Symfony\Component\Debug\Exception\ContextErrorException]
    Warning: stream_socket_server(): unable to connect to unix:///mnt/c/workspace/test/http-bench/.ppm/run/controller.sock (Unknown error)
    

    I don't see anybody else reporting that issue, and this appears to be socket-related again, so it's making me rather suspicious. I didn't think anything would work on Linux without sockets? Aren't they used for pretty much anything and everything server-related?

    Or is it maybe not even really fully supported on UOW yet?

    A quick search for sockets seems to indicate lots of socket-related issues with Node, so maybe this area is still work in progress?

  22. mindplay-dk commented on Apr 10, 2017

    @mindplay-dk
    Author

    Whoops, haha, here we go.

    Well, I guess sit tight until they fix this one ;-)

  23. fpqc commented on Apr 10, 2017

    @fpqc

    Rasmus Schultz (@mindplay-dk) it's not true though. Sockets are implemented but not all socket options and modes are implemented.

  24. sunilmut commented on Apr 10, 2017

    @sunilmut
    Member

    Rasmus Schultz (@mindplay-dk) - I would actually reopen this issue or post a new one for your php-pm problem, following the template. Lot of socket options have been implemented and lot more left to be. So, we try to prioritize based on the issues reported here. For that we need to be able to root cause the issue and fix those as they come. In this particular case, it looks like php-pm is trying to connect to some server that provides service over unix:///mnt/c/workspace/test/http-bench/.ppm/run/controller.sock. Do you know if there is a service that needs to be started? Sometimes, automatic start of service does not work on WSL, so one has to start them manually.

  25. mindplay-dk commented on Apr 10, 2017

    @mindplay-dk
    Author

    Sunil Muthuswamy (@sunilmut) I don't know precisely how it works - it supposedly can run stand-alone without any external service (e.g. NGINX) and I think that's the default. As far as my understanding, php-pm is the server.

    I would think you should prioritize FPM/NGINX though - it might even be the same socket option that's missing for both, who knows? I don't really know what I'm talking about ;-)

  26. zippaaa commented on Apr 15, 2017

    @zippaaa

    My solution nginx + php-fpm:

    Windows version: 1703 (15063.138)
    Linux version: Ubuntu 16.04

    folders (user: www-data, group: www-data):

    /var/http/
    /var/http/tmp/
    /var/http/logs/
    /var/http/sessions/
    /var/http/www/
    /var/http/www/site.loc/ (site.loc is symlink to windows folder /mnt/c/web/site.loc)
    

    sudo apt remove nginx
    install nginx from http://nginx.org/en/linux_packages.html (Pre-Built Packages for Stable version / For Ubuntu) (now version 1.12.0)
    sudo apt install php7.0 (or 7.1) ..., php7.0-fpm, ...

    /etc/nginx/nginx.conf

    user www-data;
    worker_processes auto;
    master_process off;
    pid /run/nginx.pid;
    
    ...
    
    http {
        ...
        fastcgi_buffering off;
        ...
    }
    

    /etc/nginx/site-enabled/site.loc

    server {
        server_name site.loc;
        listen 127.0.0.1:80;
    
        charset UTF-8;
        index index.php;
    
        disable_symlinks if_not_owner from=$root_path;
    
        error_log /var/http/logs/site.loc.error.log notice;
        access_log off;
    
        set $root_path /var/http/www/site.loc;
        root $root_path;
    
        client_body_temp_path /var/http/tmp;
    
        location ~ \.php$ {
            .......
            fastcgi_index index.php;
            fastcgi_pass unix:///var/http/tmp/site.loc.sock;
    
           #include fastcgi_params;
            include fastcgi.conf;
            #"fastcgi_params vs fastcgi.conf" see https://blog.martinfjordvald.com/2013/04/nginx-config-history-fastcgi_params-versus-fastcgi-conf/
        }
    
        ........
    }
    

    /etc/php/7.0/fpm/pool.d/site.loc

    [site.loc]
    pm = dynamic
    pm.start_servers = 1
    pm.min_spare_servers = 1
    pm.max_children = 5
    pm.max_spare_servers = 5
    listen = /var/http/tmp/site.loc.sock
    ;listen = 9003
    ;listen.allowed_clients = 127.0.0.1
    listen.mode = 0660
    listen.owner = www-data
    listen.group = www-data
    user = www-data
    group = www-data
    chdir = /var/http/www/site.loc
    
    php_flag[display_errors] = on
    php_admin_value[post_max_size] = 64M
    php_admin_value[upload_max_filesize] = 64M
    
    php_admin_value[display_errors] = stderr
    php_admin_value[log_errors] = On
    php_admin_value[upload_tmp_dir] = /var/http/tmp
    php_admin_value[session.save_path] = /var/http/sessions
    

    sudo service nginx restart
    sudo service php7.0-fpm restart

    socket working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions