id:rx7(@namikawa)の技術メモ このページをアンテナに追加 RSSフィード

過去記事一覧 | Main Blog (元RX-7乗りの適当な日々) | SBM (id:rx7のBookmark)



| Ubuntuで(kernel)debuginfoパッケージをインストールする - id:rx7(@namikawa)の技術メモ を含むブックマーク はてなブックマーク - Ubuntuで(kernel)debuginfoパッケージをインストールする - id:rx7(@namikawa)の技術メモ Ubuntuで(kernel)debuginfoパッケージをインストールする - id:rx7(@namikawa)の技術メモ のブックマークコメント


semantic error: missing x86_64 kernel/module debuginfo [man warning::debuginfo] under '/lib/modules/4.4.0-66-generic/build'


# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C8CAB6595FDFF622

# codename=$(lsb_release -c | awk  '{print $2}')
# tee /etc/apt/sources.list.d/ddebs.list << EOF
deb http://ddebs.ubuntu.com/ ${codename} main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-security main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-updates  main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted universe multiverse

# apt-get update
# apt-get install linux-image-$(uname -r)-dbgsym
トラックバック - http://tech.g.hatena.ne.jp/rx7/20170322


Warning: The resulting partition is not properly aligned for best performance.

| Warning: The resulting partition is not properly aligned for best performance. - id:rx7(@namikawa)の技術メモ を含むブックマーク はてなブックマーク - Warning: The resulting partition is not properly aligned for best performance. - id:rx7(@namikawa)の技術メモ Warning: The resulting partition is not properly aligned for best performance. - id:rx7(@namikawa)の技術メモ のブックマークコメント

parted コマンドで、

(parted) mkpart primary xfs 0 -0


Warning: The resulting partition is not properly aligned for best performance.


このまま mkfs する際も、ちゃんと下記のような警告を出してくれる。

warning: device is not properly aligned /dev/sdb1


Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  6442GB  6442GB               primary


(parted) p
Model: Google PersistentDisk (scsi)
Disk /dev/sdb: 6442GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags


(parted) mkpart primary xfs 0% 6442GB

こんな感じで、頭を "0%" で指定すれば、警告は解消された。

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  6442GB  6442GB  xfs          primary


トラックバック - http://tech.g.hatena.ne.jp/rx7/20161130



| curlで取得できるレスポンスタイムの内訳 - id:rx7(@namikawa)の技術メモ を含むブックマーク はてなブックマーク - curlで取得できるレスポンスタイムの内訳 - id:rx7(@namikawa)の技術メモ curlで取得できるレスポンスタイムの内訳 - id:rx7(@namikawa)の技術メモ のブックマークコメント


Step 4: Print timing breakdown

