problems after upgrade from 1.13.1 to 2.6.2 - wagtail

I've upgraded my site from Django 1.11.10 / Wagtail 1.13.1 to Django 2.2.6 / Wagtail 2.6.2
All seems fine except:
1) I can't add a page under home
2) Can't move pages, I get AttributeError: 'NoneType' object has no attribute 'allowed_subpage_models'
Have I missed a setting somewhere?
Full trace for move error:
[Thu May 21 12:36:21.797605 2020] [wsgi:error] [pid 1026] Internal Server Error: /internal/portal/admin/pages/520/move/
[Thu May 21 12:36:21.797660 2020] [wsgi:error] [pid 1026] Traceback (most recent call last):
[Thu May 21 12:36:21.797666 2020] [wsgi:error] [pid 1026] File "/var/www/portal_django-upgrade/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
[Thu May 21 12:36:21.797671 2020] [wsgi:error] [pid 1026] response = get_response(request)
[Thu May 21 12:36:21.797674 2020] [wsgi:error] [pid 1026] File "/var/www/portal_django-upgrade/lib/python3.5/site-packages/django/core/handlers/base.py", line 115, in _get_response
[Thu May 21 12:36:21.797678 2020] [wsgi:error] [pid 1026] response = self.process_exception_by_middleware(e, request)
[Thu May 21 12:36:21.797682 2020] [wsgi:error] [pid 1026] File "/var/www/portal_django-upgrade/lib/python3.5/site-packages/django/core/handlers/base.py", line 113, in _get_response
[Thu May 21 12:36:21.797687 2020] [wsgi:error] [pid 1026] response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Thu May 21 12:36:21.797691 2020] [wsgi:error] [pid 1026] File "/var/www/portal_django-upgrade/lib/python3.5/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
[Thu May 21 12:36:21.797695 2020] [wsgi:error] [pid 1026] response = view_func(request, *args, **kwargs)
[Thu May 21 12:36:21.797699 2020] [wsgi:error] [pid 1026] File "/var/www/portal_django-upgrade/lib/python3.5/site-packages/wagtail/admin/urls/__init__.py", line 102, in wrapper
[Thu May 21 12:36:21.797713 2020] [wsgi:error] [pid 1026] return view_func(request, *args, **kwargs)
[Thu May 21 12:36:21.797717 2020] [wsgi:error] [pid 1026] File "/var/www/portal_django-upgrade/lib/python3.5/site-packages/wagtail/admin/decorators.py", line 34, in decorated_view
[Thu May 21 12:36:21.797721 2020] [wsgi:error] [pid 1026] return view_func(request, *args, **kwargs)
[Thu May 21 12:36:21.797724 2020] [wsgi:error] [pid 1026] File "/var/www/portal_django-upgrade/lib/python3.5/site-packages/wagtail/admin/views/pages.py", line 739, in move_choose_destination
[Thu May 21 12:36:21.797728 2020] [wsgi:error] [pid 1026] target.can_choose = page_perms.can_move_to(target)
[Thu May 21 12:36:21.797732 2020] [wsgi:error] [pid 1026] File "/var/www/portal_django-upgrade/lib/python3.5/site-packages/wagtail/core/models.py", line 1904, in can_move_to
[Thu May 21 12:36:21.797735 2020] [wsgi:error] [pid 1026] if not self.page.specific.can_move_to(destination):
[Thu May 21 12:36:21.797739 2020] [wsgi:error] [pid 1026] File "/var/www/portal_django-upgrade/lib/python3.5/site-packages/wagtail/core/models.py", line 996, in can_move_to
[Thu May 21 12:36:21.797742 2020] [wsgi:error] [pid 1026] return self.can_exist_under(parent)
[Thu May 21 12:36:21.797746 2020] [wsgi:error] [pid 1026] File "/var/www/portal_django-upgrade/lib/python3.5/site-packages/wagtail/core/models.py", line 973, in can_exist_under
[Thu May 21 12:36:21.797749 2020] [wsgi:error] [pid 1026] return cls in parent.specific_class.allowed_subpage_models()
[Thu May 21 12:36:21.797754 2020] [wsgi:error] [pid 1026] AttributeError: 'NoneType' object has no attribute 'allowed_subpage_models'
[Thu May 21 12:36:21.797762 2020] [wsgi:error] [pid 1026]

Turns out the "home" page hadn't migrated correctly (at all?). Created a new root page, moved "home" under it. Then was able to move all the sub pages from "home" to the new root.

Related

Redis server throwing a Background serving error

