SMBIOS Chassis Type Table

Table I use for reporting on ratio of Desktop / Laptops using Chassis Types. Derived from the DMTF SMBIOS Spec November 2016 : http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.1.0.pdf

Hex Value Dec Value Meaning Laptop-Desktop-Other
1 1 Other Other
2 2 Unknown Other
3 3 Desktop Desktop
4 4 Low Profile Desktop Desktop
5 5 Pizza Box Desktop
6 6 Mini Tower Desktop
7 7 Tower Desktop
8 8 Portable Laptop
9 9 Laptop Laptop
A 10 Notebook Laptop
B 11 Hand Held Laptop
C 12 Docking Station Other
D 13 All In One Desktop
E 14 Sub Notebook Laptop
F 15 Space-saving Desktop
10 16 Lunch Box Desktop
11 17 Main Server Chassis Other
12 18 Expansion Chassis Other
13 19 SubChassis Other
14 20 Bus Expansion Chassis Other
15 21 Peripheral Chassis Other
16 22 RAID Chassis Other
17 23 Rack Mount Chassis Other
18 24 Sealed-case PC Desktop
19 25 Multi-system chassis Other
1A 26 Compact PCI Other
1B 27 Advanced TCA Other
1C 28 Blade Other
1D 29 Blade Enclosure Other
1E 30 Tablet Laptop
1F 31 Convertible Laptop
20 32 Detachable Laptop
21 33 IoT Gateway Other
22 34 Embedded PC Desktop
23 35 Mini PC Desktop
24 36 Stick PC Desktop

Creating Offline Repositories for CentOS / RHEL – Part 1

I’ve started doing more and more with linux, I wanted a way to store updates and packages offline – in the same way we do for Windows using WSUS and SCCM etc… This is how to host offline repositories, it may not be the most secure method – but is aimed at LAN hosting where you trust the LAN members!

  • Set up a server to host the RPM content, I used CentOS 7.
  • Install a web server service, I used nginx – my base path is /var/www/html
  • Create a folder for the repo you want to host – in this example I’m going to use “base”
  • Use reposync to download the RPM’s
    • reposync -p /var/www/html -r base -l
  • Create a repo
    • createrepo /var/www/html/base
  • Update the repo after a reposync
    • createrepo –update /var/www/html/base

You can now amend your yum config files on clients to use this repo, I will post another entry sometime with more information on how to automatically update the repo.

Oh-My-Zsh Agnoster Theme Windows 10 Client

I wanted to try out Oh-My-Zsh, I needed to set up a new CentOS box to run some stuff and decided now was the time give it a go.

It was easy to get working on the server side, but to get the rendering right on Windows client took a bit of work!

  • Install git, curl and zsh
  • Install oh-my-zsh using the curl commandline from here.

This went fine and worked as expected (I was connected via mobaxterm from Windows 10) But I wanted something a bit more fancy, so I edited the file ~/.zshrc and changed the theme to “agnoster”. As stated on the themes page, I needed to install some patched fonts to get the nice icons – this is where it got tricky. I followed the powerline instructions and installed the fonts on the CentOS box, but this didn’t work. Then I installed some of the fonts in Windows and switched the MobaXTerm font to one of these – didnt work.

It turns out that some of the powerline fonts work better in Windows than others. I messed around trying to get some of the fonts working in MobaXTerm, then I gave up and tried in Putty. The one I found which worked was DejaVu Sans Mono – thanks to this blog.

I had only just started using MobaXTerm, and quite liked it – but as I couldn’t get this working, I’ll probably go back to just using Putty Tray (a putty fork, i like!)

I found this page – which has instructions of enabling the nice Solarized theme in Putty-Tray 🙂

More External Themes to try : https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes

CentOS on Windows Subsytem for Linux (WSL)

I read about the Windows Subsystem for Linux a while back, and thought it was only available using Ubuntu. Today I wanted to play around with it and fish shell, but I prefer centos to ubuntu. A quick google found this github project – WSL Distribution Switcher –

Excellent! It allows you to switch from ubuntu to other linux distro’s. I’m not going to pretend I have taken the time to understand how WSL works ‘under the hood’ but as WSL Switcher gets docker layers / images, I’m guessing it based on docker in some shape or form?

I enabled WSL on my W10 1703 (Creators Update) build, started bash and created myself a user. Installed Python 3 (a requirement for WSL Switcher). Then I cloned the WSL Switcher git project and used the following commands to switch to centos and confirm it worked :

  • get-prebuilt.py centos:latest
  • install.py centos:latest
  • bash
  • cat /etc/centos-release

Everything seemed fine, but then I tried to run yum (the centos package manager). It wouldn’t run as a non root user, fine – tried “sudo yum”. Command not found – grrrrrr

Then I tried su – got prompted for password and thought I had made progress – entered the password for my linux user… nope!

Luckily, I’m not the first person to run into this problem 🙂 I found an issue in the WSL Distro Switcher github with the information I needed. I needed to switch the default user that WSL used, enter WSL / bash, change the passwd, then change the default user back to my non root user.

  • lxrun /setdefaultuser root
  • Found UNIX user: root
    Default UNIX user set to: root
  • bash
  • passwd
    • (enter your desired root password)
  • exit
  • lxrun /setdefaultuser *username*

Now when I went into WSL, I was logged in as my normal user – I could “su” and run commands as root – perfect! However, I like to sudo rather than switch to root using su – more to be done…

I thought the next bits would be easy – but alas no. yum wont work, even now I have access to root user – looks like a network issue. Should be simple to figure out right? I wish, no ifconfig, so i tried “ip addr” – neither work. Why do people insist on taking so much stuff out of an OS as to make it almost useless!

 

