{"id":2302,"date":"2019-03-03T22:07:56","date_gmt":"2019-03-03T13:07:56","guid":{"rendered":"http:\/\/matoken.org\/blog\/?p=2302"},"modified":"2019-03-03T22:57:19","modified_gmt":"2019-03-03T13:57:19","slug":"run-dmesg-as-a-general-user-with-debian-buster-sid","status":"publish","type":"post","link":"https:\/\/matoken.org\/blog\/2019\/03\/03\/run-dmesg-as-a-general-user-with-debian-buster-sid\/","title":{"rendered":"Debian buster\/sid \u3067dmesg\u3092\u4e00\u822c\u30e6\u30fc\u30b6\u3067\u5b9f\u884c"},"content":{"rendered":"<p>\u203b\u3053\u306e\u65b9\u6cd5\u3060\u3068\u5168\u30e6\u30fc\u30b6\u3067 <code>dmesg<\/code> \u304c\u5b9f\u884c\u3067\u304d\u3066\u3057\u307e\u3046\u306e\u3067 sudo \u3092\u4f7f\u3063\u3066\u30b0\u30eb\u30fc\u30d7\u3092\u5236\u9650\u3059\u308b\u6b21\u306e\u65b9\u6cd5\u306e\u307b\u3046\u304c\u3044\u3044\u304b\u3082\u3057\u308c\u306a\u3044\uff0e<\/p>\n<ul>\n<li><a href=\"https:\/\/matoken.org\/blog\/2019\/03\/03\/enable-dmesg-command-only-for-certain-groups\/\">\u7279\u5b9a\u30b0\u30eb\u30fc\u30d7\u3067\u306e\u307f dmesg command \u3092\u6709\u52b9\u306b\u3059\u308b \u2013 matoken&#8217;s meme<\/a><\/li>\n<\/ul>\n<hr size=1\/>\n<p>Debian buster arm64 \u74b0\u5883\u3092\u4f5c\u308a\u307e\u3057\u305f( <a href=\"https:\/\/matoken.org\/blog\/2019\/03\/01\/launch-debian-buster-arm-64-with-raspberry-pi-3-model-b-usb-boot\/\">Raspberry Pi 3 Model B \u306e USB\u8d77\u52d5\u3067 Debian buster arm64 \u3092\u52d5\u304b\u3059 \u2013 matoken&#8217;s meme<\/a> )\u304c\uff0cdmesg \u3067\u30a8\u30e9\u30fc\u3068\u306a\u308a\u307e\u3059\uff0e<code>sudo dmesg<\/code> \u306f\u52d5\u304f\uff0e<\/p>\n<pre><code>$ dmesg \r\ndmesg: read kernel buffer failed: Operation not permitted\r\n$ LC_MESSAGES=ja_JP.UTF-8 dmesg \r\ndmesg: read kernel buffer failed: \u8a31\u53ef\u3055\u308c\u3066\u3044\u306a\u3044\u64cd\u4f5c\u3067\u3059\r\n<\/code><\/pre>\n<p>\u305d\u3046\u3044\u3048\u3070\u4ee5\u524d Debian sid amd64 \u3067\u3082\u8d77\u3053\u3063\u305f\u73fe\u8c61\u3067\u3059\uff0e<br \/>\nDebian \u3067\u306f Linux 4.8.0 \u304b\u3089\u4ed5\u69d8\u304c\u5909\u308f\u3063\u3066root \u4ee5\u5916\u3067\u306fdmesg \u304c\u8aad\u3081\u306a\u3044\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\uff0elog file \u306e\u8aad\u3081\u308b adm group \u306e\u30e6\u30fc\u30b6\u3082\u99c4\u76ee\uff0e<br \/>\n\u3053\u308c\u306f kernel\u30d1\u30e9\u30e1\u30fc\u30bf\u306e <code>kernel.dmesg_restrict<\/code> \u3067\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30de\u30f3\u30c9\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\uff0e<\/p>\n<pre><code>$ sudo sysctl -a|grep dmesg\r\nkernel.dmesg_restrict = 1\r\n$ cat \/proc\/sys\/kernel\/dmesg_restrict\r\n1\r\n<\/code><\/pre>\n<p>\u3053\u308c\u3092 <code>1<\/code> \u304b\u3089 <code>0<\/code> \u306b\u5909\u66f4\u3059\u308b\u3053\u3068\u3067\u4ee5\u524d\u3068\u540c\u3058\u52d5\u4f5c\u3068\u306a\u308a\u307e\u3059\uff0esysctl \u30b3\u30de\u30f3\u30c9\u3084\uff0c<\/p>\n<pre><code>$ sudo sysctl -w kernel.dmesg_restrict=0\r\n<\/code><\/pre>\n<p><code>\/proc\/sys\/kernel\/dmesg_restrict<\/code> \u3092\u76f4\u63a5\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u3067\u4e00\u6642\u7684\u306b\u5909\u66f4\u3067\u304d\u307e\u3059\uff0e<\/p>\n<pre><code>echo 0 | sudo tee \/proc\/sys\/kernel\/dmesg_restrict\r\n<\/code><\/pre>\n<p>\u52d5\u304d\u307e\u3057\u305f\uff0e<\/p>\n<pre><code>$ id | grep -o adm\r\n$ echo hello | sudo tee \/dev\/kmsg \r\nhello\r\n[  562.152729] hello\r\n$ dmesg -H | tail\r\n[  +0.019933] brcmfmac mmc1:0001:1: firmware: failed to load brcm\/brcmfmac43430-sdio.clm_blob (-2)\r\n[  +0.020182] firmware_class: See https:\/\/wiki.debian.org\/Firmware for information about missing firmware\r\n[  +0.020886] brcmfmac mmc1:0001:1: Direct firmware load for brcm\/brcmfmac43430-sdio.clm_blob failed with error -2\r\n[  +0.021916] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available\r\n[  +0.026818] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430\/1 wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f\r\n[  +0.077925] systemd-udevd[376]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.\r\n[  +0.537137] EXT4-fs (sda2): re-mounted. Opts: (null)\r\n[  +2.001639] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup\r\n[  +1.563625] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1\r\n[Mar 2 05:58] hello\r\n<\/code><\/pre>\n<p>\u518d\u8d77\u52d5\u3059\u308b\u3068\u5143\u306b\u623b\u3063\u3066\u3057\u307e\u3046\u306e\u3067\uff0c<code>\/etc\/sysctl.d\/local.conf<\/code> \u306a\u3069\u306b\u8a2d\u5b9a\u3092\u66f8\u3044\u3066\u304f\u3068\u6b21\u56de\u8d77\u52d5\u6642\u4ee5\u964d\u3082\u53cd\u6620\u3055\u308c\u307e\u3059\uff0e<\/p>\n<pre><code>$ sudo install -m 644 -o root -g root \/dev\/null \/etc\/sysctl.d\/local.conf\r\n$ echo 'kernel.dmesg_restrict = 0' | sudo tee -a \/etc\/sysctl.d\/local.conf\r\nkernel.dmesg_restrict = 0\r\n<\/code><\/pre>\n<p>\u8a66\u3057\u305f\u74b0\u5883<\/p>\n<pre><code>$ dmesg --version\r\ndmesg from util-linux 2.33.1\r\n$ dpkg-query -W util-linux linux-image-*\r\nlinux-image-4.19.0-2-arm64      4.19.16-1\r\nlinux-image-4.19.0-2-arm64-unsigned\r\nlinux-image-arm64       4.19+102\r\nutil-linux      2.33.1-0.1\r\n$ lsb_release -dr\r\nDescription:    Debian GNU\/Linux buster\/sid\r\nRelease:        testing\r\n$ uname -a\r\nLinux rpi3 4.19.0-2-arm64 #1 SMP Debian 4.19.16-1 (2019-01-17) aarch64 GNU\/Linux\r\n$ cat \/proc\/device-tree\/model ;echo\r\nRaspberry Pi 3 Model B Rev 1.2\r\n<\/code><\/pre>\n<ul>\n<li><a href=\"https:\/\/wiki.debian.org\/dmesg\">dmesg &#8211; Debian Wiki<\/a><\/li>\n<\/ul>\n<p><iframe style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=matokensmeme-22&#038;language=ja_JP&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=as_ss_li_til&#038;asins=B07NFDXRQL&#038;linkId=d11391ef455da0de9c6901b4213ac92a\"><\/iframe><iframe style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=matokensmeme-22&#038;language=ja_JP&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=as_ss_li_til&#038;asins=B07F1NLW9C&#038;linkId=05531d263cdd95eee722836c0495474b\"><\/iframe><iframe style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=matokensmeme-22&#038;language=ja_JP&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=as_ss_li_til&#038;asins=B07NWDSRXK&#038;linkId=f6e4a71fa34da7185f66bd3454ca7606\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u203b\u3053\u306e\u65b9\u6cd5\u3060\u3068\u5168\u30e6\u30fc\u30b6\u3067 dmesg \u304c\u5b9f\u884c\u3067\u304d\u3066\u3057\u307e\u3046\u306e\u3067 sudo \u3092\u4f7f\u3063\u3066\u30b0\u30eb\u30fc\u30d7\u3092\u5236\u9650\u3059\u308b\u6b21\u306e\u65b9\u6cd5\u306e\u307b\u3046\u304c\u3044\u3044\u304b\u3082\u3057\u308c\u306a\u3044\uff0e \u7279\u5b9a\u30b0\u30eb\u30fc\u30d7\u3067\u306e\u307f dmesg command \u3092\u6709\u52b9\u306b\u3059\u308b \u2013 matoken&#038;#8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[428,7,6],"tags":[276,450,124,44],"class_list":["post-2302","post","type-post","status-publish","format-standard","hentry","category-buster","category-debian-linux","category-linux","tag-debian-linux","tag-debian-buster","tag-raspberry-pi-3-b","tag-raspberrypi"],"_links":{"self":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/2302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/comments?post=2302"}],"version-history":[{"count":0,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/2302\/revisions"}],"wp:attachment":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/media?parent=2302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/categories?post=2302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/tags?post=2302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}