<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Fun with ones and zeros - ubuntu</title>
<subtitle>Barry&#039;s notes on computer software and hardware</subtitle>
<link href="/blog/tags/ubuntu"></link>
<updated>2026-05-20T02:43:48-07:00</updated>
<id>urn:uuid:af947e68-9943-23d4-13f3-7d5f82c5c5b6</id>
<entry>
<title>SNMP server not reporting disk size</title>
<link href="/blog/entries/snmp-server-not-reporting-disk-size"></link>
<id>urn:uuid:69d36474-60b6-0039-5d8d-e9bb77426a60</id>
<updated>2024-02-29T12:21:00-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">&lt;p&gt;I was setting up snmpd on an Ubuntu box, and noticed that it was reporting weird numbers
for a couple of XFS filesystems I had setup for Minio.&lt;/p&gt;
&lt;p&gt;An snmpwalk showed values like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HOST-RESOURCES-MIB::hrStorageType.51 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.52 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
...
HOST-RESOURCES-MIB::hrStorageDescr.51 = STRING: /minio/disk1
HOST-RESOURCES-MIB::hrStorageDescr.52 = STRING: /minio/disk2
...
HOST-RESOURCES-MIB::hrStorageAllocationUnits.51 = INTEGER: 0 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.52 = INTEGER: 0 Bytes
...
HOST-RESOURCES-MIB::hrStorageSize.51 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageSize.52 = INTEGER: 0
...
HOST-RESOURCES-MIB::hrStorageUsed.51 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageUsed.52 = INTEGER: 0&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So it was reporting the existence of the disks, but with all 0 values.  The root ext4 filesystem showed up fine,
was it something to do with XFS?  &lt;/p&gt;
&lt;p&gt;Turns out the answer was NO, it was the permissions of the /minio directory
that the filesystems were mounted under.  I figured this out when I noticed
that &lt;code&gt;df -h&lt;/code&gt; showed the disks when I was running as root&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/dev/sdb1        60G  461M   60G   1% /minio/disk1
/dev/sdc1        60G  461M   60G   1% /minio/disk2&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But when running as non-root, such as the Debian-snmp user, &lt;code&gt;df -h&lt;/code&gt; didn&#039;t show the disks at all.&lt;/p&gt;
&lt;p&gt;Turns out I had been too strict with the permissions on &lt;code&gt;/minio&lt;/code&gt;, I had originally set that to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;drwx------   4 minio-user root       4096 Feb 14 14:57 minio&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But that apparently, and to my surprise, prevented snmpd from being able to read the size and usage
information for the mounts under that directory.  Changing that to &lt;code&gt;0755&lt;/code&gt; fixed the problem, and I just
made sure that the mountpoints had more strict permissions&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;drwxr-x--- 3 minio-user root 24 Feb 27 13:08 disk1
drwxr-x--- 3 minio-user root 24 Feb 27 13:08 disk2&lt;/code&gt;&lt;/pre&gt;</content>
</entry>
<entry>
<title>Automatically restarting Percona XtraDB cluster</title>
<link href="/blog/entries/automatically-restarting-percona-xtradb-cluster"></link>
<id>urn:uuid:d1a316dd-db76-abce-d158-d28ddf61c8de</id>
<updated>2023-02-01T10:05:00-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">&lt;body&gt;&lt;p&gt;I&#039;ve been experimenting with Percona XtraDB cluster, and found that by default it requires manual intervention
to restart the cluster from an all-nodes-down state when the nodes were gracefully shutdown.  The docs talk about
identifying which node has &lt;code&gt;safe_to_bootstrap: 1&lt;/code&gt; in it&#039;s &lt;code&gt;/var/lib/mysql/grastate.dat&lt;/code&gt; file, and on that node starting
the &lt;code&gt;mysql@boostrap&lt;/code&gt; service instead of just plain &lt;code&gt;mysql&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Looking at a file and acting on what&#039;s found seems like something that could be automated, so here&#039;s my take for an
Ubuntu 22.04 setup:&lt;/p&gt;
&lt;p&gt;On each node (yay Ansible!) I added this script as &lt;code&gt;/usr/local/sbin/choose-mysql-service.sh&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;source&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;#!/bin/bash&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;GRASTATE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/var/lib/mysql/grastate.dat&quot;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;service&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;mysql&quot;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Start a different service if grastate.dat is present&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# with safe_to_bootstrap: 1&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-f&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$GRASTATE&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;grep&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;--quiet&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^safe_to_bootstrap: 1&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$GRASTATE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;service&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;mysql@bootstrap&quot;&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Starting &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$service&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
systemctl&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;start&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$service&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then I added a one-shot systemd unit to execute at boot time, as &lt;code&gt;/etc/systemd/system/choose-mysql-service.service&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;source&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;[Unit]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Choose MySQL service&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;After&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;network.target&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;[Service]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;oneshot&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/usr/local/sbin/choose-mysql-service.sh&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;RemainAfterExit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;[Install]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;WantedBy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;multi-user.target&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And the disabled the default &lt;code&gt;mysql&lt;/code&gt; service and enabled my new unit with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;systemctl daemon-reload
systemctl disable mysql
systemctl enable choose-mysql-service&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So now when the OS boots, instead of just blindly trying to start &lt;code&gt;mysql&lt;/code&gt;, it looks at the &lt;code&gt;grastate.dat&lt;/code&gt; and if it has &lt;code&gt;safe_to_bootstrap: 1&lt;/code&gt; it starts &lt;code&gt;mysql@bootstrap&lt;/code&gt; instead - or otherwise falls back to the default of starting &lt;code&gt;mysql&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I also shared this on the &lt;a href=&quot;https://forums.percona.com/t/pxc-8-auto-restart-after-graceful-shutdown/19850&quot;&gt;Percona Forum&lt;/a&gt;, look for feedback there&lt;/p&gt;&lt;/body&gt;</content>
</entry>
<entry>
<title>UFW and LXC/LXD on Ubuntu 22.04</title>
<link href="/blog/entries/ufw-and-lxd-lxd-on-ubuntu-2204"></link>
<id>urn:uuid:ba108f66-11c7-a676-de98-f224eadd4027</id>
<updated>2022-05-26T10:00:00-07:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">&lt;p&gt;I recently setup a new Ubuntu server with LXC containers.  At first it all went great, but then
later when I enabled UFW, things got flaky.  Looking at &lt;code&gt;/var/log/syslog&lt;/code&gt; I saw UFW was blocking
lots of traffic from inside the containers.  &lt;/p&gt;
&lt;p&gt;Also when restarting a container, the container wouldn&#039;t get one of the bridged &lt;code&gt;10.x.x.x&lt;/code&gt; IP addresses.&lt;/p&gt;
&lt;p&gt;After Googling a bit, I found the magic commmands on &lt;a href=&quot;https://discuss.linuxcontainers.org/t/lxd-bridge-doesnt-work-with-ipv4-and-ufw-with-nftables/10034/16&quot;&gt;this discussion&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ufw allow in on lxdbr0
ufw route allow in on lxdbr0&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In hindsight, I think it would have been better to enable &lt;code&gt;ufw&lt;/code&gt; &lt;em&gt;before&lt;/em&gt; doing anything else with the new install,
that way the problems would have been more obvious right away - rather than it being a &amp;quot;geez, it was working before&amp;quot;
type situation.&lt;/p&gt;</content>
</entry>
<entry>
<title>Decrease snmpd logging level on Ubuntu 18.04</title>
<link href="/blog/entries/decrease-snmpd-logging-on-ubuntu-18-04"></link>
<id>urn:uuid:f8795ac9-fdc7-866a-08df-795aa674e222</id>
<updated>2020-03-01T08:45:00-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">&lt;body&gt;&lt;p&gt;I recently updated some servers from Ubuntu 16.04 to 18.04, and found that
the &lt;code&gt;snmpd&lt;/code&gt; daemon was generating way too many log entries
in &lt;code&gt;/var/log/syslog&lt;/code&gt; - one for every SNMP query coming from our monitoring system.  &lt;/p&gt;
&lt;p&gt;In older Ubuntus I had edited &lt;code&gt;/etc/defaults/snmpd&lt;/code&gt; to change the &lt;code&gt;SNMPDOPTS&lt;/code&gt; line
to have a different &lt;code&gt;-Ls&lt;/code&gt; parameter, but it seems that on the new Ubuntu, the
systemd service for snmp doesn&#039;t use that &lt;code&gt;defaults&lt;/code&gt; file at all.  A comment
on this &lt;a href=&quot;https://serverfault.com/questions/310640/reduce-snmpd-logging-verbosity&quot;&gt;serverfault question&lt;/a&gt;
gave me a clue on how to fix it in systemd - I thought I&#039;d elaborate here.&lt;/p&gt;
&lt;p&gt;If you run &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;systemctl cat snmpd.service&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You see the current service file:&lt;/p&gt;
&lt;div class=&quot;source&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# /lib/systemd/system/snmpd.service&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;[Unit]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Simple Network Management Protocol (SNMP) Daemon.&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;After&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;network.target&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ConditionPathExists&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/etc/snmp/snmpd.conf&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;[Service]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;MIBSDIR=/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;MIBS=&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;simple&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecStartPre&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/bin/mkdir -p /var/run/agentx&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/usr/sbin/snmpd -Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecReload&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/bin/kill -HUP $MAINPID&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;[Install]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;WantedBy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;multi-user.target&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I wanted to override the ExecStart line with something different.  To do that, run&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;systemctl edit snmpd.service&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This brings up your default editor with a &lt;em&gt;blank&lt;/em&gt; file.  I entered these new lines:&lt;/p&gt;
&lt;div class=&quot;source&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Override default &quot;-Lsd&quot; paramter to &quot;-LSwd&quot; to decrease logging level&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;[Service]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/usr/sbin/snmpd -LSwd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The first &lt;code&gt;ExecStart=&lt;/code&gt; line is a bit odd, without it you get an error:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;snmpd.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;so the first line &#039;clears&#039; the setting before processing your own version.&lt;/p&gt;
&lt;p&gt;Save your file (&lt;code&gt;systemctl edit&lt;/code&gt; stores it as &lt;code&gt;/etc/systemd/system/snmpd.service.d/override.conf&lt;/code&gt;), and then run
&lt;code&gt;service snmpd restart&lt;/code&gt; to have take effect. If you re-run &lt;code&gt;systemctl cat snmpd.service&lt;/code&gt; you should now see:&lt;/p&gt;
&lt;div class=&quot;source&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# /lib/systemd/system/snmpd.service&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;[Unit]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Simple Network Management Protocol (SNMP) Daemon.&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;After&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;network.target&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ConditionPathExists&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/etc/snmp/snmpd.conf&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;[Service]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;MIBSDIR=/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Environment&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;MIBS=&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;simple&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecStartPre&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/bin/mkdir -p /var/run/agentx&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/usr/sbin/snmpd -Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecReload&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/bin/kill -HUP $MAINPID&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;[Install]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;WantedBy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;multi-user.target&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# /etc/systemd/system/snmpd.service.d/override.conf&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Override default &quot;-Lsd&quot; paramter to &quot;-LSwd&quot; to decrease logging level&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;[Service]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/usr/sbin/snmpd -LSwd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Which is a combination of the default service along with your override.&lt;/p&gt;
&lt;p&gt;If you have other servers you want to copy your &lt;code&gt;/etc/systemd/system/snmpd.service.d/override.conf&lt;/code&gt; file to, you need
to run&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;systemctl daemon-reload
service snmpd restart&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to have it take effect.&lt;/p&gt;&lt;/body&gt;</content>
</entry>
<entry>
<title>VM Serial Console part 2</title>
<link href="/blog/entries/vm-serial-console-part-2"></link>
<id>urn:uuid:429c9248-2eb6-4e8a-047f-27d91c681b95</id>
<updated>2011-11-09T08:18:00-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">&lt;p&gt;Fooling around a bit more with accessing a VM&#039;s serial console from a KVM hypervisor with&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;virsh console mymachine&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I found one thing that doesn&#039;t carry over from the host to the VM is the terminal window size, so if you try to use something like &lt;code&gt;vim&lt;/code&gt; through the console connection, it seems to assume a 80x25 or so window, and when &lt;code&gt;vim&lt;/code&gt; exits your console is all screwed up.&lt;/p&gt;
&lt;p&gt;It looks like a serial connection doesn&#039;t have an out-of-band way of passing that info the way telnet or ssh does, so you have set it manually.   You can discover your settings on the host machine with&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;stty size&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which should show something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;60 142&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;on the VM, the same command probably shows&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0 0&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;zero rows and columns, no wonder it&#039;s confused.  Fix it by setting the VM to have the same rows and columns as the host with something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;stty rows 60 columns 142&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and you&#039;re in business.&lt;/p&gt;</content>
</entry>
</feed>