Ubuntu keeps on rebooting after enabling TPM 2.0 from BIOS (APTIO utility)

I am having Ubuntu 18.04 LTS installed on to my system. I wanted to implement TPM functionalities. I enabled TPM 2.0 from Trusted Computing option in the BIOS. After this when I rebooted my system, the OS didn’t start. Rather it keeps on rebooting after the American Megatrends screen comes.

The system is stuck in this loop until I disable TPM from the BIOS again.

Really want help to solve this issue.

Stopwatch utility class in Java

Looking for input on my code for a Stopwatch utility written in Java.

/**  * File: Stopwatch.java  */ package org.me.mystuff;  import java.util.concurrent.TimeUnit;  public class Stopwatch {     /**      * The start timestamp, as determined by a call to {@code System.nanoTime}.      */     private long start;      /**      * The total elapsed time recorded so far in nanoseconds (raw value).      */     private long elapsed;      /**      * Whether or not the stopwatch is running.      */     private boolean running;      /**      * Constructs a new {@code Stopwatch} instance.      */     public Stopwatch() {         reset();     }      /**      * Stops time interval measurement, resets the elapsed time to zero, and      * starts measuring time again.      *       * <p>      * This is a convenience method equivalent to calling {@code reset} followed      * by {@code start}.      */     public void restart() {         reset();         start();     }      /**      * Stops time interval measurement and resets the elapsed time value to      * zero.      */     public void reset() {         running = false;         start = 0;         elapsed = 0;     }      /**      * Initializes a new {@code Stopwatch} instance, sets the elapsed time value      * to zero, and starts measuring elapsed time.      *       * @return a running {@code Stopwatch} instance      */     public static Stopwatch startNew() {         final var s = new Stopwatch();         s.start();         return s;     }      /**      * Starts, or resumes, measuring elapsed time for an interval.      */     public void start() {         // Calling start() on a running stopwatch is a no-op.         if (!isRunning()) {             running = true;             start = start <= 0 ? System.nanoTime() : System.nanoTime() - elapsed;         }     }      /**      * Stops measuring elapsed time for an interval.      */     public void stop() {         // Calling stop() on a stopped stopwatch is a no-op.         if (isRunning()) {             elapsed = System.nanoTime() - start;             running = false;         }     }      /**      * Returns the elapsed time measured so far by this stopwatch in the      * specified {@code TimeUnit}.      *       * @param timeUnit      *            the desired time unit      * @return the duration in the specified time unit      */     public double elapsed(TimeUnit timeUnit) {         // If the stopwatch is running, compute and return the current timestamp.         // Otherwise, just return the timestamp as of the last call to stop().         final long duration = isRunning() ? System.nanoTime() - start : elapsed;         return UnitConverter.convert(duration, timeUnit);     }      /**      * Returns {@code true} if the stopwatch is currently running.      *       * @return {@code true} if this stopwatch is running      */     public boolean isRunning() {         return running;     }      /**      * Returns a string representation of the elapsed time measured so far by      * this stopwatch, expressed in milliseconds using two decimal places.      *       * <p>      * Example: 1.2345 milliseconds would return a string equal to      * {@code "1.23 ms"}.      *       * <p>      * This is a convenience method that simplifies querying the stopwatch for      * reporting purposes.      */     @Override     public String toString() {     final double duration = elapsed(TimeUnit.MILLISECONDS);      final double rounded = Math.round(duration * 100d) / 100d;     return String.valueOf(rounded).concat(unit);     }      /**      * This class is an internal utility to supplement the stopwatch's unit      * conversion operations.      */     private static class UnitConverter {         /**          * The number of nanoseconds in a millisecond.          */         static final double NANOS_PER_MILLI = 1e6;          /**          * The number of nanoseconds in a second.          */         static final double NANOS_PER_SECOND = 1e9;          /**          * The number of nanoseconds in a minute.          */         static final double NANOS_PER_MINUTE = 6e10;          /**          * The number of nanoseconds in an hour.          */         static final double NANOS_PER_HOUR = 3.6e12;          /**          * Converts the specified nanosecond value to the specified time unit          * and returns the result.          *           * @param nanoTime          *            the value to convert (in nanoseconds)          * @param toUnit          *            the desired time unit          * @return the converted value          */         static double convert(long nanoTime, TimeUnit toUnit) {             switch (toUnit) {             case MILLISECONDS:                 return toMillis(nanoTime);             case SECONDS:                 return toSeconds(nanoTime);             case MINUTES:                 return toMinutes(nanoTime);             case HOURS:                 return toHours(nanoTime);             default:                 throw new IllegalArgumentException("no valid time unit specified");             }         }          static double toMillis(long nanos) {             return nanos / NANOS_PER_MILLI;         }          static double toSeconds(long nanos) {             return nanos / NANOS_PER_SECOND;         }          static double toMinutes(long nanos) {             return nanos / NANOS_PER_MINUTE;         }          static double toHours(long nanos) {             return nanos / NANOS_PER_HOUR;         }     } } 

The stopwatch uses System.nanoTime as its time source. In general it works similarly to the standard .NET version and is, as far as my unit tests go, correct. You can query it whether or not it is running, and it will give the most recent recorded value each time.

I am just curious to hear some thoughts on my code and suggestions for improvement, if any. It’s extremely lightweight so feel free to test it on your machine if you wish.

Create a new partition with disk utility

I’m running OS X 10.11.6 and I want to create a new partition on my disk (disk0).

Is there a way to first resize the disk to make some space and then add a new partition? When I boot from this disk I get an error message in disk utility. And when I use the Recovery Volume I cannot resize the “pie chart” in disk utility.

 $   diskutil list /dev/disk0 (internal, physical):    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:      GUID_partition_scheme                        *256.1 GB   disk0    1:                        EFI EFI                     209.7 MB   disk0s1    2:          Apple_CoreStorage Mac SSD                 255.1 GB   disk0s2    3:                 Apple_Boot Recovery HD             784.2 MB   disk0s3 /dev/disk1 (internal, virtual):    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:                  Apple_HFS Mac SSD                +254.7 GB   disk1                                  Logical Volume on disk0s2                                  CC5EA835-07C6-4481-8114-493AD10988B7                                  Unlocked Encrypted  
 $   gpt -r show disk0 gpt show: disk0: Suspicious MBR at sector 0       start       size  index  contents           0          1         MBR           1          1         Pri GPT header           2         32         Pri GPT table          34          6                   40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B      409640  498176832      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC   498586472    1531680      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC   500118152          7            500118159         32         Sec GPT table   500118191          1         Sec GPT header 

APFS on external drive missing from Disk Utility

When I use Disk Utility app in macOS Mojave to format an external drive, I do not see the new Apple File System (APFS) offered as a choice of format.

Does it matter that my external drive is a Toshiba Canvio® Advance Portable External Hard Drive plugged into a MacBook Pro Retina (late 2013) via USB-3 cable? I know APFS is optimized for solid-state storage, so does Disk Utility not offer it for a spinning-metal disk drive?

➥ Why is APFS not offered by Disk Utility?

Disk has multiple partitions but Disk Utility can only mount first one

View from Disk Utility: Disk Utility screenshot

Output of diskutil (for this disk only):

/dev/disk6 (external, physical):    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:     FDisk_partition_scheme                        *80.0 GB    disk6    1:               Windows_NTFS                         34.9 GB    disk6s1    2:                      Linux                         10.7 GB    disk6s5    3:                 Linux_Swap                         2.1 GB     disk6s6    4:                      Linux                         32.2 GB    disk6s7 

The first NTFS partition, “–“, mounts just fine as read-only. But I can’t get to either of the Linux partitions. I’ve tried mount, diskutil mount, and diskutil mount readOnly, but but they all result in

Volume on disk6s5 failed to mount If the volume is damaged, try the "readOnly" option If the volume is an APFS Volume, try the "diskutil apfs unlockVolume" verb 

Also tried diskutil apfs unlockVolume, but it’s not an APFS volume. Any ideas? Using macOS Sierra 10.12.6.

Utility of linking to “recent comments” from a blog’s front page?

Quite a few blogs have a section in the right sidebar on the front page which links to the most recent comments, typically citing them by each commenter’s name and the title of the post they commented on.

When I comment on other people’s blogs, I usually return directly to the comments section under an article if I wish to find out whether anyone has replied to my comment. If they replied more than a certain number of comments ago their comment won’t be referenced on the front page anyway.

A cynic would say that the utility of the front-page latest comments section lies mostly in allowing a commenter to feel happy at seeing their name up in lights. But of course that may be exactly the effect that a blog writer seeks. It also kind of shouts out “We get lots of comments traffic, you know”, as if the traffic level were an issue. And if say the latest five comments have all been on the same article, then its title will get shown five times, which doesn’t look nice at all.

On the plus side, visitors can learn from the recent comments section that an old article, or one they haven’t read, is attracting current interest, which might spur them to read it, or at least to read the latest comment on it.

How useful is this device and when?