lsof command on Solaris not able to find memory mapped files? - lsof

I created a sample program mmap to map the /dev/mem, want to see how could lsof find it. But found lsof didn't list the /dev/mem as the memory mapped file for the sample process:
root#sx86:/u/gwz# lsof|grep mmap
lsof: WARNING: vxfsu_get_ioffsets() returned an error.
lsof: WARNING: Thus, no vx_inode information is available
lsof: WARNING: for display or selection of VxFS files.
mmap 19297 root cwd VDIR 33,0 1024 252688 /u/gwz
mmap 19297 root txt VREG 33,0 8168 253370 /u/gwz/mmap
mmap 19297 root txt VREG 33,0 1425552 574 /usr/lib/libc/libc_hwcap2.so.1
mmap 19297 root txt VREG 33,0 245268 5816 /lib/ld.so.1
mmap 19297 root 0u VCHR 24,1 12582918 /devices/pseudo/pts#0:1->ttcompat->ldterm->ptem->pts
mmap 19297 root 1u VCHR 24,1 12582918 /devices/pseudo/pts#0:1->ttcompat->ldterm->ptem->pts
mmap 19297 root 2u VCHR 24,1 12582918 /devices/pseudo/pts#0:1->ttcompat->ldterm->ptem->pts
root#sx86:/u/gwz# lsof mmap
lsof: WARNING: vxfsu_get_ioffsets() returned an error.
lsof: WARNING: Thus, no vx_inode information is available
lsof: WARNING: for display or selection of VxFS files.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mmap 19297 root txt VREG 33,0 8168 253370 mmap
root#sx86:/u/gwz# lsof /dev/mem
lsof: WARNING: vxfsu_get_ioffsets() returned an error.
lsof: WARNING: Thus, no vx_inode information is available
lsof: WARNING: for display or selection of VxFS files.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
lsof 19404 root 6r VCHR 13,0 6815748 /dev/../devices/pseudo/mm#0:mem
root#sx86:/u/gwz# lsof /dev/../devices/pseudo/mm#0:mem
lsof: WARNING: vxfsu_get_ioffsets() returned an error.
lsof: WARNING: Thus, no vx_inode information is available
lsof: WARNING: for display or selection of VxFS files.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
lsof 19406 root 6r VCHR 13,0 6815748 /dev/../devices/pseudo/mm#0:mem
root#sx86:/u/gwz#
So, it seems lsof is not able to find the memory mapped files.

Related

deployment fails with Passenger over Nginx falsely 'apparently not running'

A deployment fails with the following message:
Phusion Passenger(R) doesn't seem to be running. If you are sure that it
is running, then the causes of this problem could be one of:
[...]
• You customized Nginx's passenger_instance_registry_dir option
• The instance directory has been removed by an operating system background service. Please set a different instance registry directory Phusion Passenger(R) Standalone's --instance-registry-dir command line argument.
[...]
DEBUG [25d4f5b4] *** Cleaning stale instance directory /tmp/passenger.7OMaC6P
Warning: Operation not permitted # rb_file_chown - /tmp/passenger.7OMaC6P/.
*** Cleaning stale instance directory /tmp/passenger.0bmUABH
Warning: Operation not permitted # rb_file_chown - /tmp/passenger.0bmUABH/.
*** Cleaning stale instance directory /tmp/passenger.n1oLEes
Warning: Operation not permitted # rb_file_chown - /tmp/passenger.n1oLEes/.
*** Cleaning stale instance directory /tmp/passenger.RXBYda3
Warning: Operation not permitted # rb_file_chown - /tmp/passenger.RXBYda3/.
*** Cleaning stale instance directory /tmp/passenger.TrAwTXq
Warning: Operation not permitted # rb_file_chown - /tmp/passenger.TrAwTXq/.
*** Cleaning stale instance directory /tmp/passenger.vZaExdN
Warning: Operation not permitted # rb_file_chown - /tmp/passenger.vZaExdN/.
*** Cleaning stale instance directory /tmp/passenger.dqTKpv1
Warning: Operation not permitted # rb_file_chown - /tmp/passenger.dqTKpv1/.
*** Cleaning stale instance directory /tmp/passenger.hh2TxgL
Warning: Operation not permitted # rb_file_chown - /tmp/passenger.hh2TxgL/.
*** Cleaning stale instance directory /tmp/passenger.rjowwmi
Warning: Operation not permitted # rb_file_chown - /tmp/passenger.rjowwmi/.
passenger-status runs. However two pids are shown
App root: /home/deploy/margin/current
Requests in queue: 0
* PID: 110639 Sessions: 0 Processed: 46 Uptime: 12h 29m 50s
CPU: 1% Memory : 409M Last used: 2m 50s
* PID: 141836 Sessions: 0 Processed: 0 Uptime: 2m 46s
CPU: 0% Memory : 17M Last used: 2m 46s ago
Installation occured via these commands:
sudo apt-get install -y nginx-extras libnginx-mod-http-passenger
if [ ! -f /etc/nginx/modules-enabled/50-mod-http-passenger.conf ]; then sudo ln -s /usr/share/nginx/modules-available/mod-http-passenger.load /etc/nginx/modules-enabled/50-mod-http-passenger.conf ; fi
sudo ls /etc/nginx/conf.d/mod-http-passenger.conf
the conf file has
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/deploy/.rbenv/shims/ruby;
While there is documentation on this matter, it does not cover a gap in understanding - and thus does not mitigate risk. Namely:
• rather, is not a question of all these stale instances which is gumming up the works? How to get rid of properly?
• uncertainty as to whether passenger standalone or nginx variant is running - how to verify?
• there is no recollection of ever touching passenger_instance_registry_dir
• if a system background service has been run to change the instance directory, how can one verify?
• what is good practice for eventually setting and instance directory?

