Freitag, 9. Oktober 2020

GSM/WWAN Module on Dell Latitude 5501 under Ubuntu 18.04

XMM7360 modem to USB

I've received a second SIM card for my Mobile Phone contract, and I wanted to use it with my company laptop. Unfortunately, it didn't work out of the box for me. Let's check the type of the modem device first:

# lspci
...
02:00.0 Wireless controller [0d40]: Intel Corporation Device 7360 (rev ff)
...
I have looked up the drivers online, and a few pages describe the wrong way, but I've found that the correct modem driver. Here's how to install it:
  # cd /usr/src
  # sudo su
  # git clone https://github.com/juhovh/xmm7360_usb.git
  # cat README.md
  make
  sudo make install
  sudo modprobe xmm7360_usb

I did the recommended steps from the Readme, but not all things worked. So, I've added some commands to How-To:
make
sudo make install
sudo depmod -A
sudo modprobe xmm7360_usb
echo xmm7360_usb | sudo tee -a /etc/modules

Next, reboot your laptop and check the driver loaded successfully.

You can also check with nmcli:
nmcli d
DEVICE           TYPE      STATE        CONNECTION      
wlo1             wifi      connected    Auto LKDE       
docker0          bridge    connected    docker0         
eno2             ethernet  unavailable  --              
cdc-wdm0         gsm       unavailable  --              
lo               loopback  unmanaged    --              



In the end, you have to go to "Menu -> Preferences -> Network Connections" and add a new Mobile Broadband connection. (On Linux Mint 19.3)

Montag, 17. Februar 2020

Linux not booting after kernel update on Dell Latitude 5501 (and 5591) when on battery

After the latest BIOS/Kernel update my Notebook does not boot anymore when it is on battery, with charger everything works fine.

Note: it should be happen either after BIOS upgrade or after Kernel Upgrade when you have the latest BIOS on your Notebook.

I've found on Dell Community that problem probably coming from Intel Microcode, since this change working on Windows without any issue, i mean there is a problem with BIOS/linux/microcode combination.

Workaround


Add parameter to grub config in file '/etc/default/grub' in Line 'GRUB_CMDLINE_LINUX_DEFAULT'.


GRUB_CMDLINE_LINUX_DEFAULT="quiet splash dis_ucode_ldr"

Please don't forget to run grub-update and after reboot commad:

$ grub-update & reboot


Samstag, 15. Februar 2020

Enable Hibernation on Linux Mint 19 (Ubuntu 18.04)



Prerequisites


There is two methods to have Swap: you can create separately a dedicated Swap partition with LVM or you can create a swap file on your root partition. Since i prefer the firs variant i'll you show how can create a swap partition.


As a rule of thumb, simply set up your swap file to at least the size of your RAM, or even double your RAM on systems with very low total RAM.I'll make here double of my RAM, also i have 32 GB RAM.


Create Logical Volume:
$ lvcreate -L 64G -n swap1 vg00

Alternatively you increase your swap partition if it is already there:

$ swapoff -v /dev/vg00/swap1
$ lvresize /dev/vg00/swap1 -L 64G

Format your newly created Swap partition and enable


$ mkswap /dev/vg00/swap1
Setting up swapspace version 1, size = 64 GiB (69793214464 bytes)
no label, UUID=8259ac1e-26fb-48c0-a1f9-2c3816b9c9b4

Add the following entry to /etc/fstab file (if not yet exist):
echo "/dev/mapper/vg00-swap1 swap swap defaults 0 0" >> /etc/fstab
Enable swap:
$ swapon -va
Check your swap size:
$ free -h |grep -i swap
Swap:           64G          0B         64G

Add Swap to Grub Menu


Get UUID of Swap (you can see above too):
$ blkid | grep swap
/dev/mapper/mint--vg-swap_1: UUID="8259ac1e-26fb-48c0-a1f9-2c3816b9c9b4" TYPE="swap"

Add UUID to grub config as resume with vim:
$ vim /etc/default/grub
and add resume option to grub line 'GRUB_CMDLINE_LINUX_DEFAULT'
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=8259ac1e-26fb-48c0-a1f9-2c3816b9c9b4"

