HP ZBook Studio G4

From RHLUG Wiki
Jump to: navigation, search

Getting Ubuntu to Install and Boot

Installfest PxE (network booting) Notes

PxE does both UEFI/Legacy boot. We had to get the UEFI image of Ubuntu already signed with Secure Boot by Microsoft, if Secure Boot is enabled in your BIOS (all of you have this option enabled by default). It was located in the .tar.gz file one of the packages, I forget which one. We recommend booting using UEFI.

We got a different boot screen that was text based instead of GUI based, and let us select mirror.csse.rose-hulman.edu and /ubuntu/ to download packages and not count against the person using the PXE server's bandwidth.

Installing Ubuntu 18.04 LTS via Flash Drive

Part 1: Pre-installation, .iso/flash drive set up

1. Download the Ubuntu 18.04 LTS ISO image from this website (hosted on-campus at Rose): http://mirror.csse.rose-hulman.edu/ubuntu-releases/bionic/

Since this comes from the CSSE server hosted at Rose, this will NOT count against your bandwidth at Rose.

This will NOT work off campus. If you are off campus, download from the official Ubuntu website: https://www.ubuntu.com/download/desktop

2. If you're using a flash drive, you will need to burn it in GPT format so you can boot from UEFI. If you're on Windows, use Rufus (an application you can download) to burn the flash drive. If you're on Linux, use Etcher (there is a command line interface). Using dd [which is a bit-for-bit copy of the ISO] may cause data loss (unfortunately, it has been reliable sometimes but iffy other times) and I don't recommend it unless you know exactly what you're typing in, and because of how the flash drives/CD-rom drives work to boot into an OS; it's just not optimal to use dd because of the way the OS handles flash drives for booting.

3. After writing the image to the flash drive, safely remove the drive on Windows to avoid damage. If on Linux, you MUST wait 5 seconds to prevent data loss from writing to the flash drive (because of how filesystems work in Linux), THEN unmount or remove the flash drive.

Part 2: Pre-installation, Shrinking the Windows Partition

4. Use Disk Management in Windows: press Windows key, type diskmgmt.msc in the Start menu, and click on the first thing that has a blue gear and white checklist underneath.

5. Then on the Windows (C:) block, right-click on that, and click "Shrink Volume".