ImportError when starting uwsgi application (flask)

I have an app using Python3 and Flask and wanted to deploy it on uwsgi and nginx using a virtualenv.
# Brieffenster
location /projekte/brieffenster {
include uwsgi_params;
uwsgi_pass unix:///tmp/brieffenster.sock;
}
and
[uwsgi]
plugin = python3
socket = /tmp/brieffenster.sock
chown-socket = www-data:www-data
chdir = /var/www/projekte/brieffenster
virtualenv = /var/www/projekte/brieffenster/.env
mount = /projekte/brieffenster=brieffenster.py
callable = app
manage-script-name = true
Running a HTTP GET on http://<SERVER_IP>/projekte/brieffenster/ returns 502 Bad Gateway.
When I launch it from the command line using
sudo uwsgi --ini /etc/uwsgi/apps-enabled/brieffenster.ini
there is a stacktrace (seen below). I have already debugged this for some hours and I think I'm doing everything right.
Is there something I'm missing?
$ sudo uwsgi --ini /etc/uwsgi/apps-enabled/brieffenster.ini
[uWSGI] getting INI configuration from /etc/uwsgi/apps-enabled/brieffenster.ini
*** Starting uWSGI 1.9.17.1-debian (64bit) on [Mon Aug 17 23:13:01 2015] ***
compiled with version: 4.8.2 on 23 March 2014 17:15:32
os: Linux-2.6.32-042stab094.7 #1 SMP Wed Oct 22 12:43:21 MSK 2014
nodename: bender
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /
detected binary path: /usr/bin/uwsgi-core
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 514091
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /tmp/brieffenster.sock fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.4.0 (default, Jun 19 2015, 14:24:19) [GCC 4.8.2]
Set PythonHome to /var/www/projekte/brieffenster/.env
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x106f720
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72792 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
mounting brieffenster.py on /projekte/brieffenster
Traceback (most recent call last):
File "/usr/lib/python3.4/pkgutil.py", line 481, in find_loader
spec = importlib.util.find_spec(fullname)
File "/var/www/projekte/brieffenster/.env/lib/python3.4/importlib/util.py", line 100, in find_spec
raise ValueError('{}.__spec__ is None'.format(name))
ValueError: uwsgi_file_brieffenster.__spec__ is None
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "brieffenster.py", line 28, in <module>
app = CustomFlask(__name__)
File "/var/www/projekte/brieffenster/.env/lib/python3.4/site-packages/flask/app.py", line 331, in __init__
instance_path = self.auto_find_instance_path()
File "/var/www/projekte/brieffenster/.env/lib/python3.4/site-packages/flask/app.py", line 622, in auto_find_instance_path
prefix, package_path = find_package(self.import_name)
File "/var/www/projekte/brieffenster/.env/lib/python3.4/site-packages/flask/helpers.py", line 661, in find_package
loader = pkgutil.get_loader(root_mod_name)
File "/usr/lib/python3.4/pkgutil.py", line 467, in get_loader
return find_loader(fullname)
File "/usr/lib/python3.4/pkgutil.py", line 487, in find_loader
raise ImportError(msg.format(fullname, type(ex), ex)) from ex
ImportError: Error while finding loader for 'uwsgi_file_brieffenster' (<class 'ValueError'>: uwsgi_file_brieffenster.__spec__ is None)
UPDATE 1: Here is the application I am using. It is just a catchall that tells me which path was requested.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import Flask
__author__ = 'Jonas Gröger <jonas.groeger#gmail.com>'
app = Flask(__name__)
app.config.from_object(__name__)
#app.route('/', defaults={'path': ''})
#app.route('/<path:path>')
def catch_all(path):
return 'You want path: %s' % path
if __name__ == '__main__':
app.run('0.0.0.0')
I am using mount and manage-script-name because I plan on putting more Flask projects in /projekte/<folder_name>.
This is a generic application- there seems to be no need for different mountpoints and a specialized setup. Here's my uWSGI setup adapted to your settings (fill in missing parameters in brackets). I think you're just missing the module parameter. master=true will get rid of the warning you're getting.
uWSGI ini file:
[uwsgi]
module = [your flask app filename from update 1, WITHOUT '.py']
callable = app
master = true
processes = 5
socket = /tmp/brieffenster.sock
enable-threads = true
uid = www-data
gid = www-data
vacuum = true
venv = /var/www/projekte/brieffenster/.env
die-on-term = true
See if this works; if not- post the error message for further guidance.

