You are not logged in.
hello,
to activate some luakit adblock script i followed the wiki https://wiki.archlinux.org/index.php/Luakit#Adblock.
when restarting luakit, there seems to be a problem with my entry in the rc.lua.
luakit
./adblock.lua:515: attempt to index local 'fh' (a nil value)
[ 1.064968] E: luakit: main:189: no windows spawned by rc file, exitingany advices? thanks!
Last edited by caravanlizzy (2014-06-02 17:59:41)
Offline
Did you put
require adblock
require adblock_chromeinside the section labeled 'Optional user script loading', or did you put them at the beginning?
Offline
yeah i put it into userscripts, and apart from that i tried every possible place ![]()
Offline
The variable 'fh' that the error says is nil is a file descriptor returned when opening ~/.local/share/luakit/adblock/subscriptions . Could you check whether that file exists and whether you have write permissions on it? And also whether the directory ~/.local/share/luakit/adblock exists?
Offline
well, the folder ~/.local/share/luakit/adblock exists, as i created it myself, but the only file in it is the easylist.txt, which i downloaded from the arch wiki. it is the list of things to block, as far as i understand that. i changed permission to rwx, doesnt change anything. im not sure what you mean with subscriptions, but there is no file named like that!?
btw, when starting it as superuser, the browser can start normally, but i dont have access to my bookmarks, history and adblock commands.
Last edited by caravanlizzy (2014-06-02 07:26:24)
Offline
Well when run by root, luakit would try to read the configuration files in /root/.config/luakit and then /etc/luakit when it wouldn't find them, so you wouldn't have adblock, and similarly for the history and bookmarks.
Does this throw an error (replace 'yourusername' with your user name)
echo 'print(io.open("/home/yourusername/.local/share/luakit/adblock/subscriptions", "w"))' | luaYou mentioned the bookmarks and history do work, right? And there are files called history.db and bookmarks.db in ~/.local/share/luakit/ right?
Could you post your rc.lua?
Offline
the output of your code (would be nice if you explain its meaning, i guess its to check subscriptions, but i dont know what they are!?)is:
echo 'print(io.open("/home/lizzy/.local/share/luakit/adblock/subscriptions", "w"))' | lua
nil /home/lizzy/.local/share/luakit/adblock/subscriptions: Permission denied13my rc.lua looks follows:
-----------------------------------------------------------------------
-- luakit configuration file, more information at http://luakit.org/ --
-----------------------------------------------------------------------
require "lfs"
if unique then
unique.new("org.luakit")
-- Check for a running luakit instance
if unique.is_running() then
if uris[1] then
for _, uri in ipairs(uris) do
if lfs.attributes(uri) then uri = os.abspath(uri) end
unique.send_message("tabopen " .. uri)
end
else
unique.send_message("winopen")
end
luakit.quit()
end
end
-- Load library of useful functions for luakit
require "lousy"
-- Small util functions to print output (info prints only when luakit.verbose is true)
function warn(...) io.stderr:write(string.format(...) .. "\n") end
function info(...) if luakit.verbose then io.stdout:write(string.format(...) .. "\n") end end
-- Load users global config
-- ("$XDG_CONFIG_HOME/luakit/globals.lua" or "/etc/xdg/luakit/globals.lua")
require "globals"
-- Load users theme
-- ("$XDG_CONFIG_HOME/luakit/theme.lua" or "/etc/xdg/luakit/theme.lua")
lousy.theme.init(lousy.util.find_config("theme.lua"))
theme = assert(lousy.theme.get(), "failed to load theme")
-- Load users window class
-- ("$XDG_CONFIG_HOME/luakit/window.lua" or "/etc/xdg/luakit/window.lua")
require "window"
-- Load users webview class
-- ("$XDG_CONFIG_HOME/luakit/webview.lua" or "/etc/xdg/luakit/webview.lua")
require "webview"
-- Load users mode configuration
-- ("$XDG_CONFIG_HOME/luakit/modes.lua" or "/etc/xdg/luakit/modes.lua")
require "modes"
-- Load users keybindings
-- ("$XDG_CONFIG_HOME/luakit/binds.lua" or "/etc/xdg/luakit/binds.lua")
require "binds"
----------------------------------
-- Optional user script loading --
----------------------------------
require "adblock"
require "adblock_chrome"
require "webinspector"
-- Add sqlite3 cookiejar
require "cookies"
-- Cookie blocking by domain (extends cookies module)
-- Add domains to the whitelist at "$XDG_CONFIG_HOME/luakit/cookie.whitelist"
-- and blacklist at "$XDG_CONFIG_HOME/luakit/cookie.blacklist".
-- Each domain must be on it's own line and you may use "*" as a
-- wildcard character (I.e. "*google.com")
--require "cookie_blocking"
-- Block all cookies by default (unless whitelisted)
--cookies.default_allow = false
-- Add uzbl-like form filling
require "formfiller"
-- Add proxy support & manager
require "proxy"
-- Add quickmarks support & manager
require "quickmarks"
-- Add session saving/loading support
require "session"
-- Add command to list closed tabs & bind to open closed tabs
require "undoclose"
-- Add command to list tab history items
require "tabhistory"
-- Add greasemonkey-like javascript userscript support
require "userscripts"
-- Add bookmarks support
require "bookmarks"
require "bookmarks_chrome"
-- Add download support
require "downloads"
require "downloads_chrome"
-- Example using xdg-open for opening downloads / showing download folders
--downloads.add_signal("open-file", function (file, mime)
-- luakit.spawn(string.format("xdg-open %q", file))
-- return true
--end)
-- Add vimperator-like link hinting & following
require "follow"
-- Use a custom charater set for hint labels
--local s = follow.label_styles
--follow.label_maker = s.sort(s.reverse(s.charset("asdfqwerzxcv")))
-- Match only hint labels
--follow.pattern_maker = follow.pattern_styles.match_label
-- Add command history
require "cmdhist"
-- Add search mode & binds
require "search"
-- Add ordering of new tabs
require "taborder"
-- Save web history
require "history"
require "history_chrome"
require "introspector"
-- Add command completion
require "completion"
-- NoScript plugin, toggle scripts and or plugins on a per-domain basis.
-- `,ts` to toggle scripts, `,tp` to toggle plugins, `,tr` to reset.
-- Remove all "enable_scripts" & "enable_plugins" lines from your
-- domain_props table (in config/globals.lua) as this module will conflict.
--require "noscript"
require "follow_selected"
require "go_input"
require "go_next_prev"
require "go_up"
-----------------------------
-- End user script loading --
-----------------------------
-- Restore last saved session
local w = (session and session.restore())
if w then
for i, uri in ipairs(uris) do
w:new_tab(uri, i == 1)
end
else
-- Or open new window
window.new(uris)
end
-------------------------------------------
-- Open URIs from other luakit instances --
-------------------------------------------
if unique then
unique.add_signal("message", function (msg, screen)
local cmd, arg = string.match(msg, "^(%S+)%s*(.*)")
local w = lousy.util.table.values(window.bywidget)[1]
if cmd == "tabopen" then
w:new_tab(arg)
elseif cmd == "winopen" then
w = window.new((arg ~= "") and { arg } or {})
end
w.win.screen = screen
w.win.urgency_hint = true
end)
end
-- vim: et:sw=4:ts=8:sts=4:tw=80thanks for helping me!
Offline
what's the output of
ls -l $HOME/.local/share/luakit/*Last edited by HiImTye (2014-06-02 14:36:11)
Offline
the output is:
ls -l $HOME/.local/share/luakit/*
-rw-r--r-- 1 lizzy users 2048 Jun 2 09:42 /home/lizzy/.local/share/luakit/bookmarks.db
-rw-r--r-- 1 lizzy users 68608 Jun 2 09:43 /home/lizzy/.local/share/luakit/cookies.db
---------- 1 root root 1356930 Jun 2 09:46 /home/lizzy/.local/share/luakit/easylist.txt
-rw-r--r-- 1 lizzy users 23552 Jun 2 09:43 /home/lizzy/.local/share/luakit/history.db
/home/lizzy/.local/share/luakit/adblock:
total 1328
---------- 1 lizzy users 1356930 Mai 30 13:10 easylist.txtLast edited by caravanlizzy (2014-06-02 15:03:14)
Offline
---------- 1 lizzy users 1356930 Mai 30 13:10 easylist.txtthere's your problem
Last edited by HiImTye (2014-06-02 15:11:43)
Offline
no thats not the prob...i deleted the list now, so my new output is:
ls -l $HOME/.local/share/luakit/*
-rw-r--r-- 1 lizzy users 2048 Jun 2 09:42 /home/lizzy/.local/share/luakit/bookmarks.db
-rw-r--r-- 1 lizzy users 68608 Jun 2 09:43 /home/lizzy/.local/share/luakit/cookies.db
-rw-r--r-- 1 lizzy users 23552 Jun 2 09:43 /home/lizzy/.local/share/luakit/history.db
/home/lizzy/.local/share/luakit/adblock:
total 1328
-rw-r--r-- 1 lizzy users 1355845 Jun 2 17:28 easylist.txtLast edited by caravanlizzy (2014-06-02 15:30:02)
Offline
ah maybe ur right. i now changed the permissions in the easylist.txt file and moved it to the ~/.local/share/luakit folder (instead of ~/.local/share/luakit/adblock). now everything works well and i can use the adblock commands. BUT to activate adblock, i need to run in Normal mode, which means that my easylist.txt file has to be located in ~/.local/share/luakit/adblock. moving it back, same problem occurs.
Last edited by caravanlizzy (2014-06-02 15:57:53)
Offline
the output of your code (would be nice if you explain its meaning, i guess its to check subscriptions, but i dont know what they are!?)is:
echo 'print(io.open("/home/lizzy/.local/share/luakit/adblock/subscriptions", "w"))' | lua nil /home/lizzy/.local/share/luakit/adblock/subscriptions: Permission denied13
The command just tries to open the file ~/.local/share/luakit/adblock/subscriptions for writing. When loading adblock.lua, luakit tries to do exactly that (the subscriptions file contains a list of blacklists, like 'easylist.txt'). The fact that the command returns a 'permissions denied' error means that the problem is that you don't have the permissions to create the file ~/.local/share/luakit/adblock/subscriptions, which makes luakit crash.
To fix that, run
chmod u+rwx ~/.local/share/luakit/adblock
chmod go+rx ~/.local/share/luakit/adblock
chmod u+rw ~/.local/share/luakit/adblock/*
chmod go+r ~/.local/share/luakit/adblock/*which will give your user read/write/execute perissions on the adblock directory and read/write permissions on all of the files it contains, and your group and others permissions to read/execute (execute permissions on a directory are permissions to open the directory) the directory and read the files inside.
Last edited by \hbar (2014-06-02 17:20:45)
Offline
i did what you said, but nothing changed. the output of
echo 'print(io.open("/home/lizzy/.local/share/luakit/adblock/subscriptions", "w"))' | lua is still the same...maybe i should just get along without that adblock ![]()
Offline
Okay, what's the output of
ls -l ~/.local/share/luakit/and of
touch ~/.local/share/luakit/adblock/subscriptionsOffline
first:
ls -l ~/.local/share/luakit/
total 108
drwxr-xr-x 2 root root 4096 Jun 2 17:50 adblock
-rw-r--r-- 1 lizzy users 2048 Jun 2 09:42 bookmarks.db
-rw-r--r-- 1 lizzy users 68608 Jun 2 17:37 cookies.db
-rw-r--r-- 1 lizzy users 23552 Jun 2 17:47 history.dband second:
touch ~/.local/share/luakit/adblock/subscriptions
touch: cannot touch ‘/home/lizzy/.local/share/luakit/adblock/subscriptions’: Keine Berechtigungwhich is german and means that i dont have permission. as superuser it works but there is no output.
Offline
Okay
sudo chown -R lizzy:users ~/.local/share/luakit/adblockThat should give you all the Berechtigung you need.
edit: I added '-R' which is important.
Last edited by \hbar (2014-06-02 17:45:44)
Offline
yeah, finally! so the chown -R let the user lizzy operate on the folder adblock? why is it blocked by default?
anyway, thanks a lot!
lizzy
Offline
chown changes the owner of files and directories, 'chown -R' changes the owner of directories and the files they contain. You may want to have a look at https://en.wikipedia.org/wiki/File_system_permissions .
My guess is that you created the adblock directory as root (using sudo), which would explain why root owned it instead of lizzy.
Offline
yes i guess thats what i did! thanks again!
Offline