Ubuntu 管理心得

搜尋此網誌

2022年11月25日 星期五

Reinstall samba

sudo purge samba
sudo remove samba
sudo aptitude to reinstall samba

Matplotlib error due to font size: type1ec.sty not found

sudo apt install cm-super

2022年11月17日 星期四

mount image img file

 cf: https://coldnew.github.io/ff159f7c/

  1. sudo fdisk -u -l pi3_20221116.img
    The outputs are
    ...
    所用裝置          可開機  Start     結束     磁區  Size Id 類型
    pi3_20221116.img1          8192   532480   524289  256M  c W95 FAT32 (LBA)
    pi3_20221116.img2        540672 30881791 30341120 14.5G 83 Linux

    Get the Start block 540672 for partition 2
  2. sudo mount -o loop,offset=$((540672 * 512)) pi3_20221116.img /mnt/myimg

The script file: (cf: https://github.com/AlexanderAmelkin/mountimg/blob/master/mountimg

#!/bin/bash
IMAGE="$1"
PART="$2"
WHERE="$3"
shift 3

OPTIONS="$*"

if [ ! -f "$IMAGE" ] || [ -z "$PART" ] || [ -z "$WHERE" ]; then
    echo "Disk image partition mounter by Alexander Amelkin."
    echo "Version 1.0"
    echo
    echo "Usage: mountimg <image> <partition> <where> [<mount options>]"
    echo "Example: mountimg sdcard.img 1 /mnt/sdcard0p1 -t vfat -o ro,codepage=866,iocharset=utf-8"
    exit 1
fi

# Now find the first unused loop device and use it
OFFSET=$(
    sfdisk -l $IMAGE |
    grep $IMAGE$PART |
    awk 'BEGIN { FS="[ *\t]+"}
         /.+/ { print $2; found=1 }
         END { if(!found) exit 1 }'
    ) || { echo "No such partition in the image"; exit 1; }

echo "Mounting $IMAGE partition $PART (offset $OFFSET) to $WHERE via $LODEV"

set -e

mount $OPTIONS -o loop,offset=$((OFFSET * 512)) $IMAGE $WHERE

2022年11月16日 星期三

PhpOffice\PhpSpreadsheet\Spreadsheet' not found

composer require phpoffice/phpspreadsheet



You have requested a non-existent service "user.private_tempstore"

Change this line:

$tempstore = \Drupal::service('user.private_tempstore')->get('appraisal_edit');

into

$tempstore = \Drupal::service('tempstore.private')->get('appraisal_edit');



2022年11月7日 星期一

Disable php7.4-fpm.conf, enable php8.1-fpm.conf

sudo a2disconf php7.4-fpm.conf
sudo a2enconf php8.1-fpm.conf

2022年11月3日 星期四

Upgrade Mac OS X stuck hung at progress bar

cf: https://www.sysprobs.com/macos-13-ventura-vmware-pre-installed-image-download-windows-11-10 

This links also contains the download urls for Ventura vmware image (worked!)

  1. Poweroff the virtual guest (not workstation)
  2. Add this line into vmx file, e.g. Monterey.vmx
    smc.version= "0" 
  3. Change the line as follows:
    #ethernet0.virtualDev = "e1000e"
    ethernet0.virtualDev = "vmxnet3"
  4. Save and restart guest.
  5. If it is successfully opened, but the mouse and keyboard are not working, then change the USB version in VM settings to USB3.1.
  6. Viola!

 

網誌存檔