Deleting a Partition on USB Flash Disk – Linux

Problem

I would always get the error below when trying to delete a partition on a USB flash disk:

Error deleting partition /dev/sdb2: Command-line `parted --script "/dev/sdb" "rm 2"' exited with non-zero exit status 1: Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes.
(udisks-error-quark, 0) 

Solution

According this answer on askubuntu, the above “was caused by a low-level device tool (like dd) writing blocks at the wrong size directly onto the device.

There are a number of solutions offered, like using dd. The safest, maybe using fdisk as described:

user@whiscardz ~ $ sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
Disk /dev/sdb: 14.9 GiB, 15955132416 bytes, 31162368 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x60dfafa1

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 0 2156351 2156352 1G 7 HPFS/NTFS/exFAT
/dev/sdb2 2135488 2140031 4544 2.2M ef EFI (FAT-12/16/32)

Command (m for help): d
Partition number (1,2, default 2): 1

Partition 1 has been deleted.

Command (m for help): d
Selected partition 2
Partition 2 has been deleted.

Command (m for help): p
Disk /dev/sdb: 14.9 GiB, 15955132416 bytes, 31162368 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x60dfafa1

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

References

Unable to delete USB Drive partitions (Block size error)

Change MySQL root password on Windows

Problem

Needed to reset the MySQL root password on a windows machine.

Solution

Got this solution from this stack overflow answer: Resetting ROOT password in MySQL 5.6

0) shut down service mysql56

1) go to C:\ProgramData\MySQL\MySQL Server 5.6, note that ProgramData is a hidden folder (confirm this is the directory MySQL is installed on Windows by go to the Services Window and check the properties of the mysql service)

2) looking for file my.ini, open it and add one line skip-grant-tables below [mysqld],save

[mysqld]

skip-grant-tables 

3) start service mysql56

4) by right, you can access the database, run mysql

5) and use the query below to update the password

update mysql.user set password=PASSWORD('NEW PASSWORD') where user='root';

6) shut down the service again, remove the line skip-grant-tables save it, and start the service again. try to use the password you set to login.

References

Resetting ROOT password in MySQL 5.6

Ubuntu Hash-Mismatch Error

Problem

On ubuntu 16.04 I was getting the following error when I do apt-get update:

whiscard@whiscardz ~ $ sudo apt-get update
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Err:13 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
Hash Sum mismatch
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [456 kB]
Fetched 821 kB in 4s (171 kB/s)
Reading package lists... Done
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/binary-amd64/by-hash/SHA256/1e7c9b3642cbcdd21de161a4b13b6af5342441439eea597dd8d4246c8d72db07 Hash Sum mismatch
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/universe/binary-amd64/by-hash/SHA256/8660f9a78841c033023106f0d388dbd7864007d132455a788b458c6c2e62a8d0
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/universe/binary-i386/by-hash/SHA256/89ea489c0112ad76835e8856c598ca9024bee50497b7f2ae6b982effef27e545
E: Some index files failed to download. They have been ignored, or old ones used instead.

Solution

The solution was to first clear out the local repository and then delete the contents of /var/lib/apt/lists/ and then resynchronize the package index files from their sources so:

whiscard@whiscardz ~ $ sudo apt-get clean
whiscard@whiscardz ~ $ sudo rm -rf /var/lib/apt/lists/*
whiscard@whiscardz ~ $ sudo apt-get update

[update]

Removing the package cache and then apt-get clean also worked

Resources

How do you fix apt-get update “Hash Sum mismatch”

How do I fix APT errors “W: Failed to fetch […] Hash Sum mismatch”?

“Hash Sum mismatch” errors from apt-get when using apt-cacher-ng

Windows Server Task Scheduler Error: 2147943726

Problem

A database backup using the Task Scheduler Stopped running and it was throwing this error:

Task Scheduler failed to start “\Fence Check Rota” task for user “xxx-xxx\xxx”. Additional Data: Error Value: 2147943726.

Solution

According to this answer in the Microsoft blog, the issue could have been caused by a change in password for the user meant to run the scheduled task. Solution explained is as follows:

  • in task scheduler, click on the scheduled job properties >>> then settings
  • iin the last listed option:
    “if the task is already running, the following rule appplies:”
    select “stop the existing instance” from the drop down list.
  • when you click save you will be prompted for a password. Enter it and then exit.
  • Run the scheduled task and see if it works.

Sources

Task Scheduler failed to start. Additional Data: Error Value: 2147943726. What does this mean?

 

Add MySQL.cnf file to Mac OS Homebrew MySQL Install

Problem

Installed MySQL using homebrew but this did not create a my.cnf file by default.

Solution

Copied the example of my.cnf file in the cellular mysql path (/usr/local/Cellar/mysql/5.x.xx/support-files) to (/etc) having added the sql_mode explained in the MySQL 5.7 customizations

 $ cp /usr/local/Cellar/mysql/5.7.17/support-files/my-default.cnf /etc/my.cnf 

Open the my.cnf and add the sql_code variable as explained in the MySQL 5.7 customizations post.

Sources

MySQL my.cnf location on OS X?

How do I find where MySQL is loading its config from?