But we still don’t see the timing breakdown of the HTTP request as promised. If we go through all the options supported by curl (http://curl.haxx.se/docs/manpage.html) we will see that it has the capability of returning timing information on the hostname lookup ( time_namelookup), the time it takes to connect to the remote host ( time_connect), the time it takes to start transferring data ( time_pretrasnfer), the total time ( total_time) and many others. In order to display this information on our console in a pretty and human readable format copy and paste the following command:

$ curl -L --output /dev/null --silent --show-error --write-out 'lookup:        %{time_namelookup}\nconnect:       %{time_connect}\nappconnect:    %{time_appconnect}\npretransfer:   %{time_pretransfer}\nredirect:      %{time_redirect}\nstarttransfer: %{time_starttransfer}\ntotal:         %{time_total}\n' 'google.com'
 lookup:        0.036
 connect:       0.053
 appconnect:    0.000
 pretransfer:   0.053
 redirect:      0.105
 starttransfer: 0.118
 total:         0.253

appconnect is the time, in seconds, it took from the start until the SSL/SSH/etc. connect/handshake to the remote host was completed. In the example above it is zero because we don’t use the HTTPS protocol. If you try the same command with “https://google.com” you get the following nonzero value for appconnect:

$ curl -L –output /dev/null –silent –show-error –write-out ‘lookup:        %{time_namelookup}\nconnect:       %{time_connect}\nappconnect:    %{time_appconnect}\npretransfer:   %{time_pretransfer}\nredirect:      %{time_redirect}\nstarttransfer: %{time_starttransfer}\ntotal:         %{time_total}\n’ ‘https://google.com’
lookup:        0.038
connect:       0.063
appconnect:    0.177
pretransfer:   0.178
redirect:      0.225
starttransfer: 0.679
total:         0.929
HTTP transaction timing breakdown with curl | Network Monitoring | NetBeez


Here is what each value represents, according to curl’s manual page:

  • lookup: The time, in seconds, it took from the start until the name resolving was completed.
  • connect: The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed.
  • appconnect: The time, in seconds, it took from the start until the SSL/SSH/etc connect/handshake to the remote host was completed. (Added in 7.19.0)
  • pretransfer: The time, in seconds, it took from the start until the file transfer was just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved.
  • redirect: The time, in seconds, it took for all redirection steps include name lookup, connect, pretransfer and transfer before the final transaction was started. time_redirect shows the complete execution time for multiple redirections. (Added in 7.12.3)
  • starttransfer: The time, in seconds, it took from the start until the first byte was just about to be transferred. This includes time_pretransfer and also the time the server needed to calculate the result.
  • total: The total time, in seconds, that the full operation lasted. The time will be displayed with millisecond resolution.
HTTP transaction timing breakdown with curl | Network Monitoring | NetBeez
トラックバック - http://tech.g.hatena.ne.jp/rx7/20161031



| 色々パッケージをインストールしたあるUbuntuマシンを元に、同じパッケージ構成の別マシンを作りたいとき - id:rx7(@namikawa)の技術メモ を含むブックマーク はてなブックマーク - 色々パッケージをインストールしたあるUbuntuマシンを元に、同じパッケージ構成の別マシンを作りたいとき - id:rx7(@namikawa)の技術メモ 色々パッケージをインストールしたあるUbuntuマシンを元に、同じパッケージ構成の別マシンを作りたいとき - id:rx7(@namikawa)の技術メモ のブックマークコメント



# dpkg --get-selections > installed.list


# apt-get install dselect
# dselect update
# dpkg --clear-selections
# dpkg --set-selections < installed.list
# apt-get dselect-upgrade
# apt-get autoremove
トラックバック - http://tech.g.hatena.ne.jp/rx7/20160928



| autosshのコマンド・オプション例 - id:rx7(@namikawa)の技術メモ を含むブックマーク はてなブックマーク - autosshのコマンド・オプション例 - id:rx7(@namikawa)の技術メモ autosshのコマンド・オプション例 - id:rx7(@namikawa)の技術メモ のブックマークコメント

$ autossh -f -M 0 -N -g -o "ServerAliveInterval 60" -i ~/.ssh/id_rsa -L (ローカルポート):(リモートホスト):(リモートポート) (SSHユーザ名)@(SSH接続先ホスト)

上記例は、 "-g" オプションで、他ホストからも接続を受け付ける設定なので、そこは注意。


AUTOSSH(1)                                         BSD General Commands Manual                                        AUTOSSH(1)

     autossh — monitor and restart ssh sessions

     autossh [-V] [-M port[:echo_port]] [-f] [SSH_OPTIONS]

     autossh is a program to start a copy of ssh and monitor it, restarting it as necessary should it die or stop passing traf‐

     The original idea and the mechanism were from rstunnel (Reliable SSH Tunnel). With version 1.2 of autossh the method
     changed: autossh uses ssh to construct a loop of ssh forwardings (one from local to remote, one from remote to local), and
     then sends test data that it expects to get back. (The idea is thanks to Terrence Martin.)

     With version 1.3, a new method is added (thanks to Ron Yorston): a port may be specified for a remote echo service that
     will echo back the test data. This avoids the congestion and the aggravation of making sure all the port numbers on the
     remote machine do not collide. The loop-of-forwardings method remains available for situations where using an echo service
     may not be possible.

   SSH exits
     autossh tries to distinguish the manner of death of the ssh process it is monitoring and act appropriately. The rules are:

     1.      If the ssh process exited normally (for example, someone typed "exit" in an interactive session), autossh exits
             rather than restarting;

     2.      If autossh itself receives a SIGTERM, SIGINT, or a SIGKILL signal, it assumes that it was deliberately signalled,
             and exits after killing the child ssh process;

     3.      If autossh itself receives a SIGUSR1 signal, it kills the child ssh process and starts a new one;

     4.      Periodically (by default every 10 minutes), autossh attempts to pass traffic on the monitor forwarded port. If this
             fails, autossh will kill the child ssh process (if it is still running) and start a new one;

     5.      If the child ssh process dies for any other reason, autossh will attempt to start a new one.

   Startup behaviour
     If the ssh session fails with an exit status of 1 on the very first try, autossh

     1.      will assume that there is some problem with syntax or the connection setup, and will exit rather than retrying;

     2.      There is a "starting gate" time. If the first ssh process fails within the first few seconds of being started,
             autossh assumes that it never made it "out of the starting gate", and exits. This is to handle initial failed
             authentication, connection, etc. This time is 30 seconds by default, and can be adjusted (see the AUTOSSH_GATETIME
             environment variable below). If AUTOSSH_GATETIME is set to 0, then both behaviours are disabled: there is no
             "starting gate", and autossh will restart even if ssh fails on the first run with an exit status of 1. The "start‐
             ing gate" time is also set to 0 when the -f flag to autossh is used.

   Continued failures
     If the ssh connection fails and attempts to restart it fail in quick succession, autossh will start delaying its attempts
     to restart, gradually backing farther and farther off up to a maximum interval of the autossh poll time (usually 10 min‐
     utes).  autossh can be "prodded" to retry by signalling it, perhaps with SIGHUP ("kill -HUP").

   Connection setup
     As connections must be established unattended, the use of autossh requires that some form of automatic authentication be
     set up. The use of RSAAuthentication with ssh-agent is the recommended method. The example wrapper script attempts to check
     if there is an agent running for the current environment, and to start one if there isn't.

     It cannot be stressed enough that you must make sure ssh works on its own, that you can set up the session you want before
     you try to run it under autossh

     If you are tunnelling and using an older version of ssh that does not support the -N flag, you should upgrade (your version
     has security flaws). If you can't upgrade, you may wish to do as rstunnel does, and give ssh a command to run, such as
     "sleep 99999999999".

     -M port[:echo_port]
             specifies the base monitoring port to use. Without the echo port, this port and the port immediately above it (
             port + 1) should be something nothing else is using.  autossh will send test data on the base monitoring port, and
             receive it back on the port above. For example, if you specify “-M 20000”, autossh will set up forwards so that it
             can send data on port 20000 and receive it back on 20001.

             Alternatively, a port for a remote echo service may be specified. This should be port 7 if you wish to use the
             standard inetd echo service.  When an echo port is specified, only the specified monitor port is used, and it car‐
             ries the monitor message in both directions.

             Many people disable the echo service, or even disable inetd, so check that this service is available on the remote
             machine. Some operating systems allow one to specify that the service only listen on the localhost (loopback inter‐
             face), which would suffice for this use.

             The echo service may also be something more complicated: perhaps a daemon that monitors a group of ssh tunnels.

             Setting the monitor port to 0 turns the monitoring function off, and autossh will only restart ssh upon ssh's exit.
             For example, if you are using a recent version of OpenSSH, you may wish to explore using the ServerAliveInterval
             and ServerAliveCountMax options to have the SSH client exit if it finds itself no longer connected to the server.
             In many ways this may be a better solution than the monitoring port.

     -f      causes autossh to drop to the background before running ssh. The -f flag is stripped from arguments passed to ssh.
             Note that there is a crucial a difference between -f with autossh, and -f with ssh: when used with autossh ssh will
             be unable to ask for passwords or passphrases. When -f is used, the "starting gate" time (see AUTOSSH_GATETIME) is
             set to 0.

     -V      causes autossh to display its version number and exit.

     Other than the flag to set the connection monitoring port, autossh uses environment variables to control features. ssh
     seems to be still collecting letters for options, and this seems the easiest way to avoid collisions.

             If this variable is set, the logging level is set to to LOG_DEBUG, and if the operating system supports it, syslog
             is set to duplicate log entries to stderr.

             Specifies the time to wait before the first connection test. Thereafter the general poll time is used (see
             AUTOSSH_POLL below).

             Specifies how long ssh must be up before we consider it a successful connection. The default is 30 seconds. Note
             that if AUTOSSH_GATETIME is set to 0, then not only is the gatetime behaviour turned off, but autossh also ignores
             the first run failure of ssh. This may be useful when running autossh at boot.

             Specifies the log level, corresponding to the levels used by syslog; so 0-7 with 7 being the chattiest.

             Specifies that autossh should use the named log file, rather than syslog.

             Sets the maximum number of seconds that the program should run. Once the number of seconds has been passed, the ssh
             child will be killed and the program will exit.

             Specifies how many times ssh should be started. A negative number means no limit on the number of times ssh is
             started. The default value is -1.

             Append message to echo message sent when testing connections.

             (Cygwin only.) When set to "yes" , autossh sets up to run as an NT service under cygrunsrv. This adds the -N flag
             for ssh if not already set, sets the log output to stdout, and changes the behaviour on ssh exit so that it will
             restart even on a normal exit.

             Specifies the path to the ssh executable, in case it is different than the path compiled in.

             Write autossh pid to specified file.

             Specifies the connection poll time in seconds; default is 600 seconds.  Unless AUTOSSH_FIRST_POLL is used, the
             first poll time will set to match the poll time. If the poll time is less than twice the network timeouts (default
             15 seconds) the network timeouts will be adjusted downward to 1/2 the poll time.

             Sets the connection monitoring port. Mostly in case ssh appropriates -M at some time. But because of this possible
             use, AUTOSSH_PORT overrides the -M flag. A value of 0 turns the monitoring function off.

     The debian version of autossh uses a wrapper to automatically select a free monitoring port and -M overrides AUTOSSH_PORT,
     see /usr/share/doc/autossh/README.Debian for further information.

     autossh was written by Carson Harding.

     ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), cygrunsrv(1).

BSD                                                       Jul 20, 2004                                                       BSD
トラックバック - http://tech.g.hatena.ne.jp/rx7/20160704