GCE - Can not create an instance image from the startup script

I am trying to create a GCE instance image from its startup script (just after some setup instructions). I use a command line looking like :
gcimagebundle -d "/dev/sda" -o "/tmp/" --log_file=/var/log/image_generation.log "--output_file_name=/tmp/myimage.tar.gz"
After few seconds the gcimagebundle exits and I get the following error message (from the /var/log/image_generation.log file) :
INFO:root:found platform Centos
INFO:root:File System: ext4
INFO:root:Disk Size: 10737418240 bytes
INFO:root:Resolved /dev/sda to /dev/sda
INFO:root:exclude list: (/etc/ssh/.host_key_regenerated, 0:0:0) (/dev, 0:1:0) (/proc, 0:1:0) (/run, 0:1:1) (/selinux, 0:0:0) (/tmp, 0:1:0) (/sys, 0:1:0) (/var/lib/google/per- instance, 0:1:0) (/var/lock, 0:1:1) (/var/log, 0:1:1) (/var/run, 0:1:1)
INFO:root:ignoring mounts /proc /sys /dev/pts /dev/shm /proc/sys/fs/binfmt_misc
WARNING:root:overwrite list =
INFO:root:Initializing disk file
INFO:root:Making filesystem
INFO:root:Copying contents
WARNING:root:Error while running ['rsync', '--times', '--perms', '--owner', '--group', '--links', '--devices', '--acls', '--sparse', '--hard-links', '--recursive', '--xattrs', '--exclude-from=/tmp/tmpXtECHY/tmp6Y_7Dr', '/', '/tmp/tmpXtECHY/tmpencYI_'] return_code = 11
stdout=
stderr=rsync: failed to open exclude file /tmp/tmpXtECHY/tmp6Y_7Dr: Permission denied (13)
rsync error: error in file IO (code 11) at exclude.c(1062) [client=3.0.6]
I tried to execute the same startup script on a fresh instance after a manual sudo su and all works.
I execute a whoami from the startup script and the result is root.

How do lbackup backup remote files with root previllege, and without root ssh login?

Well, I currently use lbackup to backup files on my remote server. So I logged in with my account, which is NOT root.
And I got below errors, obviously, my account is NOT www-data.
Any suggestions?
$ ls -l /var/www/cache |grep cache
drwx------ 13 www-data www-data 4096 Jul 28 06:27 cache
Sun Jul 28 23:53:17 CST 2013
Hard Links Enabled
Synchronizing...
Creating Links
rsync: opendir "/var/www/bbs/cache" failed: Permission denied (13)
IO error encountered -- skipping file deletion
rsync: opendir "/var/www/bbs/files" failed: Permission denied (13)
rsync: opendir "/var/www/bbs/store" failed: Permission denied (13)
rsync: send_files failed to open "/var/www/bbs/config.php": Permission denied (13)
Number of files: 10048
Number of files transferred: 1919
Total file size: 202516431 bytes
Total transferred file size: 16200288 bytes
Literal data: 16200288 bytes
Matched data: 0 bytes
File list size: 242097
File list generation time: 0.002 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 39231
Total bytes received: 5617302
sent 39231 bytes received 5617302 bytes 50731.24 bytes/sec
total size is 202516431 speedup is 35.80
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1536) [generator=3.0.9]
WARNING! : Data Transfer Interrupted
WARNING! : No mail configuration partner specified.
To specify a mail partner configuration file add the
following line into your backup configuration file :
mailconfigpartner=nameofyourmailpartner.conf
you have two possibilities:
a) ignore the files you cannot read (--exclude=PATTERN)
b) get read persmissions for these files, either by logging in as another user or by chmod-ing the files, whatever is appropriate

rsync faliure on iscsi disk

[root#localhost ~]# rsync -aHXA /mnt/capture-tmp/source/ /mnt/capture-tmp/dest
rsync: writefd_unbuffered failed to write 4092 bytes to socket [sender]: Broken pipe (32)
rsync: write failed on "/mnt/capture-tmp/dest/opt/StorageManager/jre/lib/i386/server/libjvm.so": Read-only file system (30)
rsync error: error in file IO (code 11) at receiver.c(302) [receiver=3.0.7]
rsync: connection unexpectedly closed (135188 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]
"dest" is iscsi disk.I am not able to reason out the cause for the faliure??
Thank you.
Seems obvious enough:
rsync: write failed on "[...snip...]/libjvm.so": Read-only file system (30)
^^^^^^^^^^^^^^^^^^^^^^^^^^
Remount it as read/write and try again.

Resources