旗鱼系统常用命令表--待翻译

Sailfish Cheat Sheet

Development Commands

Connect to the device over usb (add "192.168.2.14 device" to /etc/hosts)

 sudo ifconfig usb0 up device

Log into the device. Define password in "Settings -> System settings
-> Developer mode -> Set password".

 ssh nemo@device

Change user to root

 su       # if on SDK, or
 devel-su # if on device

Remove changed IP from known_hosts

 ssh-keygen -R device

Chroot to development environment

 /srv/mer/sdks/sdk/mer-sdk-chroot

Update development environment

 sb2 -t <target> -m sdk-install -R zypper ref
 sb2 -t <target> -m sdk-install -R zypper update

Build project

 mb2 -t <target> build # finds the spec under rpm
 mb2 -t <target> -s rpm/<package>.spec build # specify spec yourself

Copy packages to the device

 scp /RPMS/<package>.rpm nemo@device:

Listen to system logs

 journalctl -fa

Search log for keyword 'account' ignoring the case

 devel-su journalctl | grep -i account

Open file (apk, media file, vcard, call number, etc.) with appropriate
app.

 xdg-open file # e.g. xdg-open image.jpg

List shared library dependencies

 ldd /usr/lib/qt5/qml/modulepath/libmodule.so

List exported symbols

 zypper in binutils && nm -D /usr/lib/library.so.0

Set DConf value

 dconf write /desktop/meego/background/portrait/picture_filename \'/pathto/wallpaper.jpg\'

Print DConf value

 dconf read /desktop/meego/background/portrait/picture_filename

List incoming hardware input events

 evdev_trace -t

Find folders that take more than 100MB of space

 du --all --one-file-system / | awk '{if($1 > 102400) print int($1/1024) "MB" " " $2 }' # root partition
 du --all --one-file-system /home | awk '{if($1 > 102400) print int($1/1024) "MB" " " $2 }' # home partition

List RPM packages that take the most space in the system

 rpm -qa --queryformat '%{size} %{name}\n' | sort -rn | more

Execute QML document.

 pkcon install qt5-qtdeclarative-qmlscene # install qmlscene
 ln -s /usr/lib/qt5/bin/qmlscene /usr/bin/qmlscene # add symbolic link to path
 qmlscene app.qml # run

Diagnostics

Saving logs is always good

 devel-su journalctl -a > ~/saved.journal

Add -f to contiously listen to the log output:

 devel-su journalctl -fa

The systemd journal is persistent over reboots in devel branch -
otherwise edit /etc/systemd/journald.conf and set

 Storage=persistent

Preventing journald from throttling logging from a verbose process -
edit /etc/systemd/journald.conf and set

 RateLimitBurst=9999
 RateLimitInterval=5s

Various processes can be made more verbose by setting certain
environment variables:

 QT_LOGGING_RULES="*.debug=true"   # any application or service using Qt Categorized Logging
 MSYNCD_LOGGING_LEVEL=8   # any Buteo sync plugin
 SSO_LOGGING_LEVEL=3 SSOUI_LOGGING_LEVEL=3  # Accounts&SSO services
 CONTACTSD_DEBUG=1  # contactsd instant messaging roster synchronisation daemon
 QTCONTACTS_SQLITE_TWCSA_TRACE=1 QTCONTACTS_SQLITE_TRACE=1  # qtcontacts-sqlite backend debug output
 KCALDEBUG=1  # calendar application and plugins, mkcal and KCal debug output
 LIPSTICK_COMPOSITOR_DEBUG=1  # homescreen debug output

Various processes can be made more verbose by editing certain
configuration files and rebooting:

 /home/nemo/.config/QtProject/Messageserver.conf  # email, QtMessagingFramework configuration file
 /home/nemo/.config/eas-sailfish.conf  # Exchange ActiveSync plugin configuration file

For example, to make the Exchange ActiveSync plugin fully verbose, first
ensure that journald won't throttle logging output (see the notes on
editing /etc/systemd/journald.conf above) and then ensure that the
/home/nemo/.config/eas-sailfish.conf file contains the following:

 [logging]
 Sailfish.eas.debug=dwc
 Sailfish.eas.warning=dwc
 Sailfish.eas.error=dwc
 Sailfish.easwbxml=dwc
 Sailfish.easnetwork=dwc
 Sailfish.easverbose=dwc

Some processes can be made more verbose by installing specific "tracing"
packages which configure the service to be more verbose when installed
(via devel-su pkcon install <pkgname>). Some examples include:

 connman-tracing
 bluez5-tracing
 connectionagent-qt5-tracing

Home Screen and Compositor diagnostics

Lipstick debugs can be enabled by adding LIPSTICK\_COMPOSITOR\_DEBUG=1
to /var/lib/environment/compositor/\*.conf.