I thought that the networking was messed up – it was fine, but DNS resolution was messed up – I ‘resolved’ this by editing resolv.conf, which had a really random IP set for the nameserver! I fixed this and then moved onto to sorting out sudo!

  • yum install sudo
  • exit (to exit su shell back to normal user)
  • sudo yum
    • user is not in the sudoers file. This incident will be reported.
    • so we need to add to the sudoers file
  • su
  • vi /etc/sudoers
    • add a line near the bottom
    • username ALL=(ALL) ALL
  • exit (exit su shell)
  • sudo yum (testing)
    • It works!

Now onto fish commandline…

Its not in the main repos – so I had to first install epel

  • sudo yum install epel-release
  • sudo yum install fish

Now I can enter fish shell after entering WSL bash – i tried a few things to try and set fish as the default shell – but none of them worked. Probably something to do with docker / wsl. I will update this post if i can figure out how to go straight into fish…

 

 

 

HowTo Deploy an Additional File with MSI using InstEd!

Sometimes when you need to deploy an application, you may need to add additional files to get installed onto the target machine, they could be configuration or license files etc… The first thing you need to do is create a CAB file with the additional files you want to install / deploy with the MSI. A CAB file is a Microsoft compressed archive from before Zip files were widely adopted. Every version of Windows since 2000, has shipped with a tool built in to create CAB files called “makecab”.

Makecab Utility Help Output
Microsoft Makecab commandline utility.

Make CAB file with desired additional files
For this example I only needed to add one additional file, so the commandline was easy – if you need to add multiple files you may need to explore the /F switch and directive files. Or the features built into InstEd! to help with this (see their online help page).
makecab filename.xml LicenseFile.cab
Where filename.xml is the name of the license file and LicenseFile.cab is the name of the destination CAB file to be created.

InstEd! is a great little tool for editing MSI files. Its very similar in functionality to Orca if you have ever used that – but it is more user friendly and offers more functionality. The instructions provided assume you are using InstEd! There are two main methods you can use, edit the existing MSI – OR – create a transform file and reference it during the install. I will be creating a transform file, as I think if you edit an already signed MSI you will need to sign it again using certificates etc…

Create New Transform File
Open the MSI file in InstEd! and select Transform -> New Transform. Choose a filename for the new MST file. I called mine “LicenseFile.mst”
Add Component to component table
Go to the “Component” Table, right click in the rows pane on the right hand side and select “Add Row” – complete the details as follows :

Component LicenseFile (What you want the Component to be called)
ComponentId (Use button to generate new GUID)
Directory license_Dir (Use Directory Table to find name of desired target directory)
Attributes 0x0000 (Default value)
Condition <null>
KeyPath <null>

I used an already existing entry in the Directory Table “license_Dir” – you may need to add a row to the directory table for your requirements.

The new row should now be visible and highlighted in green. The reason its green, is to show you which rows have been updated, added or deleted from the original MSI file by the transform file.

Screenshot of new Component Dialog
Screenshot of new Component Dialog

Associate the created component with a feature
Now we need to tell the MSI to install this new component when it installs the main application in my case this feature is called “MainFeature”.

Feature MainFeature (Choose appropriate feature from dropdown)
Component_ LicenseFile (Choose the component you created)
Screenshot of New FeatureComponent Dialog
Screenshot of New FeatureComponent Dialog

Add the file entry in file table
Next we will add an entry in the file table for the actual file we want to add to the installation, in my case this is a license file which is getting installed to a subdirectory of the main program files folder. Luckily the developer of the application had anticipated people would want to install their license file during deployment so the MSI already had a directory entry for “license_Dir”. If this didnt exist we would need to create an entry in the Directory table as well.
Sort the “File” table by the field “Sequence” scroll to the bottom to find the highest sequence number and make a note of it (in my example the last Sequence number is 773, so my file will be 774). Add a row with the following values :

File filename.xml (The filename as stored in the CAB file)
Component LicenseFile (Choose the component you created earlier)
FileName filename.xml (The destination filename)
FileSize 1
Version <null>
Language <null>
Attributes <null>
Sequence 774
Screenshot of new file row dialog
Screenshot of new file row dialog

Add the media entry in media table
The last table we need to edit in the MSI is the media table. This table tells the MSI where the files are to install, you will need the file sequence number from the previous step (774). I think the reason for this, is that when installers still came on disks this is the method by which the installer knew to ask for the next disk.

DiskId 2 (My example already had a disk with id 1)
LastSequence 774 (LastSequence number of first disk + 1)
DiskPrompt <null>
Cabinet <null>
VolumeLabel <null>
Source <null>
Screenshot of new media dialog.
Screenshot of new media dialog.

Save and Test!
Once you have finished adding rows etc… you need to save the transform file. Just underneath the File and Edit menu should be a small box with the name of the mst file and a little asterix to indicate changes have been made. Right click this box and select save. Now you have saved the transform you can test the installation to see if it works. Put the *.mst and *.cab files in the same folder as the *.msi file and run the following commandline from an elevated (run as admin) command prompt.
msiexec /i filename.msi /qn /l*v %TEMP%\TransformTest.log TRANSFORMS=filename.mst
Note you do not need to reference the cab file in the commandline.
If all went well, the application plus the additional file should have installed succesfully – and a verbose msi install log will have been created in %TEMP% folder. Use this to troubleshoot any issues you encounter.

Delete User Profile – Windows 10

Strange issue’s are my favourite!

I wanted to delete a user profile on W10 1511 today. But when I went into User Profiles through control panel – only the current user i was logged in was displayed.

To see all user profiles, I had to go to Computer Properties -> “Advanced system settings” -> User Profiles Group -> Settings.

I’m not sure what causes this issue – it could be that UAC is disabled and if was enabled when I went in through Control Panel i would have been prompted to accept the UAC prompt then it would display more than current user.del_user_profile_screenshot