You will want to give some disk space for Linux so you can install packages (generally the minimum amount is ~10GB, or ~9537MB (technically MiB, see HP_ZBook_Studio_G4#A_note_on_units_(GiB_vs_GB)), and if you want to install packages, ~20GB or ~19073 MB (technically MiB, see HP_ZBook_Studio_G4#A_note_on_units_(GiB_vs_GB))).

If you can't shrink the partition, use UltraDefrag (https://ultradefrag.net/en/index.shtml) to defragment your SSD/Hard Drive. It is OK to defragment (aka. defrag for short) an SSD, what it does is it removes unused files that the OS left behind when you deleted them. It's just not recommended to do it very often because it can shorten its lifespan. This is why if you have an SSD, what Windows does is instead of defragging it regularly, it "optimizes" it, which is basically running the TRIM command to do a similar thing, but on less parts of the SSD, to increase its lifespan.

6. Before booting Ubuntu, so the partitions are created correctly and nothing goes wrong, disable Fast Startup in Power Management settings, and now SHUT DOWN YOUR COMPUTER COMPLETELY (i.e. don't do a force shutdown, the only ways to completely "shut down" windows are by using use Windows's "shutdown" button (recommended), or by running a command in Command Prompt that shuts your computer down). If you boot into Windows again and you disabled Fast Startup the last time it was COMPLETELY SHUT DOWN, you can now force shut it down if you want to and still be safe.

You can also do the shrinking using the Ubuntu installer (we tested this at Spring 2019 Installfest, and it worked fine), as long as Fast Startup is disabled in Power Management settings, and if this is the first time you disabled it, meaning Windows had Fast Startup still turned on, you completely shut down Windows using use Windows's "shutdown" button or similar (as long as what you did didn't cause your computer to force shutdown while running Windows).

Part 3: Booting and Installation

7. When rebooting, press and hold the ESC key EVEN WHILE the screen is off so you get to the Startup Menu on the HP laptop. Then, go down to boot options/boot menu and select Your Flash Drive Name (UEFI). DO NOT SELECT Your Flash Drive Name (Legacy) or you will not be able to boot Linux after installation.

When you see the "GNU GRUB" bootloader screen, make sure Install Ubuntu is highlighted on screen, THEN press the "e" key on your keyboard. Press the arrow keys to navigate to the line that has "linux" in it, then at the end (the \ indicates a new line, or there is information after that, and is not part of the text that was entered originally), add the following:

acpi_osi=! acpi_osi="Windows 2009"

This needs to be typed EXACTLY like this, with a space after the thing earlier (which was vt_handoff or something like that). Do NOT add anything else to the file or you may encounter weird errors/glitches when booting.

If the computer freezes and doesn't come back up after 3-5 or so minutes, it is safe to force shutdown. The GRUB bootloader (which the Ubuntu installer installed) will start automatically instead of Windows. Press the arrow keys to navigate to either Ubuntu or Windows (it says "Windows Boot Manager").

Then press Ctrl+X to boot into the Ubuntu installer.

8. You will want to keep Windows, just in case you need the software such as Logger Pro, SolidWorks, or Matlab, so you can dual boot by selecting the "Keep alongside Windows Boot Manager" when you get to it. Make sure that no partitions are DELETED if you see a dialog (ones that are added are OK), then click OK. A GRUB bootloader will let you run either Ubuntu or Windows every time you start your computer.

9. (Optional but HIGHLY RECOMMENDED): You will need to connect to Eduroam to get the latest security updates/packages before installing, see Getting_on_eduroam for more details for how to do this. This process is the same as (or similar to) Ubuntu 16.04 LTS (listed on that page), there may be slight differences here and there. We used rose-hulman.edu as the domain. Be sure remember to use your FULL [username]@rose-hulman.edu email address for username (because it's on eduroam so it works at all colleges), or it may not connect!!!

10. You can choose whether to install security updates automatically or not. It's your personal preference. Not installing them automatically can mean (slightly) less breakage/more stability, but you'll have to deal with updates manually. Installing them automatically means you can worry less about checking for important updates.

11. Once you are done installing, you can reboot your computer. See below for how to boot Ubuntu after installation.

Part 4: Booting Ubuntu after Installation

IF YOU ARE RUNNING UBUNTU AT ANY TIME (before you've applied the permanent fix in HP_ZBook_Studio_G4#Part_5:_Fixing_Ubuntu_freezes_(acpi_osi_issue)_permanently, MAKE SURE YOU DO THIS BEFORE BOOTING, or else your computer may freeze/hang and you may need to reboot.

12. When you see the "GNU GRUB" bootloader screen, make sure "Ubuntu 18.04 LTS" or similar is highlighted on screen, THEN press the "e" key on your keyboard. Press the arrow keys to navigate to the line that has "linux" in it, then at the end (the \ indicates a new line, or there is information after that, and is not part of the text that was entered originally), add the following:

acpi_osi=! acpi_osi="Windows 2009"

13. Now press Ctrl+X to boot into Ubuntu. It should now not freeze or hang.

If for some reason though the computer freezes and doesn't come back up after 3-5 or so minutes, it is safe to force shutdown. The GRUB bootloader (which the Ubuntu installer installed) will start automatically instead of Windows. Press the arrow keys to navigate to either Ubuntu or Windows (it says "Windows Boot Manager").

Hopefully this issue can be fixed by the Ubuntu team themselves in the near future. Dell Precision 2016/2017 laptops do not have this issue, because the graphics drivers/ACPI interface that works with Linux works properly by default. (On other laptops, as far as I know, there is no official way to patch the BIOS drivers to fix it. It would be really tough to do by yourself anyway.)

Please see below for instructions on how to fix the acpi_osi thing in GRUB forever, so you don't have to do it every time you boot up.

Part 5: Fixing Ubuntu freezes (acpi_osi issue) permanently

14. Follow one of these methods.

Part 5, Method 1: Running Ubuntu and Changing the GRUB configuration file (/etc/default/grub)

1. When starting your computer up, press and hold the ESC key EVEN WHILE the screen is off so you get to the Startup Menu on the HP laptop. Then, go down to boot options/boot menu and select ubuntu (UEFI).

When you see the "GNU GRUB" bootloader screen, make sure Install Ubuntu is highlighted on screen, THEN press the "e" key on your keyboard. Press the arrow keys to navigate to the line that has "linux" in it, then at the end (the \ indicates a new line, or there is information after that, and is not part of the text that was entered originally), add the following:

acpi_osi=! acpi_osi="Windows 2009"

This needs to be typed EXACTLY like this, with a space after the thing earlier (which was vt_handoff or something like that). Do NOT add anything else to the file or you may encounter weird errors/glitches when booting.

2. Now press Ctrl+X to boot.

3. Open a terminal in Ubuntu after you've logged in by pressing Ctrl+Alt+T.

4. Type cd /etc/default in the terminal, then press ENTER. This will change the directory to /etc/default so you can update /etc/default/grub, which contains the options (kernel parameters, etc.) that are necessary to boot Ubuntu in the GRUB bootloader (what you see when you boot Ubuntu at first).

5. Type sudo gedit grub in the terminal, then press ENTER.

6. In GEdit, find GRUB_CMDLINE_LINUX_DEFAULT="(stuff)" where (stuff) is what is currently under the two quotes (you won't see (stuff) literally, you may see something like root=/dev/mapper/ubuntu (it may not be the same thing)). Do not change whatever is already there - it's important for booting. At the end of (stuff), type in the following EXACTLY:

acpi_osi=! acpi_osi=\"Windows 2009\"

7. Save your changes and exit GEdit.

8. Now, type sudo update-grub in the terminal, then press ENTER. This will refresh the configuration in /boot/grub/grub.cfg so GRUB can boot Ubuntu with these 2 things added. GRUB is on the /boot/ partition, and the bootloader cannot see your /etc/ folder, so this change is necessary.

9. Reboot your computer. This time do not change anything in the grub menu (press e in the ubuntu grub menu, etc), just let ubuntu boot. See if it does not freeze. If it does, see HP_ZBook_Studio_G4#Part_4:_Booting_Ubuntu_after_Installation to boot Ubuntu again and try this method (or another one) again.

Part 5, Method 2: Running Ubuntu and Applying Changes to /etc/default/grub using grub-customizer

1. When starting your computer up, press and hold the ESC key EVEN WHILE the screen is off so you get to the Startup Menu on the HP laptop. Then, go down to boot options/boot menu and select ubuntu (UEFI).

When you see the "GNU GRUB" bootloader screen, make sure Install Ubuntu is highlighted on screen, THEN press the "e" key on your keyboard. Press the arrow keys to navigate to the line that has "linux" in it, then at the end (the \ indicates a new line, or there is information after that, and is not part of the text that was entered originally), add the following:

acpi_osi=! acpi_osi="Windows 2009"

This needs to be typed EXACTLY like this, with a space after the thing earlier (which was vt_handoff or something like that). Do NOT add anything else to the file or you may encounter weird errors/glitches when booting.

If the computer freezes and doesn't come back up after 3-5 or so minutes, it is safe to force shutdown. The GRUB bootloader (which the Ubuntu installer installed) will start automatically instead of Windows. Press the arrow keys to navigate to either Ubuntu or Windows (it says "Windows Boot Manager").

2. Then press Ctrl+X to boot into Ubuntu itself.

3. Now, in Ubuntu, install grub-customizer. Run the following commands in a terminal (press Ctrl+Alt+T):

sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer

(Source: https://launchpad.net/~danielrichter2007/+archive/ubuntu/grub-customizer)

4. Now run grub-customizer by typing grub-customizer in a terminal.

5. Type in your user's password when you are prompted to.

6. Go to the "General Settings" tab.

7. Under "Kernel Parameters", at the end of everything else, add the following 2 things (these are kernel parameters that act the same as acpi_osi=! acpi_osi="Windows 2009" but \" is needed because grub-customizer does not escape double quotes correctly. If you use ", it would create the wrong grub config file which doesn't let you boot).

acpi_osi=! acpi_osi=\"Windows 2009\"

Type this EXACTLY, including \" as shown above.

8. Then press save in the top left corner.

9. Reboot your computer. This time do not change anything in the grub menu (press e in the ubuntu grub menu, etc), just let ubuntu boot. See if it does not freeze. If it does, see HP_ZBook_Studio_G4#Part_4:_Booting_Ubuntu_after_Installation to boot Ubuntu again and try this method (or another one) again.

Part 5, Method 3: Bash Script (automatic)

UPDATE 3/16/19: I tested the Bash script, found a few bugs. They are now fixed. I have tested this on a different laptop (mine boots properly with no freezing) and it should work for the HP laptop, both of which require the acpi_osi fixes to work.

1. Download the following file in a web browser: https://owncloud.rhlug.org/index.php/s/7JEXibnktjsD83O/download (or you can use wget in a command line, if you are in ~/Downloads. If not, type cd ~/Downloads.) (If you're curious, source code is available below, and a testing version that doesn't modify system files is also available below.)

2. In a terminal (press Ctrl+Alt+T in Ubuntu), type in cd ~/Downloads to get to the script you downloaded.

3. Now, type sudo bash fix-grub.sh and follow the instructions. (This script appends the acpi_osi stuff to the beginning of GRUB_CMDLINE_LINUX_DEFAULT, not to the end. The order of which the kernel parameters (options) are in does not matter.)

4. Reboot your computer. This time do not change anything in the grub menu (press e in the ubuntu grub menu, etc), just let ubuntu boot. See if it does not freeze. If it does, see HP_ZBook_Studio_G4#Part_4:_Booting_Ubuntu_after_Installation to boot Ubuntu again and try this method (or another one) again.

Additional information: Source code and License

Source code for original bash script and testing version: https://owncloud.rhlug.org/index.php/s/3YsuRoAyIFKWLBC

(For testers or anyone who wants to try this for fun, you can try fix-grub-TEST.sh, which does not modify any system files. You can also try fix-grub.sh if are comfortable with removing the acpi_osi=! acpi_osi=\"Windows 2009\" configuration in GRUB (and permanently undoing it by using sudo gedit /etc/default/grub, looking for CMDLINE_LINUX_DEFAULT=... and sudo update-grub and seeing if it will boot with no changes) if your computer does not boot.)

License: MIT License (https://opensource.org/licenses/MIT)

Fixing Time in Windows

Linux will set the hardware clock to UTC time, so the time in Windows will be incorrect. However, it is recommended that you do not mess with these settings in Linux. It is preferred to fix this in Windows instead.

You can do this by opening an Administrator command prompt/PowerShell (Right click on the start menu and select the Windows Powershell (Administrator) option) and typing in this command:

reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_QWORD /f

Reboot your computer, and the time will be correct again.

Another method: Using a .reg file in Windows

Download the 64-bit .reg file from here: https://owncloud.rhlug.org/index.php/s/yMDjdhKaRNw8SoI

Double click on it in Windows Explorer to open it. Click "Yes" on the dialog that asks if you are sure about adding these registry keys.

Reboot your computer, and the time will be correct again.

Uninstalling Ubuntu

Please make a backup of your important data if you plan to do this. If you don't plan on using it at all, a backup isn't necessary.

You can ALWAYS uninstall Ubuntu if you want by going to Windows Disk Utility again and overwriting those partitions Ubuntu created (google which partitions for Windows you need to keep).

Troubleshooting

Check to see if Linux can boot after installing

In the BIOS, if you want to see what the boot menu options are after installing, when rebooting, press and hold the ESC key EVEN WHILE the screen is off so you get to the Startup Menu on the HP laptop. Then, go down to boot options/boot menu. You should see "ubuntu" as an entry. If you do, congratulations! You've successfully installed Linux!

You can also rearrange the boot order in the BIOS settings if you want Windows to boot first, or the bootloader menu to boot first, etc. AFAIK you can't just boot Ubuntu directly, and I wouldn't recommend it anyway, in case you need to test/change something. There might be a way to do both (using a key combination/other special tool), etc. but you may experience other issues in this case. Contact the Telegram group if you have questions/need help.

I accidentally removed my Windows partition

If you haven't made a complete backup of your Windows partitions (e.g. using Clonezilla), you will need to reinstall Windows from scratch. For the software on Windows such as Maple, you'll need to contact EIT to get some of the licenses back if you haven't backed them up.

Contact one of us or EIT if you accidentally overwrote your Windows installation somehow. We can help you get it fixed.

You can also install another distro on top of it or overwrite Ubuntu with another distro, but be careful, your data that you created on Ubuntu will still be removed if you don't have a backup of your Ubuntu partitions, and you overwrote the ext4 partitions Ubuntu created!

Additional Information

What is a kernel parameter, and how do I add one?

A kernel parameter is something that is like a "global variable" to the kernel, in other words, something that is available to the entire kernel, when you boot Linux, when you pass it in during boot in GRUB. If you've heard of "environment variables" or bcdedit, they're like that, but on a more kernel level/lower level.

If you ever need to add any additional kernel parameters, see here: https://askubuntu.com/questions/19486/how-do-i-add-a-kernel-boot-parameter (NOTE: foo=bar is an example kernel parameter they use, do not add it unless for some reason you do.)

Why do I need acpi_osi when I boot?

This prevents crashing when loading Linux because of the Nvidia graphics driver (the computer has a Nvidia Quadro/Intel Graphics card installed, but the Nvidia one causes issues, when the computer switches to using Nvidia) having issues. This happens in all Linux distros and is specific to this laptop (source: https://wiki.archlinux.org/index.php/HP_Zbook_Studio_G3#Using_hybrid_graphics).

A note on units (GiB vs GB)

Technically, the units for data storage shown in diskmgmt.msc are wrong/misleading in Windows, it should be GiB/MiB because of the standard set in 2008 by the IEC (powers of 2 rather than 10, which are now technically supposed to be the MB, GB, etc, but GB/MB on many computers actually refers to GiB/MiB). Linux does this properly for a lot of things, which is why you see "GiB" instead of "GB" in many things.). You will also see this (usually) properly referred to in the chat as GiB/MiB, if you weren't aware, for example, 8 GiB of RAM = 8096 MiB of RAM = ... = 8*2^30 Bytes (B) = 2^3*2^30 B = (exponent rule) = 2^33 B of RAM.)

Tech Specs

The 2018 laptop given to Rose students has the following specs:

Processor Intel Core i7 7820HQ (Kaby Lake) (2.9GHz stock, 3.9GHz boost, not overclockable)
RAM 16 GB @ ???MHz DDR4 (2x8GB SODIMM sticks)
Solid State Drive M.2 SATA3 256 GB (approx. 238.42 GiB) Solid State Drive (theoretical max 600MB/s) [Possibly not expandable, only 1 slot]
Optical Drive None
Display 15.6" FHD 1920x1080
Video Card Nvidia Quadro M1200 w/ 4GB GDDR5 RAM (supports Vulkan and OpenGL)
Network Cards Intel Dual-Band 8265 802.11ac wireless, RJ45 Gigabit (1Gb/s) Ethernet port (built-in)

and PxE (network) boot via either built-in RJ45 port or 2 USB Type-C ports using a compatible USB-C to Ethernet adapter

Battery 8 cell Lithium-Ion 92.4* WHr
AC adapter 150W "Smart Slim"
USB (3) USB 3.0 and (2) Thunderbolt 3 (USB Type-C form factor) Other ports SD card reader, headphone jack, Fingerprint Reader
Pointing Devices Trackpad (Synaptics?)
External Video Port Dedicated HDMI port (and HDMI passthrough via Thunderbolt)
Integrated Webcam 720p integrated webcam ("DualAryMic" - dual array mic?)
Network Accessories USB Type C to Ethernet adapter, 1Gb/s
Warranty 4 year with Accidental Damage Protection (ADP)
  • Not 96WHr as stated in the EIT report. HP's website has the most recent information.

Information pulled from:

(My Rose Login) EIT's 2017-18 Annual Report (on which specs they chose)

HP's spec finder thingy