Friday 15 November 2019

Chuwi Minibook First Look

Received my Chuwi Minibook (crowdfunded on Indiegogo) and have been having a play so here are my first thoughts. For my basic setup I am more-or-less duplicating the configuuration I used for my GPD Pocket with updated versions of the packages in question.

I ordered the M3-8100Y version with 16GB of RAM. However, I did not order any additional SSD since I intended to use an M.2 PCI-E MicroSD adapter for an internal drive. This means I can just take the internal MicroSDXC from my GPD Pocket rather than having to copy anything. The card also draws at most maybe 0.5W as a storage device which is a lot less than an equivalent SATA or NVME SSD. Yes, it's slow but I seriously don't notice that much since I'm not a gamer.

Some observations about the Minibook.
  1.   Chuwi have configured M3-8100Y with TDP-up settings that give a minimum turbo of 1.6GHz. It would be great if this was configurable in a future BIOS with the options of regular TDP (1.1GHz) and TDP-down (800MHz) for those of us who want to extend battery life. I'll detail my experiments with Throttlestop in this area down below.
  2. It's annoying that the minimum PD power requirements is 24W (12Vx2A) rather than 18W (9Vx2A) since there are a lot of 18W adapters and power packs around. Not sure whether this might be adjustable or is hard wired. On the other hand, it makes sense considering the potential maximum power draw of the Minibook (15W peak TDP for the CPU alone).
  3. It would be nice if the default keyboard light status could be configured in the BIOS to Off/On/Last Setting for mainly for resumption from suspend/hibernate.
  4. The screen is a seriously shiny fingerprint magnet and I'm still looking for a good oleophobic matt screen protector in the UK. I ordered at AtFoliX one from eBay and it was far too big.
  5. The Intel drivers for the M3-8100Y seem to handle external displays very badly - the GPD Pocket was painless but getting scaling and orientation right with the new control panel doesn't really work.
Now, on to my Throttlestop configuration (I have yet to try XTU)...
  1. I have downvolted the CPU core by 100mV and the CPU cache by 50mV to reduce power consumption. This works for me but depends on your CPU. This works for all frequency settings.
  2. I have left the TDP limits as they were, since they can't be configured per profile in Throttlestop. Instead I use turbo frequency limits to control power consumption. I haven't fiddled with GPU settings since I don't really game that much - so its power consumtpion is generally minimal. Geekbench 4 figures are in [brackets].
  3. Profile 1 is 1.6gGHz limit for both single and dual core turbo (this is as low as it goes) and is the default I use when on battery. Power consumption seems to be around 3.5W peak (CPU only). [2207/3845]
  4. Profile 2 is 1.8/2.2GHz and with a CPU peak power of around 5W. The fan doesn't seem to spin up at this level and keeps things quiet. [2798/4807]
  5. Profile 3 is 2.2/2.7GHz, with a CPU peak power of around 7W. The fan spins up but is generally not too obtrusive. This is my default when plugged in. [3289/5706]
  6. Profile 4 is the default 2/7/3.4Ghz that the Minibook comes with. With undervolting I am seeing a peak of maybe 10W here but the fan does get noisy. [3939/6771]
I have yet to do any thermal mods so there's still more scope for noise limiting. Battery life for Profile 1 running the CPU flat out, display brightness 40% and keyboard light off is around 2.5-3 hours. Idle CPU power draw is around 0.5W so there is scope for quite good longevity under normal use.

For those of you with NVME drives that draw 4+W, default CPU settings and Windows Update/Indexing thrashing both, I'm not surprised battery life is short. Once Windows settles down things will improve a lot but a heavily used power hungry SSD could easily halve battery life.    

Sunday 27 January 2019

Nextcloud on OpenSuse 15.0 Part 2

Now we've got the latest Nextcloud (15.X) running more or less satisfactorily on OpenSuse 15.0, it's now time to do a bit more detailed configuration.

