-
pkexec got No session for cookie error
Written by Super User
一直都在UBUNTU下使用 AwesomeWM 當我的主 WM,直到上次更新到 20.04 後,就發現 pkexec 不能正常的授權,會出現以下錯誤
error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
經過一陣搜尋後發現 這篇 裡的解法是執行
/usr/lib/x86_64-linux-gnu/polkit-mate/polkit-mate-authentication-agent-1
就可以正常運作,所以我把這程序放在autostart裡開機自動執行之後就都可以正常使用 pkexec 了
-
Atom 的 git-control 外掛跳錯
Written by Super User
新裝的 ATOM 因習慣裝了 git-control 這外掛,結果一直跳錯
Uncaught TypeError: Cannot read property 'split' of undefined
照 這篇 修改,結果又出現下面的錯誤
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined at validateString (internal/validators.js:112:11)
最後看到 這篇 才正確,最終修正是在下面幾個位置把 .path 都改成 .getPath()
git-control/lib/git-control-view.coffee:76
git-control/lib/dialogs/project-dialog.coffee:33
git-control/lib/dialogs/project-dialog.coffee:46
-
awn-applet-weather Network error in Weather:Could not retrieve weather data. You may be experiencing connectivity issues.
Written by 熊爸
最近因為我原來使用的LINUXMINT被我玩壞了,卡在很奇怪的相依性問題,無解中。為了方便工作,我重裝了我的工作電腦,改裝Zorin OS,一套以Linux初心者為目標的系統,裝完後玩了一下,還滿好用的,真的滿適合WINDOWS轉職LINUX的初心者使用。 但是在裝awn-applet-weather時我遇到了解析資料的錯誤:Network error in Weather:Could not retrieve weather data. You may be experiencing connectivity issues. 感覺應該是連到主機時遇到了錯誤,進到 /usr/share/avant-window-navigator/applets/weather/weather.py 看CODE發現它是連到weather.com網站去抓資料的,直覺應該是抓不到該網站的API吧,經過GOOGLE搜尋後發現這篇 "Change to Weather.com XML feed" 有寫到該網站有變更他們XML資料的提供網址,只要把
http://xml.weather.com/weather/local/
換成
http://wxdata.weather.com/wxdata/weather/local/
就可以正常運作了,下面是一個小小的PATCH,可以直接FIX
--- /usr/share/avant-window-navigator/applets/weather/weather.py 2016-06-28 11:15:30.737170878 +0800 +++ /usr/share/avant-window-navigator/applets/weather/weather.py 2016-06-28 11:36:39.225050118 +0800 @@ -647,7 +647,7 @@ @with_overlays @network_exception def get_conditions(self, location_code): - url = "http://xml.weather.com/weather/local/" + location_code + "?cc=*" + self.__ws_key + url = "http://wxdata.weather.com/wxdata/weather/local/" + location_code + "?cc=*" + self.__ws_key with closing(urllib2.urlopen(url)) as usock: with unlink_xml(usock) as xmldoc: names = ['CITY', 'SUNRISE', 'SUNSET', 'DESCRIPTION', 'CODE', 'TEMP', 'FEELSLIKE', 'BAR', 'BARDESC', 'WINDSPEED', 'WINDGUST', 'WINDDIR', 'HUMIDITY', 'MOONPHASE'] @@ -679,7 +679,7 @@ @with_overlays @network_exception def get_forecast(self, location_code): - url = "http://xml.weather.com/weather/local/" + location_code + "?dayf=5" + self.__ws_key + url = "http://wxdata.weather.com/wxdata/weather/local/" + location_code + "?dayf=5" + self.__ws_key with closing(urllib2.urlopen(url)) as usock: with unlink_xml(usock) as xmldoc: try:
-
install ansible and jupyter in alpine linux
Written by 熊爸
為了方便在公司利用ANSIBLE操作佈置步驟,在參加今年SA群英會後,參考MAX大的建議,建了一個Alpine Linux 的 VM ,並在VM內裝了Jupyter及Ansible,利用了下面的SCRIPT,當然,下面的SCRIPT也是參考了其他大師的智慧改寫的,主要是改寫自 eipdev/alpine-jupyter-notebook 的Dockerfile 中在Alpine linux安裝Jupyter的步驟,加上了安裝Ansible的程序上去的,預設將Ansible的script放在/opt/notebook/下就可以在啟動Jyuoyter時從頁面讀到了,當然,必需另外編寫ipynb檔案才能用Jupyter來執行。
install_ansible_n_jupyter.sh
#!/bin/sh echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories apk update && apk upgrade apk add --no-cache tini python3 libstdc++ openblas@testing freetype wget ca-certificates openssl openssh-client sshpass apk --update add --virtual build-dependencies python-dev libffi-dev openssl-dev build-base python3 -m ensurepip && rm -r /usr/lib/python*/ensurepip pip3 install --upgrade pip setuptools apk add --no-cache --virtual .build-deps@testing python3-dev make cmake clang clang-dev g++ linux-headers libtbb@testing libtbb-dev@testing openblas-dev@testing freetype-dev export CC=/usr/bin/clang CXX=/usr/bin/clang++ ln -s /usr/include/locale.h /usr/include/xlocale.h mkdir -p /opt/tmp && cd /opt/tmp pip download -d /opt/tmp numpy unzip -q numpy*.zip cd numpy* && echo "Building numpy..." echo -e "[ALL]\nlibrary_dirs = /usr/lib\ninclude_dirs = /usr/include\n[atlas]\natlas_libs = openblas\nlibraries = openblas\n[openblas]\nlibraries = openblas\nlibrary_dirs = /usr/lib\ninclude_dirs = /usr/include\n" > site.cfg python3 setup.py build -j 4 install &> /dev/null && echo "Successfully installed numpy" cd /opt/tmp echo "Downloading opencv" && wget --quiet https://github.com/Itseez/opencv/archive/3.1.0.zip unzip -q 3.1.0.zip cd opencv* mkdir build && cd build && echo "Building opencv..." cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr \ -D INSTALL_C_EXAMPLES=OFF \ -D INSTALL_PYTHON_EXAMPLES=OFF \ -D WITH_FFMPEG=NO \ -D WITH_IPP=NO \ -D WITH_OPENEXR=NO \ -D WITH_WEBP=NO \ -D WITH_TIFF=NO \ -D WITH_JASPER=NO \ -D BUILD_EXAMPLES=OFF \ -D BUILD_PERF_TESTS=NO \ -D BUILD_TESTS=NO .. &> /dev/null make &> /dev/null && make install &> /dev/null && echo "Successfully installed opencv" pip3 install --upgrade matplotlib jupyter ipywidgets jupyter nbextension enable --py widgetsnbextension pip install --upgrade pip cffi apk add --no-cache python py-pip echo "===> Installing Ansible..." pip install ansible cd /opt && rm -r /opt/tmp && mkdir -p /opt/notebook unset CC CXX apk del .build-deps rm -rf /var/cache/apk/* rm -r /root/.cache find /usr/lib/python3.5/ -type d -name tests -depth -exec rm -rf {} \; find /usr/lib/python3.5/ -type d -name test -depth -exec rm -rf {} \; find /usr/lib/python3.5/ -name __pycache__ -depth -exec rm -rf {} \; mkdir -p /etc/ansible echo 'localhost' > /etc/ansible/hosts
另外為了讓Jupyter能開機自動啟動,我寫了下面的script並參考這裡的說明放在 /etc/local.d/ 下,再執行
rc-update add local default
就可以自動在開機時啟動了。
/etc/local.d/jupyter.start
#!/bin/sh /usr/bin/jupyter notebook --port=80 --no-browser --ip=0.0.0.0 --notebook-dir=/opt/notebook &
/etc/local.d/jupyter.stop
#!/bin/sh /bin/ps axf | /bin/grep jupyter | /bin/grep -v grep | /usr/bin/awk '{print "kill -9 " $1}' | /bin/sh
後記 Alpine Linux 真的很好用,也很小,這整個裝起來才用不到1G的空間,真不錯。
Super User
pkexec got No session for cookie error
一直都在UBUNTU下使用 AwesomeWM 當我的主 WM,直到上次更新到 20.04 後,就發現 pkexec 不能正常的授權,會出現以下錯誤
error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
經過一陣搜尋後發現 這篇 裡的解法是執行
/usr/lib/x86_64-linux-gnu/polkit-mate/polkit-mate-authentication-agent-1
就可以正常運作,所以我把這程序放在autostart裡開機自動執行之後就都可以正常使用 pkexec 了
Atom 的 git-control 外掛跳錯
新裝的 ATOM 因習慣裝了 git-control 這外掛,結果一直跳錯
Uncaught TypeError: Cannot read property 'split' of undefined
照 這篇 修改,結果又出現下面的錯誤
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined at validateString (internal/validators.js:112:11)
最後看到 這篇 才正確,最終修正是在下面幾個位置把 .path 都改成 .getPath()
git-control/lib/git-control-view.coffee:76
git-control/lib/dialogs/project-dialog.coffee:33
git-control/lib/dialogs/project-dialog.coffee:46