Adding external storage in Nextcloud fails with “wrong password”

If you are having trouble with adding external storage mounts in Nextcloud, you can do this:

$ sudo -u www-data php occ files_external:list

You can see the bad external mounts and delete it with:

$ sudo -u www-data php occ files_external:delete X

Then, you can re-create good ones by using this command:

$ sudo -u www-data php occ files_external:create Blabla ‘smb’ password::password -c host=X.X.X.X -c share=X -c root=/X -c domain=workgroup -c user=X -c password=X

You can add applicable users to the mount using this command:

$ sudo -u www-data php occ files_external:applicable --add-user=X

Replace: X with Yours.

Reference

https://help.nextcloud.com/t/add-external-storage-failed-at-action-needs-authentication-failed-wrong-password/213089/6

Setting Up Nextcloud in a Docker Container

Use the following to set up Nextcloud in a Docker Container:

version: '3.9'
services:
  mariadb:
    image: mariadb:latest
    container_name: Nextcloud-DB
    security_opt:
      - no-new-privileges:true
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-read-only-compressed=OFF
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=[PASSWORD]
      - MYSQL_PASSWORD=[PASSWORD]
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - TZ=America/Los_Angeles
    volumes:
      - /volume1/docker/nextcloud/mariadb:/config
    restart: on-failure:5

  redis:
    image: redis:latest
    container_name: Nextcloud-REDIS
    hostname: nextcloudredis
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping || exit 1"]
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Los_Angeles
    volumes:
      - /volume1/docker/nextcloud/redis:/data:rw
    restart: on-failure:5

  nextcloud:
    image: nextcloud:latest
    container_name: Nextcloud
    ports:
      - 9333:80
    depends_on:
      mariadb:
        condition: service_started
      redis:
        condition: service_healthy
    healthcheck:
      test: curl -f http://localhost:80/ || exit 1
    environment:
      - REDIS_HOST=nextcloudredis
      - NEXTCLOUD_TRUSTED_DOMAINS=[DOMAIN] 10.0.1.9
      - TRUSTED_PROXIES=[DOMAIN] 10.0.1.9
      - OVERWRITEHOST=[DOMAIN]
      - OVERWRITEPROTOCOL=https
      - MYSQL_PASSWORD=[PASSWORD]
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=mariadb
    volumes:
      - /volume1/docker/nextcloud/html:/var/www/html:rw
      - /volume1/docker/nextcloud/custom_apps:/var/www/html/custom_apps:rw
      - /volume1/docker/nextcloud/config:/var/www/html/config:rw
      - /volume1/docker/nextcloud/data:/var/www/html/data:rw
      - /volume1/docker/nextcloud/themes:/var/www/html/themes:rw
    restart: on-failure:5

  cron:
    image: nextcloud:apache
    container_name: Nextcloud-CRON
    restart: always
    volumes:
      - /volume1/docker/nextcloud/config:/var/www/html/config:rw
      - /volume1/docker/nextcloud/html:/var/www/html:rw
      - /volume1/docker/nextcloud/custom_apps:/var/www/html/custom_apps:rw
      - /volume1/docker/nextcloud/data:/var/www/html/data:rw
    entrypoint: /cron.sh
    depends_on:
      mariadb:
        condition: service_started
      redis:
        condition: service_started

  proxy:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: Nextcloud-PROXY
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - /volume1/docker/nextcloud/proxy/data:/data
      - /volume1/docker/nextcloud/proxy/letsencrypt:/etc/letsencrypt

Source

https://github.com/docker/awesome-compose/tree/master/nextcloud-redis-mariadb

Change Boot Order to USB Raspberry Pi 5 (w/NVME)

I have my raspberry pi 5 hooked up to an nvme via pcie. When I pull up raspi-config the only options are to boot nvme first or sd first. However I need an option to boot usb first followed by nvme. The case I’m using doesn’t provide access to the micro sd card slot.

I’ve tried finding the setting in raspi-config, but no luck.
I’ve tried changing the boot order manually by editing eeprom and this worked:

$ sudo rpi-eeprom-config --edit
BOOT_UART=1
POWER_OFF_ON_HALT=0
BOOT_ORDER=0xf164

Reference

https://forums.raspberrypi.com/viewtopic.php?t=366106

Booting the Pi from a GPT partitioned USB Disk

The Pi will boot from a USB drive formatted with GPT. I took the following steps – there may be a better/more efficient way, but this works as a proof of concept:

1. Find out the size of your /boot partition, in sectors. If you’re currently booting from SD, “sudo fdisk -l /dev/mmcblk0p1” will tell you this; mine was 524288 sectors (with a sector size of 512 bytes).
2. Partition your USB drive using the GPT scheme in fdisk. This will erase everything on the drive, so make sure there’s nothing on there that you need.
3. Create a first partition at the beginning of the disk, and be sure it’s the same size in sectors as your existing boot partition.
4. Set the first partition’s type to “Microsoft basic data” (type number 11)
5. Create a partition for your root filesystem to live on, plus any other partitions you want.
6. Unmount your boot partition and use dd to copy it over: “sudo dd if=/dev/mmcblk0p1 of=/dev/sda1” Replace the partition names with your actual partitions if they differ.
7. Format your new root filesystem, ready to accept data, eg “mkfs.ext4 /dev/sda2” (assuming sda2 is your new root partition)
8. Copy across your existing filesystem:

$ sudo mkdir -p /mnt/new
$ sudo mount /dev/sda2 /mnt/new
$ sudo rsync -avHAX / /mnt/new/ --exclude=/boot --exclude=/mnt --exclude=/dev --exclude=/proc --exclude=/sys
$ sudo mkdir -p /mnt/new/{boot,mnt,dev,proc,sys}
$ sudo mount /dev/sda1 /mnt/new/boot

9. Edit /mnt/new/boot/cmdline.txt and change “root=/dev/mmcblk0p1” to “root=/dev/sda2”
10. Edit /mnt/new/etc/fstab and change the lines with /dev/mmcblk0* to use /dev/sda* instead.

The USB drive now contains a clone of your Pi filesystem – turn off the Pi, take out the SD card, and when you turn it back on it should boot up exactly as normal, except from your nice big new drive!

If you need to rename your Linux user, just issue the following commands after logging in as the root user:

# usermod -l <new-name> <old-name>
# usermod -d /home/<new-name> -m <new-name>
# groupmod -n <new-name> <old-name>

Reference

https://forums.raspberrypi.com/viewtopic.php?t=319435