Now restart lipstick and you have a small box at the bottom of the
screen for debugging the top most window. "Dump" button outputs data of
the top most window to the journal. "Expose" button shows current
windows.


In case screen is locked or/and touch is not responding but you have an
access to the device. Top most window can be dumped like:

 dbus-send --type=method_call --print-reply --dest=org.nemomobile.compositor.debug /debug org.nemomobile.compositor.debug.dump

Power Diagnostics

Go to your device command line. Download Power issues reporting
script

on your device

 curl -o power-diagnostics.sh https://git.merproject.org/mer-core/statefs-providers/blob/master/tools/power-diagnostics.sh && chmod a+x power-diagnostics.sh

and run it

 devel-su ./power-diagnostics.sh > /home/nemo/power-state-report.txt

Attach resulting /home/nemo/power-state-report.txt file and journal to
your bug report.

Backup Diagnostics

On the target device go to the command line. Download there Backup
status reporting
script

and make it executable.

 curl -o the-vault-storage-report.sh https://git.merproject.org/mer-core/the-vault/blob/master/tools/the-vault-storage-report.sh && chmod a+x the-vault-storage-report.sh

Execute the command in privileged mode.

 devel-su -p ./the-vault-storage-report.sh > /home/nemo/backup-status-report.txt

Attach resulting /home/nemo/backup-status-report.txt file to your bug
report.

Restart System Services

Restart user session

 systemctl restart user@100000

Restart networking. Warning! Disconnects your SSH connection.

 systemctl restart connman.service

Restart home screen

 systemctl --user restart lipstick

Restart keyboard

 systemctl --user restart maliit-server

Restart Phone application

 systemctl --user restart voicecall-ui-prestart

Restart Phone middleware

 systemctl restart ofono
 systemctl-user restart voicecall-manager

Package Handling

Root rights required

 devel-su

Show SW version

 version

Update software

 version --dup

Pkcon commands

 pkcon refresh   # Update repositories
 
 pkcon search name [PACKAGE_NAME]
 pkcon install [PACKAGE_NAME]
 pkcon get-details [PACKAGE_NAME]
 pkcon remove [PACKAGE_NAME]
 pkcon update [PACKAGE_NAME]
 
 pkcon install-local [FILE_NAME]
 
 pkcon repo-list
 pkcon repo-enable [REPO_ID]
 pkcon repo-disable [REPO_ID]
 
 pkcon       # Lists the full command syntax and options.

Zypper commands for SDK (pkcon is preferred on device)

 zypper lr # list repositories
 zypper ref # update repositories
 zypper update # update packages
 zypper se packagename # search packages
 zypper in packagename # install packages
 zypper info packagename # check package information
 zypper info -t pattern patternname # check pattern information
 zypper verify # check dependencies

RPM commands

 rpm -e <package> # remove package
 rpm -ql <package-name> # list files in package
 rpm -qlP <file> # list files in package
 rpm -qf <file> # find out what package file belongs to
 rpm -qpR <rpm-file> # find out package dependencies
 rpm -qR <package-name> # find out package dependencies
 rpm -q --whatrequires <package> # find out reverse dependencies
 rpm -qa | xargs rpm -qR | grep -b5 <package> # query all packages, check whether they depend on package
 rpm -U --oldpackage --replacepkgs  --replacefiles <package> # reinstall rpm package

Clear corrupted rpm database (as root):

 rm -rf /var/lib/rpm/__db* ; rpm --rebuilddb

Clearing, Importing and Exporting User Data

Phone

Install commhistory-tool if not already installed.

 pkcon install  libcommhistory-qt5-tools

Clear call logs, run as nemo

 commhistory-tool deleteall -calls

Add call logs data, run as nemo

 commhistory-tool import-json calllogs.json

Restart Phone application to see changes in effect.

 pkill voicecall-ui

Messages

Remove all message conversations, run as nemo

 commhistory-tool deleteall -groups

Import message data, run as nemo

 commhistory-tool import-json messages.json

Restart Messages application to see changes in effect.

 pkill jolla-messages

People

Install vcardconverter if not already installed.

 pkcon install nemo-qml-plugin-contacts-qt5-tools

Import contacts from vCard

 devel-su -p vcardconverter contacts.vcf

Export local contacts to vCard

 devel-su -p vcardconverter --export contacts.vcf

Calendar

Install icalconverter if not already installed

 pkcon install nemo-qml-plugin-calendar-qt5-tools

Import events from iCal

 devel-su -p icalconverter import calendar.ics

Import events using Calendar import page

 dbus-send --print-reply --type=method_call --dest=com.jolla.calendar.ui /com/jolla/calendar/ui com.jolla.calendar.ui.importFile string:/home/nemo/calendar.ics

Export local calendar events to iCal

 devel-su -p icalconverter export calendar.ics

