SELinux is preventing mpd from getattr access on the directory /root/.config.

What? Why does mpd want to access /root/.config? What’s MPD? It’s a daemon for playing music. It runs as a service, which I connect to with either ncmp or ncmpcpp. Here’s the full SETroubleshoot detail: SELinux is preventing mpd from getattr access on the directory /root/.config. ***** Plugin catchall (100. confidence) suggests ************************** If you believe that mpd should be allowed getattr access on the .config directory by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # ausearch -c 'mpd' --raw | audit2allow -M my-mpd # semodule -X 300 -i my-mpd.pp Additional Information: Source Context system_u:system_r:mpd_t:s0 Target Context unconfined_u:object_r:config_home_t:s0 Target Objects /root/.config [ dir ] Source mpd Source Path mpd Port Host watamem.local Source RPM Packages Target RPM Packages Policy RPM selinux-policy-3.13.1-283.26.fc27.noarch Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Host Name watamem.local Platform Linux watamem.local 4.15.4-300.fc27.x86_64 #1 SMP Mon Feb 19 23:31:15 UTC 2018 x86_64 x86_64 Alert Count 2 First Seen 2018-03-01 19:37:10 AEDT Last Seen 2018-03-01 19:40:15 AEDT Local ID 95638a12-2d84-4060-9339-8f05c61c619e Raw Audit Messages type=AVC msg=audit(1519893615.831:1060): avc: denied { getattr } for pid=23997 comm="mpd" path="/root/.config" dev="dm-0" ino=1703951 scontext=system_u:system_r:mpd_t:s0 tcontext=unconfined_u:object_r:config_home_t:s0 tclass=dir permissive=0 Hash: mpd,mpd_t,config_home_t,dir,getattr The version of MPD that causes this issue is: 0.20.10 on Fedora 27. I’m pretty sure it was working last week and I didn’t have to do anything. So what’s changed? Well, it seems like this could be a very old problem as reported int bug 1325502. Basically, when mpd is started, it tries to read the MPD configuration file (mpd.conf). According to the man page for mpd.conf, the configuration file should be read in the following order: ...

March 2, 2018 · 4 min · 726 words · kenno

FreeBSD 12 : Can't update packages size mismatch

It’s another night with another FreeBSD problem. Well, I could just use Linux like Ubuntu or Void, but then things would just work. Where is the fun? 😉 So, I’ve been having problem with upgrading or installing new binary packages on a machine running FreeBSD 12.0 for a few days now. root@vansota:~ # pkg upgrade Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. Checking for upgrades (13 candidates): 100% Processing candidates (13 candidates): 100% The following 6 package(s) will be affected (of 0 checked): New packages to be INSTALLED: p5-Locale-gettext: 1.07 Installed packages to be REINSTALLED: xorg-server-1.18.4_6,1 (needed shared library changed) xf86-input-synaptics-1.9.0 (options changed) texinfo-6.5,1 (options changed) m4-1.4.18,1 (options changed) help2man-1.47.5 (options changed) Number of packages to be installed: 1 Number of packages to be reinstalled: 5 The process will require 2 MiB more space. 3 MiB to be downloaded. Proceed with this action? [y/N]: y [1/6] Fetching xorg-server-1.18.4_6,1.txz: 100% 1 MiB 184.0kB/s 00:08 pkg: cached package xorg-server-1.18.4_6,1: size mismatch, fetching from remote [2/6] Fetching xorg-server-1.18.4_6,1.txz: 18% 272 KiB 180.2kB/s 00:08 ETA First I’d thought it was just some FreeBSD mirrors were out of sync of each others. This happens quite frequently with Ubuntu mirrors. Usually, we give it a bit of time and the problem will fix itself. ...

February 15, 2018 · 4 min · 727 words · kenno

Fix: Fail running Firefox on FreeBSD without D-Bus running

This weekend I replaced Kubuntu 16.04 with FreeBSD 12 on an old HP laptop. I came across with lots of problems, but mainly because I wanted to have some experiences with UEFI and GPT. Anyway, currently the laptop is running FreeBSD 12-current with i3 as the windows manager. After Firefox was installed, I ran it from the menu (rofi) and nothing appeared. So I ran it from a terminal instead. Here was the output: ...

February 11, 2018 · 1 min · 180 words · kenno

Create a FreeBSD install disk with dd on OS X

I need to create a bootable FreeBSD install disk and the downloaded file happened to be on a Mac laptop. Since OS X is based on BSD, it also comes with dd utility. After a USB is inserted, I need to identify the disk. This can be done using diskutil command: $ sudo diskutil list /dev/disk0 (internal): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme 251.0 GB disk0 1: EFI EFI 314.6 MB disk0s1 2: Apple_APFS Container disk1 250.7 GB disk0s2 /dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +250.7 GB disk1 Physical Store disk0s2 1: APFS Volume Macintosh HD 98.6 GB disk1s1 2: APFS Volume Preboot 21.4 MB disk1s2 3: APFS Volume Recovery 509.8 MB disk1s3 4: APFS Volume VM 3.2 GB disk1s4 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: Apple_partition_scheme *2.1 GB disk2 1: Apple_partition_map 4.1 KB disk2s1 2: Apple_HFS 2.4 MB disk2s2 From the above output, the USB drive is /dev/disk2. Now, I can use dd to copy the image file to the USB drive using the following command: ...

February 9, 2018 · 1 min · 199 words · kenno

MySQL server has gone away – how to get it back

Has MySQL/MariaDB server ever run away from you? If it hasn’t, you’re lucky or you’re likely to use PostgreSQL instead. Today I’m trying to restore a database from backup (database dump) onto a new MariaDB server. This is what happened: # mysql -u db_user -p db4 < db4-4.4.2_02-08-2018.sql Enter password: ERROR 2006 (HY000) at line 354: MySQL server has gone away The database size is 1.7G, and this should not surprised a database administrator. But it did surprise me because: firstly I’m not a db admin, and secondly I had this issue before just a few weeks ago. So here is a blog post to make sure I won’t forget it for the 3rd time. Basically, I just need to increase the max_allowed_packet size from the default 16MB to something bigger. I chose 128MB. ...

February 8, 2018 · 1 min · 182 words · kenno