First of all we need to set up a cron job to do the regular housekeeping that nextcloud needs. Currently, it kicks off this activity whenever a page loads but as more content gets added this begins to become a bottleneck. So, in a terminal session do the following as root:
  1.  crontab -u wwwrun -e
  2. This brings up an editor (vim) for the cron jobs assigned to the user wwwrun (which is the account nextcloud runs under). The editor commands are somewhat cryptic...to go into insert mode, press i and the cursor will move to the top of the screen
  3. Enter (or cut and paste) the following: */5  *  *  *  * php -f /srv/www/htdocs/nextcloud/cron.php
  4. Do not press Enter! 
  5. Now you are done, press Escape to get out of editing mode and then :q to quit and save.
  6. This will have scheduled the Nextcloud housekeeping to run every 5 minutes
Now, we need to tell Nextcloud that what has been done.
  1. In a browser, log into Nextcloud as the admin and navigate to the Settings | Basic Settings screen
  2. In the top Background Jobs section, click on Cron (you have to enter the admin password again to confirm).
Now it makes sense to update the Nextcloud config to ready for external access.
  1. Navigate to /srv/www/htdocs/nextcloud/config/ and open config.php in kate (or your text editor of choice).
  2. In the trusted domains_array add some entries after 0 => 'localhost', so that the Nextcloud server will work when accessed via other URL's besides localhost. I would suggest the following (adapted to your setup)...
    1. 1 => 'the-ip-address-of-the-server',
    2. 2 => 'servername.domain.com',
    3. 3 => 'servername.localdomain',

Saturday 26 January 2019

NextCloud on OpenSuse 15.0