Update your boot menu with update-grub command:
$ update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Sourcing file `/etc/default/grub.d/60_mint-theme.cfg'
Generating grub configuration file ...
Found theme: /boot/grub/themes/linuxmint/theme.txt
Found linux image: /boot/vmlinuz-5.3.0-28-generic
Found initrd image: /boot/initrd.img-5.3.0-28-generic
Found linux image: /boot/vmlinuz-5.3.0-26-generic
Found initrd image: /boot/initrd.img-5.3.0-26-generic
Found linux image: /boot/vmlinuz-4.18.0-25-generic
Found initrd image: /boot/initrd.img-4.18.0-25-generic
Found linux image: /boot/vmlinuz-4.15.0-43-generic
Found initrd image: /boot/initrd.img-4.15.0-43-generic
Found linux image: /boot/vmlinuz-4.15.0-23-generic
Found initrd image: /boot/initrd.img-4.15.0-23-generic
Adding boot menu entry for EFI firmware configuration
done


Lastly add Hibernation to the Menu:
$ tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla <<'EOB'
[Enable hibernate]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions
ResultActive=yes
EOB

... and don't forget reboot your Maschine:
$ reboot

Note: as you see i have a Kernel 5.3.x

Freitag, 14. Februar 2020

How to shrink encrypted root filesystem under LVM with USB Stick on Linux Mint 19 (Ubuntu 18.04)

Prerequisites

Download Linux Mint Image from here: https://linuxmint.com/download.php

Plug-In your USB Stick to your maschine. Click with right mouse on the Image and choice Make bootable USB stick.

After rebooted your maschine and booted with Linux Mint 19.3, please open a terminal.

Identify encrypted device

Identify encrypted device - /dev/nvme0n1 partition in this example.
$ lsblk -f /dev/nvme0n1
NAME                  FSTYPE      LABEL UUID                                   MOUNTPOINT
nvme0n1                                                                        
├─nvme0n1p1           vfat              D1EC-CB38                              /boot/efi
├─nvme0n1p2           ext4              6706d5ab-ded4-4a99-a17a-39db1aa75761   /boot
└─nvme0n1p3           crypto_LUKS       12a034f9-1a0a-4e4e-97e2-2731620534b9   
  └─nvme0n1p3_crypt   LVM2_member       jxFZEZ-nZ0o-tSG1-wkfQ-ZBmw-gpcu-xWbGie 
    ├─mint--vg-root   ext4              7e3fc579-a6e4-49c2-bc69-d5f66cca45c4   /
    └─mint--vg-swap_1 swap              4115a08a-bf78-4415-9209-36deadd7ed3b   [SWAP]

Open LUKS device

Open encrypted /dev/nvme0n1p3 device and set up encrypted_device mapping.
$ cryptsetup luksOpen /dev/nvme0n1p3 encrypted_device
Enter passphrase for /dev/nvme0n1p3: ****************

Identify volume group

Identify volume group - mint-vg in this example.
$ vgs
  VG      #PV #LV #SN Attr   VSize    VFree 
  mint-vg   1   2   0 wz--n- <475,72g <1,72g

List logical volumes

List logical volumes on identified mint-vg volume group.
$ lvs
  LV     VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   mint-vg -wi-ao---- 410,00g                                                    
  swap_1 mint-vg -wi-ao----  64,00g

Activate logical volumes

Activate volume group.
$ lvchange -ay mint-vg


Shrink encrypted file system

Attach the encrypted file system for testing
$ mkdir /media/mint--vg-root & mount /dev/mapper/mint--vg-root /media/mint--vg-root
$ ls -la /media/mint--vg-root
  total 108
drwxr-xr-x  24 root root  4096 Feb 14 19:58 .
drwxr-xr-x  24 root root  4096 Feb 14 19:58 ..
drwxr-xr-x   2 root root  4096 Feb 14 19:58 bin
drwxr-xr-x   5 root root  4096 Feb 13 10:52 boot
drwxr-xr-x   2 root root  4096 Feb  6 10:34 cdrom
drwx------   3 root root  4096 Feb 12 11:47 .config
drwxr-xr-x  21 root root  4700 Feb 14 20:39 dev
drwxr-xr-x 172 root root 12288 Feb 14 20:35 etc
drwxr-xr-x   3 root root  4096 Feb  6 10:34 home
lrwxrwxrwx   1 root root    33 Feb 13 10:51 initrd.img -> boot/initrd.img-4.15.0-43-generic
lrwxrwxrwx   1 root root    32 Feb 13 10:51 initrd.img.old -> boot/initrd.img-5.3.0-26-generic
drwxr-xr-x  25 root root  4096 Feb 12 13:20 lib
drwxr-xr-x   2 root root  4096 Feb 12 13:20 lib64
drwx------   2 root root 16384 Feb  6 10:32 lost+found
drwxr-xr-x   3 root root  4096 Feb 14 19:58 media
drwxr-xr-x   2 root root  4096 Dec 13 17:12 mnt
drwxr-xr-x   5 root root  4096 Feb 12 15:27 opt
dr-xr-xr-x 341 root root     0 Feb 14 20:39 proc
drwx------  11 root root  4096 Feb 14 20:35 root
drwxr-xr-x  37 root root  1180 Feb 14 20:39 run
drwxr-xr-x   2 root root 12288 Feb 12 14:21 sbin
drwxr-xr-x   2 root root  4096 Dec 13 17:12 srv
dr-xr-xr-x  13 root root     0 Feb 14 20:39 sys
drwxrwxrwt  15 root root  4096 Feb 14 20:50 tmp
drwxr-xr-x  11 root root  4096 Dec 13 17:11 usr
drwxr-xr-x  12 root root  4096 Feb 12 11:41 var
lrwxrwxrwx   1 root root    30 Feb 13 10:51 vmlinuz -> boot/vmlinuz-4.15.0-43-generic
lrwxrwxrwx   1 root root    29 Feb 13 10:51 vmlinuz.old -> boot/vmlinuz-5.3.0-26-generic

Umount the encrypted file system.
$ umount /media/mint--vg-root 

Shrinking both logical volumes and filesystem

$ lvreduce --resizefs --size -410G /dev/mapper/mint--vg-root 

Deactivate active volume group.
$ lvchange -an mint-vg

Close LUKS device

Remove the encrypted_device mapping
$ cryptsetup luksClose encrypted_device
Now you can reboot your maschine as normal.