it is showing like this in redis server after 20 to 30 mins. the first 20 to 30 mins it is working fine only but after that it is throwing this error.so please help me to solve thisyou can see the image in here
[2476] 24 Jun 19:06:21.293 # Background saving error
[2476] 24 Jun 19:06:27.016 * 1 changes in 3600 seconds. Saving...
[2476] 24 Jun 19:06:27.025 * Background saving started by pid 9044
[9044] 24 Jun 19:06:27.147 # Failed opening .rdb for saving: Permission denied
[9044] 24 Jun 19:06:27.148 # rdbSave failed in qfork: Permission denied
[2476] 24 Jun 19:06:27.230 # fork operation complete
[2476] 24 Jun 19:06:27.231 # Background saving error
[2476] 24 Jun 19:06:33.060 * 1 changes in 3600 seconds. Saving...
[2476] 24 Jun 19:06:33.063 * Background saving started by pid 11396
[11396] 24 Jun 19:06:33.192 # Failed opening .rdb for saving: Permission denied
[11396] 24 Jun 19:06:33.193 # rdbSave failed in qfork: Permission denied
[2476] 24 Jun 19:06:33.264 # fork operation complete
[2476] 24 Jun 19:06:33.265 # Background saving error
[2476] 24 Jun 19:06:39.034 * 1 changes in 3600 seconds. Saving...
[2476] 24 Jun 19:06:39.043 * Background saving started by pid 10516
[10516] 24 Jun 19:06:39.183 # Failed opening .rdb for saving: Permission denied
[10516] 24 Jun 19:06:39.185 # rdbSave failed in qfork: Permission denied
[2476] 24 Jun 19:06:39.245 # fork operation complete
[2476] 24 Jun 19:06:39.246 # Background saving error
[2476] 24 Jun 19:06:45.073 * 1 changes in 3600 seconds. Saving...
[2476] 24 Jun 19:06:45.083 * Background saving started by pid 1704
[1704] 24 Jun 19:06:45.219 # Failed opening .rdb for saving: Permission denied
[1704] 24 Jun 19:06:45.221 # rdbSave failed in qfork: Permission denied
[2476] 24 Jun 19:06:45.289 # fork operation complete
[2476] 24 Jun 19:06:45.290 # Background saving error
[2476] 24 Jun 19:06:51.018 * 1 changes in 3600 seconds. Saving...
[2476] 24 Jun 19:06:51.027 * Background saving started by pid 13012
[13012] 24 Jun 19:06:51.150 # Failed opening .rdb for saving: Permission denied
[13012] 24 Jun 19:06:51.152 # rdbSave failed in qfork: Permission denied
[2476] 24 Jun 19:06:51.230 # fork operation complete
[2476] 24 Jun 19:06:51.232 # Background saving error
[2476] 24 Jun 19:06:57.049 * 1 changes in 3600 seconds. Saving...
[2476] 24 Jun 19:06:57.053 * Background saving started by pid 1272
[1272] 24 Jun 19:06:57.177 # Failed opening .rdb for saving: Permission denied
[1272] 24 Jun 19:06:57.178 # rdbSave failed in qfork: Permission denied
[2476] 24 Jun 19:06:57.253 # fork operation complete
[2476] 24 Jun 19:06:57.255 # Background saving error
[2476] 24 Jun 19:07:03.066 * 1 changes in 3600 seconds. Saving...
[2476] 24 Jun 19:07:03.075 * Background saving started by pid 13052
[13052] 24 Jun 19:07:03.208 # Failed opening .rdb for saving: Permission denied
[13052] 24 Jun 19:07:03.210 # rdbSave failed in qfork: Permission denied
[2476] 24 Jun 19:07:03.278 # fork operation complete
This looks like the redis-server process does not have permission to open the .rdb file. Just run redis-server as an administrator on windows, it might solve your problem.

How to implement runas in Linux?

