{"id":622,"date":"2016-11-19T22:44:13","date_gmt":"2016-11-20T05:44:13","guid":{"rendered":"http:\/\/www.mjblythe.com\/hacks\/?p=622"},"modified":"2021-12-22T00:01:01","modified_gmt":"2021-12-22T07:01:01","slug":"issues-upgrading-from-ubuntu-15-10-to-16-10-via-16-04","status":"publish","type":"post","link":"http:\/\/www.mjblythe.com\/hacks\/2016\/11\/issues-upgrading-from-ubuntu-15-10-to-16-10-via-16-04\/","title":{"rendered":"Issues upgrading from Ubuntu 15.10 to 16.10 (via 16.04)"},"content":{"rendered":"<p>Canonical recently dropped official support for Ubuntu 15.10 &#8220;Wily Werewolf&#8221;, so I decided to upgrade.  I also don&#8217;t like being stuck on Long-Term-Support releases, so I did 2 upgrades in sequence: 15.10 &#8220;Wily Werewolf&#8221; to 16.04 &#8220;Xenial Xerus&#8221; to 16.10 &#8220;Yakkety Yak&#8221;. In the past, I&#8217;ve just done a clean install, but the trouble with that is having to re-do all my various customizations.  This time I figured I&#8217;d just try an in-place upgrade.  Of course, this meant that my customizations conflicted with packages changes.  I&#8217;m still not sure which method is better.<\/p>\n<p><!--more--><\/p>\n\n<h2>Conflict in <code>\/etc\/phpmyadmin\/config.inc.php<\/code><\/h2>\n<p>I had added this line:<br \/>\n<code>$cfg['ForcsSSL'] = true;<\/code><\/p>\n<p>When I added it back, I found that <code>phpmyadmin<\/code> no longer did the https redirect.  <a href=\"https:\/\/thebarton.org\/forcing-ssl-with-phpmyadmin\/\">According to this<\/a>, the option has been removed, so I need to do it with .htaccess or something now.<\/p>\n<p>Taking inspiration from <a href=\"http:\/\/serverfault.com\/a\/487341\">here<\/a>, I ended up commenting out the &#8220;Alias&#8221; line in <code>\/etc\/phpmyadmin\/apache.conf<\/code> and added it in my https vhost ( in <code>\/etc\/apache2\/sites-enabled\/default-ssl.conf<\/code>)<\/p>\n<p>Additionally, <code>phpmyadmin<\/code> was complaining about &#8220;blowfish secret too short&#8221;, so I used <a href=\"http:\/\/superuser.com\/a\/692184\">this trick<\/a> to generate more random characters to add to the secret:<br \/>\n<code>base64 \/dev\/urandom | head -c 100 >> \/var\/lib\/phpmyadmin\/blowfish_secret.inc.php<\/code><\/p>\n<h2>Conflict in <code>\/etc\/sudoers<\/code><\/h2>\n<p>The package maintainer added <code>\/snap\/bin<\/code> to the secure_path.  It was trivial to add that to my customized <code>\/etc\/sudoers<\/code>.<\/p>\n<h2>MythTV and MySQL<\/h2>\n<p>MythTV was prompting me for the MySQL admin username &#038; password&#8230;not sure why. Once I got MySQL running again, MythTV started up just fine&#8230;seems to be working OK.<\/p>\n<h2>Conflict in <code>\/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/code><\/h2>\n<p>Need to comment out <code>bind-address = 127.0.0.1<\/code> (This allows MySQL to be available to remote machines for MythTV).<\/p>\n<h2>Programs uninstalled during upgrade<\/h2>\n<ul>\n<li>digikam5\n<ul>\n<li>haven&#8217;t decided whether I want to re-install this<\/li>\n<\/ul>\n<\/li>\n<li>scribus-ng\n<ul>\n<li>I can&#8217;t find anywhere that this exists anymore.  Maybe the new version has finally been released to Ubuntu?<\/li>\n<\/ul>\n<\/li>\n<li>php5-mysqlnd\n<ul>\n<li>need native driver for a custom PHP application<\/li>\n<li><strong>non-issue<\/strong> &#8211; looks like mysqlnd is now distributed with the main mysql php plugin<\/li>\n<\/ul>\n<\/li>\n<li>wine\n<ul>\n<li><strong>non-issue<\/strong> &#8211; the meta-package is just called wine1.6 now<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Unnecessary stuff that I can remove<\/h2>\n<p>When I originally brought up my system, I was having lots of stability problems.  I installed <code>kdump<\/code> and related utilities to try to debug the kernel panics I was getting.  However, ever since I updated the BIOS (i.e. the one that actually added support for my CPU), things have been pretty stable, so I removed the <code>kdump<\/code> stuff<\/p>\n<h2>cron errors<\/h2>\n<p>I got cron errors for a php5 session cleanup script.  Just needed to &#8220;completely remove&#8221; all removed packages, and it solved the problem. (I did it in synaptic package manager&#8230;easy.)<\/p>\n<h2>Postfix not delivering mail<\/h2>\n<p>Lots of errors in syslog from postfix&#8230;can&#8217;t resolve smtp.gmail.com.  Turns out <code>\/var\/spool\/postfix\/etc\/resolv.conf<\/code> was empty, so it didn&#8217;t know how to look up hostnames.  Originally, I found this <a href=\"https:\/\/ubuntuforums.org\/showthread.php?t=882203&#038;page=2&#038;p=5569457#post5569457\">forum post<\/a>, so I &#8220;fixed&#8221; with this:<br \/>\n<code>cp \/etc\/resolv.conf \/var\/spool\/postfix\/etc\/resolv.conf<\/code><br \/>\nBut I had no idea why it broke in the first place, and when I rebooted, it was empty again.<\/p>\n<p>This seems to have been resolved at some point when I was messing with the <code>systemd-networkd<\/code> and <code>systemd-resolved<\/code> stuff (see below).<\/p>\n<h2>More errors from a cron script<\/h2>\n<p>These errors were from a custom cron script I was running, and it was failing because the file started with <code>#!\/usr\/bin\/php5<\/code>.  <code>php5<\/code> was removed and replaced with<code> php7.0<\/code>, so it coudn&#8217;t find the interpreter to execute the script.  I just changed it to <code>#!\/usr\/bin\/php<\/code>, and it&#8217;s working OK.<\/p>\n<h2><code>gpg-agent<\/code> warning<\/h2>\n<p>Whenever I opened a shell, I&#8217;d get a warning from <code>gpg-agent<\/code> about <code>--write-env-file<\/code>. <a href=\"https:\/\/forums.freebsd.org\/threads\/51092\/\">This post<\/a> lead me to <a href=\"https:\/\/www.gnupg.org\/faq\/whats-new-in-2.1.html#autostart\">this &#8220;what&#8217;s new&#8221; page<\/a>.<\/p>\n<p>I removed the following from my <code>~\/.bashrc<\/code>:<\/p>\n<p><code><br \/>\n# to use the gpg-agent:<br \/>\nenvfile=\"$HOME\/.gnupg\/gpg-agent.env\"<br \/>\nif [[ -e \"$envfile\" ]] && kill -0 $(grep GPG_AGENT_INFO \"$envfile\" | cut -d: -f 2) 2>\/dev\/null; then<br \/>\n  eval \"$(cat \"$envfile\")\"<br \/>\nelse<br \/>\n  eval \"$(gpg-agent --daemon --enable-ssh-support --write-env-file \"$envfile\")\"<br \/>\nfi<br \/>\nexport GPG_AGENT_INFO  # the env file does not contain the export statement<br \/>\nexport SSH_AUTH_SOCK   # enable gpg-agent for ssh<br \/>\n<\/code><br \/>\nand replaced it with this:<br \/>\n<code><br \/>\nexport SSH_AUTH_SOCK=~\/.gnupg\/S.gpg-agent.ssh<br \/>\n<\/code><\/p>\n<h2><code>sslh<\/code> not working<\/h2>\n<p>For those who don&#8217;t know, <code>sslh<\/code> is a TCP port multiplexer that allows you to serve both <code>ssh<\/code> and <code>https<\/code> from the same TCP port.  This is useful for circumventing workplace firewall rules that block the default <code>ssh<\/code> TCP port, 22, but allow <code>https<\/code> traffic on TCP port 443.  Setting up sslh really isn&#8217;t that hard, but I&#8217;m trying to use the <a href=\"https:\/\/github.com\/yrutschle\/sslh#transparent-proxy-support\">transparent proxy<\/a> feature.  If this isn&#8217;t used, then all traffic looks like it&#8217;s coming from localhost, not the appropriate remote IP.  I have a <a href=\"http:\/\/www.mjblythe.com\/hacks\/2016\/04\/better-sslh\/\">separate post<\/a> from when I initially set this up<\/p>\n<p>Ok, this is where I spent most of my time, so I&#8217;ll break this into 2 sections, so folks can skip my debugging process.<\/p>\n<h3>Debugging<\/h3>\n<p><code>sslh<\/code> is properly passing along ssh connections, but not <code>https<\/code>. (Note: this is actually wrong.  At this time, I was just connecting via port 22, not port 443.)  Connecting from <code>localhost<\/code> seems to work fine.  When connecting from another host, it times out, and I see this in syslog:<br \/>\n<code><br \/>\nNov 19 22:45:17 bruce sslh[30040]: forward to ssl failed:connect: Connection timed out<br \/>\nNov 19 22:45:17 bruce sslh[30040]: connect: Connection timed out<br \/>\n<\/code><br \/>\nTo me, this sounds like the <code>sslh<\/code>-to-<code>apache<\/code> connection isn&#8217;t happening for some reason.<br \/>\nI checked the output of <code>ip rules list<\/code> and <code>iptables-save<\/code>, and it looks OK.<\/p>\n<p>Around this time, I realized that <code>nmap<\/code> reported the following when run from a different machine on the same network:<br \/>\n<code><br \/>\n2222\/tcp filtered  EtherNetIP-1<br \/>\n8443\/tcp filtered  https-alt<br \/>\n<\/code><\/p>\n<p>So, I moved both <code>apache<\/code> and <code>ssh<\/code> to different ports, 9443 and 9022 respectively, and they both worked there.  I updated the <code>iptables<\/code> rules to use those ports, and bam! <code>nmap<\/code> says filtered again!  So, it has to have something to do with the <code>iptables<\/code> rules.<br \/>\nBack to the previous ports (8443 and 2222), and I get this from <code>nmap<\/code>:<br \/>\n<code><br \/>\n2222\/tcp open  EtherNetIP-1<br \/>\n8443\/tcp open  https-alt<br \/>\n<\/code><br \/>\nperfect!<br \/>\nNow, what&#8217;s wrong with the <code>iptables<\/code> rules?<br \/>\nTurns out that <code>getcap \/usr\/sbin\/sslh<\/code> returned nothing&#8230;had to set the capabilities again.<br \/>\nDon&#8217;t think it&#8217;s fixed it, though.<br \/>\nok, so once again it&#8217;s a DNS name resolution problem.  I don&#8217;t know what it&#8217;s resolving <code>bruce.<\/code> to, but when I run this command line, it works as expected:<br \/>\n<code>sudo \/usr\/sbin\/sslh --user sslh --transparent --listen 0.0.0.0:443 --ssh 192.168.1.102:9022 --ssl 192.168.1.102:9443 --pidfile \/var\/run\/sslh\/sslh.pid --foreground -v<\/code><br \/>\nSo, let&#8217;s figure out what&#8217;s up with name resolution since that seems to be a wider issue.<br \/>\nLooks like <a href=\"http:\/\/unix.stackexchange.com\/questions\/280264\/no-dns-resolution-after-upgrade-from-ubuntu-14-04-to-16-04\">other people<\/a> are having <a href=\"http:\/\/askubuntu.com\/questions\/622470\/dns-probe-finished-bad-config-error-in-ubuntu-14-04\/622493#622493\">similar problems<\/a>.<\/p>\n<p>I ran <code>sudo dpkg-reconfigure resolvconf<\/code>&#8230;let&#8217;s reboot &#038; see what happens.<br \/>\nNo change.<br \/>\nAha!  <a href=\"http:\/\/news.softpedia.com\/news\/ubuntu-16-10-yakkety-yak-switches-to-a-universal-local-dns-resolver-service-504770.shtml\">This news<\/a> looks intriguing.  <a href=\"https:\/\/lists.ubuntu.com\/archives\/ubuntu-devel\/2016-May\/039350.html\">In 16.10, Ubuntu has changed how they handle DNS resolving<\/a>.<br \/>\nI wonder if I&#8217;m still launching dnsmasq when I shouldn&#8217;t be?  Would that cause problems?<br \/>\nIt&#8217;s possible that I need to change <a href=\"http:\/\/askubuntu.com\/questions\/837982\/how-to-configure-local-dns-lookup-in-ubuntu-16-10\"><code>\/etc\/nsswitch.conf<\/code><\/a>, too.<br \/>\nTried commenting out <code>dnsmasq<\/code> in <code>NetworkManager<\/code>&#8230;no change.<br \/>\ntried uninstalling <code>resolvconf<\/code>&#8230;no change.<br \/>\nAfter both of those, <code>dig<\/code> doesn&#8217;t even work anymore!  Great!<\/p>\n<h3>Solution<\/h3>\n<p>Ok, so here&#8217;s what I&#8217;ve learned.  Ubuntu uses <code>systemd-resolved<\/code> now for DNS stuff.  However, if you want the DNS server from DHCP negotiation to be passed along to this service, you also need to use <code>systemd-networkd<\/code> to configure your interfaces.  This means no <code>NetworkManager<\/code>, no <code>resolvconf<\/code>, no <code>dnsmasq<\/code>. <a href=\"http:\/\/lukeluo.blogspot.com\/2015\/04\/the-best-way-to-configure-network.html\">Link<\/a> <a href=\"https:\/\/wiki.archlinux.org\/index.php\/systemd-networkd\">Link<\/a> <a href=\"https:\/\/wiki.archlinux.org\/index.php\/Systemd#Using_units to turn it on\">Link<\/a><\/p>\n<p>Ok, so let&#8217;s switch to <code>systemd-networkd<\/code>:<br \/>\n<code><br \/>\nsudo systemctl enable systemd-networkd<br \/>\nsudo systemctl disable NetworkManager<br \/>\nsudo systemctl stop NetworkManager<br \/>\nsudo systemctl start systemd-networkd<br \/>\n<\/code><\/p>\n<p>I also need to create <code>\/etc\/systemd\/network\/wired.network<\/code> so that <code>systemd-networkd<\/code> knows what to do:<br \/>\n<code><br \/>\n[Match]<br \/>\nName=eth*<br \/>\n[Network]<br \/>\nDHCP=yes<br \/>\n<\/code><\/p>\n<p>Finally, we need to set up this softlink so that <code>systemd-resolved<\/code> controls which DNS servers are used:<br \/>\n<code><br \/>\nsudo rm \/etc\/resolv.conf<br \/>\nsudo ln -s \/run\/systemd\/resolve\/resolv.conf \/etc\/resolv.conf<br \/>\n<\/code><\/p>\n<p>Ok, so.  For whatever reason, <code>systemd-resolved<\/code> doesn&#8217;t properly resolve unqualified domains.  I thought it might be because it was trying to do DNSSEC verification (which my router&#8217;s DNS server doesn&#8217;t support), but even when I allowed fallback, it still didn&#8217;t work.  No idea what&#8217;s going on, but I have to assume it&#8217;s a bug in <code>systemd-resolved<\/code>.<\/p>\n<p>Having said that, I can still use <code>systemd-networkd<\/code> and <code>systemd-resolved<\/code> to control <code>\/etc\/resolv.conf<\/code> (i.e. have it point to my router&#8217;s DNS server).  I just want things to skip trying to use <code>systemd-resolved<\/code>, so that means removing <code>resolve<\/code> from <code>\/etc\/nsswitch.conf<\/code>, so everything always falls back to DNS, which properly resolves my unqualified domains names:<\/p>\n<p>Before:<br \/>\n<code><br \/>\nhosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns<br \/>\n<\/code><br \/>\nAfter:<br \/>\n<code><br \/>\nhosts: files mdns4_minimal [NOTFOUND=return] dns<br \/>\n<\/code><\/p>\n<p>When <code>nsswitch<\/code> falls back to DNS, it properly resolves <code>bruce.<\/code> to its IP on my router&#8217;s subnet, not 127.0.0.1, so that&#8217;s good enough to fix this problem.<\/p>\n<p>Another alternative might be to have my router&#8217;s DNS server put all the names in a LAN domain, and configure <code>systemd-resolved<\/code> to try to append that domain&#8230;but I&#8217;m fed up.<\/p>\n<h2>ssh doesn&#8217;t resolve my local machine names<\/h2>\n<p>This was actually the same root cause as the <code>sslh<\/code> issue above, so once I got that solution in place, it worked.<\/p>\n<h2>Third-party repos<\/h2>\n<p>During the upgrade, third-party apt repositories are disabled.  This was just an exercise in replacing &#8220;wily&#8221; with &#8220;yakkety&#8221; in the repo configs, then running <code>sudo apt-get update && sudo apt-get upgrade<\/code><\/p>\n<p>Most of the repos support yakkety, but a couple (handbrake, mediaelch, dropbox) only had xenial.<\/p>\n<h2>PHP <code>short_open_tag<\/code><\/h2>\n<p><code>php7.0<\/code> is configured with this by default:<br \/>\n<code>short_open_tag = Off<\/code><br \/>\nWith <code>php5<\/code>, I had changed it to this (but <code>php7.0<\/code> uses different config files, so there was no conflict at package install time):<br \/>\n<code>short_open_tag = On<\/code><br \/>\nI  modified both of these files to turn the option <code>On<\/code>:<br \/>\n<code><br \/>\n\/etc\/php\/7.0\/apache2\/php.ini<br \/>\n\/etc\/php\/7.0\/cli\/php.ini<br \/>\n<\/code><\/p>\n<h2>MySQL connection errors<\/h2>\n<p>Some of my php scripts give this:<br \/>\n<code>Unable to connect to database [No such file or directory]<\/code><br \/>\nLooks like a MySQL problem&#8230;phpmyadmin won&#8217;t connect either.<br \/>\nI found <a href=\"http:\/\/askubuntu.com\/a\/762775\">this thread<\/a> and realized that the solution was trivial (and so dumb that the setting wouldn&#8217;t carry over from before):<br \/>\n<code><br \/>\n> sudo systemctl is-enabled mysql.service<br \/>\ndisabled<br \/>\n> sudo systemctl enable mysql.service<br \/>\nSynchronizing state of mysql.service with SysV service script with \/lib\/systemd\/systemd-sysv-install.<br \/>\nExecuting: \/lib\/systemd\/systemd-sysv-install enable mysql<br \/>\n> sudo systemctl is-enabled mysql.service<br \/>\nenabled<br \/>\n> sudo systemctl is-active mysql.service<br \/>\ninactive<br \/>\n> sudo systemctl start mysql.service<br \/>\n> sudo systemctl is-active mysql.service<br \/>\nactive<br \/>\n<\/code><\/p>\n<h2>PHP <code>mysql<\/code> module deprecated<\/h2>\n<p>Some of my other PHP sites were still broken&#8230;because they removed the <code>mysql<\/code> component in php7.0 in favor of <code>mysqli<\/code>.  (Yes, I know I should have switched ages ago&#8230;)  I found a <a href=\"https:\/\/github.com\/philip\/MySQLConverterTool\">converter script<\/a> that seems to have done a good job converting my code automatically.<\/p>\n<h2>More PHP issues<\/h2>\n<p>Apparently, in a piece of code, I was using <code>break<\/code> to try to jump to the end of an <code>if<\/code> block.  <code>php7.0<\/code> gives an error for this.  Since my code was just trying to handle an error case that I don&#8217;t think I&#8217;ve ever seen, I changed it to <code>die<\/code>.<\/p>\n<h2>More MySQL issues<\/h2>\n<p>MySQL now sets the <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/sql-mode.html#sqlmode_only_full_group_by\">ONLY_FULL_GROUP_BY<\/a> option, which broke some of my queries.  Basically, I had a query where I knew that all of the values for a particular column would be the same within a group.  Older versions of MySQL would let you put that column in the SELECT list, and it would just arbitrarily pick one of the values.  This is no longer allowed.  Again, since I know all the values are the same, I just substituted <code>SELECT column_name<\/code> with <code>SELECT MAX(column_name) AS column_name<\/code>, and it worked fine.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>Canonical recently dropped official support for Ubuntu 15.10 &#8220;Wily Werewolf&#8221;, so I decided to upgrade. I also don&#8217;t like being stuck on Long-Term-Support releases, so I did 2 upgrades in sequence: 15.10 &#8220;Wily Werewolf&#8221; to 16.04 &#8220;Xenial Xerus&#8221; to 16.10 &#8220;Yakkety Yak&#8221;. In the past, I&#8217;ve just done a clean install, but the trouble with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[11,15],"tags":[],"class_list":["post-622","post","type-post","status-publish","format-standard","hentry","category-linux","category-trial-and-error"],"_links":{"self":[{"href":"http:\/\/www.mjblythe.com\/hacks\/wp-json\/wp\/v2\/posts\/622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.mjblythe.com\/hacks\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.mjblythe.com\/hacks\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.mjblythe.com\/hacks\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.mjblythe.com\/hacks\/wp-json\/wp\/v2\/comments?post=622"}],"version-history":[{"count":35,"href":"http:\/\/www.mjblythe.com\/hacks\/wp-json\/wp\/v2\/posts\/622\/revisions"}],"predecessor-version":[{"id":693,"href":"http:\/\/www.mjblythe.com\/hacks\/wp-json\/wp\/v2\/posts\/622\/revisions\/693"}],"wp:attachment":[{"href":"http:\/\/www.mjblythe.com\/hacks\/wp-json\/wp\/v2\/media?parent=622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.mjblythe.com\/hacks\/wp-json\/wp\/v2\/categories?post=622"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.mjblythe.com\/hacks\/wp-json\/wp\/v2\/tags?post=622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}