Most of the install guides (https://en.opensuse.org/SDB:Nextcloud and https://en.opensuse.org/SDB:LAMP_setup) use the command-line but a lot can be done using Yast. Do this logged on as root or else you will need to enter the root password a lot and preface command line instructions with sudo.
  1. Get the LAMP stack is installed and running...
    1. Yast | Software | Software Management | View | Patterns
    2. Tick Web and LAMP Server under Server Functions and press Accept
    3. Yast | System | Services Manager
    4. Select apache2  set the Start Mode to On Boot, and then press Start to start it immediately. Repeat for mariadb. Then press Ok.
  2. Get MariaDB set up properly...
    1. Fire up a terminal session and run mysql_secure_installation
    2. Press enter since there is no current MariaDB root password and then select Y to set one - enter your new MariaDB root password twice
    3. Select Y for the rest of the options
  3. Set up a database for Nextcloud...
    1. Fire up a terminal session (or keep using the previous one) and run mysql -u root -p
    2. You will be prompted for the password you entered above
    3. To create the database type create database nextcloud; and then press Enter. Don't forget the semicolon at the end.
    4. Then create a user ID and password for Nextcloud to access the database. Type create user ncdbuser@localhost identified by 'your-password-here'; and then press Enter
    5. Now give the Nextcloud ID access to the database. Type grant all privileges on nextcloud.* to ncdbuser@localhost identified by 'the-same-password-above'; and then press Enter
    6. Now type exit; and press Enter to finish
  4. Enable PHP so that Nextcloud can run
    1.  Fire up a terminal session (or keep using the previous one) and run a2enmod php7
    2. Then restart the apache webserver with apachectl restart
  5. Now install Nextcloud. The version that install with OpenSuse 15.0 is 13.0.2 but, as of writing 13.0.8 is in the update repository. If you have a vanilla install of OpenSuse the Update Repositories should already added to the Software Management module.
    1. Yast | Software | Software Management | Search | nextcloud
    2. Tick nextcloud and then press Accept
    3. A whole load of dependencies will display, press Continue
  6. Now configure Nextcloud.
    1. Fire up a web browser and navigate to locahost/nextcloud
    2. You should see a login screen as asking you to create an admin account and password for Nextcloud. Enter a new user ID and password here (these should be different from the previous userID's and passwords). DO NOT PRESS the Finish Setup button yet!
    3. Select MySQL as the database and boxes for entering the details entered in section 3 will appear ("ncdbuser", "your-password", "nextcloud" and "localhost").
    4. Then you can press the Finish Setup button 
  7. You will now be logged in to Nextcloud as the admin user. Logout (option under the top right icon)
This is an older version of Nextcloud so you need to update but, at least on my install the permissions and a couple of other things are a bit messed up and the online updater won't work. To fix this, do the following in a terminal as root:
  1. cd /srv/www/htdocs
  2. chown wwwrun.www nextcloud
  3. cd nextcloud
  4. chown wwwrun.www * -R
  5. chown wwwrun.www .*
  6. chmod +x occ
  7. rmdir search
Now, in a browser, log in to Nextcloud again as the admin. Do the following...
  1. Click on the top right icon and select Settings
  2. Part way down the screen under the Version heading you should see there is a new version 14.X available (otherwise log on and off again and see if it does a rescan for updates). 
  3. Click to use the Web Updater
  4. You should then allow it to check that the updater will work (if you have reset the permissions above that should go through OK).
  5. Click to carry on with the Web Updater,  you should be taken to an update screen with a list of all the bits to be updated. This is a fresh install so they should all be fine.
  6. Press the button at the bottom to go ahead with the update 
Once that is done you will once more be logged in to the updated Nextcloud instance as an admin. Repeat the above procedure again since there will now be a 15.X update available - at the time of writing that's it, 16.X isn't out yet.

We are not done yet, although we now have Nextcloud 15.X running it now needs a bit of tuning...
  1. In the browser, go to the menu top right and select Settings. Under the Overview | Security and Setup Warnings there is a short list of things to fix...
  2. First of all get the database straightened out after the upgrades. In a terminal, logged on as root, do the following
    1. cd /srv/www/htdocs/nextcloud
    2. sudo -u wwwrun ./occ db:add-missing-indices
    3. sudo -u wwwrun ./occ db:convert-filecache-bigint
    4. The last command will warn you about taking hours, it won't since the install is fresh, so press Y
  3. When running these commands you will notice them complaining about the PHP memory limit so lets change that.
    1. In Dolphin, navigate to /etc/php7/apache2 and click on php.ini. It should open in the kate text editor. 
    2. Scroll down until you find the line memory_limit = 128M and change it to memory_limit = 512M
    3. Save the file and exit
    4. Now navigate to /etc/php7/cli and repeat the process there.
  4. Now lets set up some caching to improve performance...
    1. In Yast go to Yast | Software | Software Management | Search | apcu and check php7-APCu
    2. Then search for php7-opcache and check it
    3. Press Accept to install the packages
    4. In Dolphin, navigate to /etc/php7/apache2 and click on php.ini. It should open in the kate text editor. 
    5. Scroll down until you find the [opcache] section. Remove the leading semicolon and edit (if required) the following lines:
      1. opcache.enable=1
      2. opcache.enable_cli=1
      3. opcache.memory_consumption=128
      4. opcache.interned_strings_buffer=8
      5. opcache.max_accelerated_files=10000
      6. opcache.revalidate_freq=1
      7. opcache.save_comments=1
    6. Now add a new section [apc] at the end with the line apc.enable_cli=1
    7. Save the file and exit
    8. Now navigate to /etc/php7/cli and repeat the process there.
    9. Now navigate to /srv/www/htdocs/nextcloud/config/config.php and open it in the kate editor
    10. Just before the last line add in  'memcache.local' => '\OC\Memcache\APCu',
    11. Save the file
    12. Restart the web server in a terminal using apache2ctl restart
  5. Log on to Nextcloud and there should be a lot less things in the Settings | Overview. I don't care about the CalDav and CardDav issues since it only really affects Apple stuff - which I don't have any of.
However, SSL really does need to be set up, but that is for another posting...

One last thing. I just had a look in the logs and it was full of error messages about using "...a fallback version of the intl extension". Fire up Yast, install php7-intl and then restart apache (again). Problem solved.