I’ve tried fork, setresgid, setresuid and execvpe — doesn’t work.
Specifically, no errors are returned anywhere, the child process starts OK, I have confirmed all 6 magic numbers returned by getresuid and getresgid match, yet the child process doesn’t have the required permissions.
The files in question are in the /dev/input/ folder. Here’s the permissions:
drwxr-xr-x 3 root root 180 Sep 23 19:47 .
drwxr-xr-x 17 root root 4120 Sep 23 19:47 ..
drwxr-xr-x 2 root root 160 Sep 23 19:47 by-path
crw-rw---- 1 root input 13, 64 Sep 23 19:47 event0
crw-rw---- 1 root input 13, 65 Sep 23 19:47 event1
crw-rw---- 1 root input 13, 66 Sep 23 19:47 event2
crw-rw---- 1 root input 13, 67 Sep 23 19:47 event3
crw-rw---- 1 root input 13, 68 Sep 23 19:47 event4
crw-rw---- 1 root input 13, 69 Sep 23 19:47 event5
The user is a member of the input group, that’s why under normal circumstances it can access these files. However, the process launched with fork/setresgid/setresuid/execvpe can’t access these files.
Here’s relevant lines from the strace log, the log was made with -ff option i.e. only includes a single process:
setresgid(10000, 10000, 10000) = 0
setresuid(10000, 10000, 10000) = 0
execve("/usr/local/bin/dotnet", ["/usr/local/bin/dotnet", "/home/user/launcher/Debug/Desktop.dll"], 0xffffea463f50 /* 1 var */) = 0
.. much later
openat(AT_FDCWD, "/dev/input/event0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 EACCES (Permission denied)
The problem was indeed extra groups. Contrary to my expectation, setresuid does not refresh the list of additional groups.
To set them up, the launcher process first needs to call getgrouplist to query the list of additional groups for the target user, then after the fork call setgroups to apply these values.
The complete sequence of kernel calls to implement a Linux equivalent of CreateProcessAsUser is following:
getgrouplist, fork, chdir, setresgid, setgroups, setresuid, execvpe
Note how setresuid needs to be the very last step before the execvpe. The reason for that, after that call the forked process no longer has permissions to modify these security-related things.
P.S. I wonder how many security bugs in Linux software were caused by the developers forgetting to update that list of extra groups when switching user accounts in their programs?

Abort BGSAVE Already in process

I started saving redis-db snapshot by calling BGSAVE command in redis-cli.
It has started running but I keep getting these errors in the logs
[30853] 27 Jan 07:18:41.129 # Background saving error
[30853] 27 Jan 07:18:47.043 * 1 changes in 900 seconds. Saving...
[30853] 27 Jan 07:18:47.058 * Background saving started by pid 13204
[13204] 27 Jan 07:18:47.058 # Failed opening .rdb for saving: Permission denied
[30853] 27 Jan 07:18:47.158 # Background saving error
[30853] 27 Jan 07:18:53.070 * 1 changes in 900 seconds. Saving...
[30853] 27 Jan 07:18:53.085 * Background saving started by pid 13207
[13207] 27 Jan 07:18:53.085 # Failed opening .rdb for saving: Permission denied
[30853] 27 Jan 07:18:53.186 # Background saving error
[30853] 27 Jan 07:18:59.098 * 1 changes in 900 seconds. Saving...
[30853] 27 Jan 07:18:59.113 * Background saving started by pid 13210
[13210] 27 Jan 07:18:59.114 # Failed opening .rdb for saving: Permission denied
[30853] 27 Jan 07:18:59.213 # Background saving error
looks like the redis BGSAVE command is running indefinitely. How to stop this.
Also I tried checking for process pid by ps -aux| grep redis command.
13196 pts/11 S+ 0:00 grep --color=auto redis
30853 ? Ssl 1292:57 /usr/bin/redis-server *:6379
There is no process to kill.
EDIT: These are the permissions to redis folder and dump.rdb file
f: /var/lib/redis
drwxr-xr-x root root /
drwxr-xr-x root root var
drwxr-xr-x root root lib
drwxr-xr-x redis redis redis
f: /var/lib/redis/dump.rdb
drwxr-xr-x root root /
drwxr-xr-x root root var
drwxr-xr-x root root lib
drwxr-xr-x redis redis redis
-rw-rw-rw- redis redis dump.rdb
EDIT2: Got the answer. The problem was somehow the config parameters are changed. The dbfilename and dir values are changed.
Set these values to original through CONFIG SET command and now its working fine. Adding in-case somebody has same problem.
But the question is how did they change. Did this happen to anybody else?
Help me
Thanks
You can either try and fix the file permissions error (does the default save location exist and does redis have permission to write to it?) or you can disable saving with:
config set save ""

Failed to open file: Permission denied?

I am running logstash-1.4.1 on Ubuntu and get the following error:
failed to open /home/Desktop/Input/2014-10-02/abc.log: Permission denied - /home/Desktop/Input/2014-10-02/abc.log {:level=>:warn, :file=>"filewatch/tail.rb", :line=>"107"}
Background:
I copied the directory structure of logs from a remote server to my local machine. Now, on running logstash on my local machine on the directory structure I copied, this error occurs.
When I check permissions on the file, it's showing both read write.
Any idea?
As I now checked the logstash console, it's evident that logstash is opening some files and after that permission denied starts coming till end.
CONSOLE:
_open_file: /home/Desktop/Input/2014-10-11/abc.log: opening {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"98"}
/home/Desktop/Input/2014-10-11/abc.log: initial create, no sincedb, **seeking to beginning** of file {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"133"}
_open_file: /home/Desktop/Input/2014-10-21/abc.log: opening {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"98"}
/home/Desktop/Input/2014-10-21/abc.log: initial create, no sincedb, **seeking to beginning** of file {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"133"}
_open_file: /home/Desktop/Input/2014-11-04/abc.log: opening {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"98"}
failed to open /home/Desktop/Input/2014-11-04/abc.log: **Permission denied** - /home/Desktop/Input/2014-11-04/abc.log {:level=>:warn, :file=>"filewatch/tail.rb", :line=>"107"}
_open_file: /home/Desktop/Input/2014-10-10/abc.log: opening {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"98"}
failed to open /home/Desktop/Input/2014-10-10/abc.log: **Permission denied** - /home/Desktop/Input/2014-10-10/abc.log {:level=>:warn, :file=>"filewatch/tail.rb", :line=>"107"}
Is it because of some limit might be there to number of files opened, as logstash is opening files till a limit and after that gives permission denied errors??
My file permissions for files it gives permission denied error:
ls -l ./Input/2014-11-04/abc.log
-rw-rw-r-- 1 userA userA 0 Nov 12 09:56 ./Input/2014-11-04/abc.log
ls -ld ./Input/2014-11-04
drwxrwxr-x 3 userA userA 4096 Nov 12 09:56 ./Input/2014-11-04
ls -l /home/Desktop/Input/2014-10-10/abc.log
-rw-rw-r-- 1 userA userA 0 Nov 12 09:56 /home/userA/Desktop/Input/2014-10-10/abc.log
ls -ld /home/Desktop/Input/2014-10-10
drwxrwxr-x 2 userA userA 4096 Nov 12 09:56 /home/Desktop/Input/2014-10-10
EDIT:
Logstash is run using userA.
Detailed File Permissions:
ls -ld /home/
drwxr-xr-x 3 root root 4096 Aug 27 2013 /home/
ls -ld /home/Desktop/
drwxr-xr-x 7 userA userA 4096 Nov 12 12:45 /home/Desktop/
ls -ld /home/Desktop/Input/
drwxrwxr-x 47 userA userA 4096 Nov 12 10:50 /home/Desktop/Input/
ls -l /home/Desktop/Input/abc.log
-rw-rw-r-- 1 userA userA 0 Nov 12 09:56 /home/Desktop/Input/abc.log

Browser or Apache2 does not see files: "server software is running but no content has been added"

after opening http 127.0.0.1 in the browser it displays info:
It works! This is the default web page for this server. The web server
software is running but no content has been added, yet.
The point is I have added files to the DocumentRoot catalog
Things i changed:
/etc/apache2/envvars
from
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
to
export APACHE_RUN_USER=chiny
export APACHE_RUN_GROUP=chiny
file /etc/apache2/sites-enabled/000-default.conf looks:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/chiny/Pulpit/lab
<Directory /home/chiny/Pulpit/lab/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
Allow from all
</Directory>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
my DocumentRoot where i have my html files
root#chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny/Pulpit/lab# ls -l /home/chiny/Pulpit/lab
razem 60
-rwxrwxr-x 1 chiny chiny 3096 sty 18 2013 10.html
-rwxrwxr-x 1 chiny chiny 2562 sty 18 2013 11.html
-rwxrwxr-x 1 chiny chiny 3010 sty 18 2013 12.html
-rwxrwxr-x 1 chiny chiny 3045 sty 18 2013 1.html
-rwxrwxr-x 1 chiny chiny 3016 sty 18 2013 2.html
-rwxrwxr-x 1 chiny chiny 2772 sty 18 2013 3.html
-rwxrwxr-x 1 chiny chiny 2814 sty 18 2013 4.html
-rwxrwxr-x 1 chiny chiny 2638 sty 18 2013 5.html
-rwxrwxr-x 1 chiny chiny 2794 sty 18 2013 6.html
-rwxrwxr-x 1 chiny chiny 2722 sty 18 2013 7.html
-rwxrwxr-x 1 chiny chiny 2591 sty 18 2013 8.html
-rwxrwxr-x 1 chiny chiny 2620 sty 18 2013 9.html
-rw-r--r-- 1 chiny chiny 177 sty 18 18:37 index.html
-rwxrwxr-x 1 chiny chiny 0 sty 18 14:43 plik
-rwxrwxr-x 1 chiny chiny 1711 sty 17 2013 styles.css
-rwxrwxr-x 1 chiny chiny 3181 sty 17 2013 w3schoolslogo.gif
also /home/chiny/Pulpit/lab is owned and group by chiny
drwxrwsr-x 2 chiny chiny 4096 sty 18 18:37 lab
nothing changed in apache2.conf
after restarting apache this info:
root#chiny-HP-Compaq-dc7100-CMT-DX438AV:/home/chiny/Pulpit# /etc/init.d/apache2 restart
* Restarting web server apache2 AH00557: apache2: apr_sockaddr_info_get() failed for chiny-HP-Compaq-dc7100-CMT-DX438AV
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
it appeared that index.html was a orginal file from var/www that i copied to my documentroot. and content of this file is exactly this message:"It works! This is the default web page for this server. The web server software is running but no content has been added, yet."

Resources