Browser

Set the home page.

 dconf write /apps/sailfish-browser/settings/home_page "'http://jolla.com'"

Media

Transfer content to the device

 scp *.jpg nemo@device:Pictures
 scp *.mp4 nemo@device:Videos
 scp *.pdf nemo@device:Documents
 scp *.ogg nemo@device:Music

Homescreen

Reset order of apps in Homescreen launcher.

 rm /home/nemo/.config/lipstick/applications.menu

Weather

Remove weather locations

 rm /home/nemo/.local/share/sailfish-weather/weather.json

Blocking Device Suspend

Install mcetool

 zypper in mce-tools

Disable late suspend

 mcetool -searly

Disable early suspend

 mcetool -sdisabled

Restore normal suspend policy

 mcetool -senabled

Screen Brightness

Install mcetool

 zypper in mce-tools

Set brightness setting to maximum value

 mcetool -b5

Disable screen dimming when home screen or applications are open

 mcetool -Don

Disable screen dimming when the lock screen is open

 mcetool -tdisabled

Go back to normal behavior

 mcetool -Doff -tenabled

For problem with unusually dark display, try disabling als-based display
brightness filtering

 mcetool -gdisabled

Reset all mce values to their defaults

 systemctl stop mce.service
 rm /var/lib/mce/builtin-gconf.values
 systemctl start mce.service

Show Dialogs

Alarm Dialog

Show timer alarm in 3 seconds (ticker=3).

 timedclient-qt5 -b'TITLE=button0' -e'APPLICATION=nemoalarms;TITLE=Timer;type=countdown;timeOfDay=1;triggerTime=1395217218;ticker=3'

Show clock alarm in 3 seconds (ticker=3).

 timedclient-qt5 -b'TITLE=button0' -e'APPLICATION=nemoalarms;TITLE=Clock;type=event;timeOfDay=772;ticker=3'

Connection Dialog

 dbus-send --print-reply --type=method_call --dest=com.jolla.lipstick.ConnectionSelector /  com.jolla.lipstick.ConnectionSelectorIf.openConnection string:

USB Dialog

Connect cable. Make sure "Settings -> USB -> Default USB mode" is set
to "Always ask".

Unresponsive App Dialog

Make app unresponsive by stopping it's execution.

 kill -SIGSTOP `pgrep appname` # e.g. jolla-messages

Continue execution by calling

 kill -SIGCONT `pgrep appname` # e.g. jolla-messages

Side Loading Dialog

 xdg-open package.rpm

Call Request Dialog

 xdg-open "tel://0123456789"

Supplementary Service Dialog

Type USSD
code

with Phone dialer, for example "*#31#" shows the status of caller
line restriction.

Audio Warning Dialog

Change headset audio warning timeout by adding following lines to
/etc/pulse/mainvolume-listening-time-notifier.conf.

 "timeout = 1
 sink-list = sink.primary
 mode-list = lineout"
 systemctl --user restart pulseaudio.service

Now play a song over 1 minute with normal headset in Media Player to see
a warning dialog.

Reset too-loud volume warning.

 /usr/bin/dconf write /desktop/nemo/audiowarning true

Now play a song over headset and turn the volume to maximum to see a
warning dialog.

The Other Half Installation Dialog

Sign in to Jolla store. Attach new TOH back cover.

这是9天之前的……?为啥我没注意到……

话说我一直没搞明白的一点是这个packagekit比zypper好在哪里呢

@天苯 通用吧,zypper貌似只是suse系列的(貌似也可以装在红帽系列上[doge])

此回复已被删除!

@birdzhang 红帽系列是dnf和yum罢……
主要是看这上面说device上推荐用packagekit,SDK上推荐用zypper,packagekit看起来好像可以当各种包管理的前端,就是不了解为啥两种情况推荐的不一样……

@天苯 现在搞得兼容性都不错,好像都可以装。pkcon封装了这些基本的包管理接口,做成一个统一的了

@birdzhang 先祝鸟张大大新婚快乐。今天一哥们刷到F5121上了,用pkcon install-local装jolla-xt9中文输入法包报架构错误,我让他用zypper in就装上了。这是packagekit的BUG?

祝鸟张大大新婚快乐。我是那个刷到F5121的哥们

@天苯 🤔pkcon有时候会出现一些莫名其妙的bug,比如提示找不到软件包、缺少依赖等,这俩是我遇到过的。看样子也是bug,突然想起nexus5上用pkcon装jolla-xt9现在也是装不上了

@饭盒 666,结婚这几天一直忙着没时间上论坛看看😅

@birdzhang 看来这个前端不靠谱,还是用zypper好了

祝鸟张新婚快乐!

@jollanfc 谢谢谢谢. 起这么早!😲

找到宝贝l,留名备用