[ROM][UNOFFICIAL] LineageOS 18.1 for Nexus 5 (hammerhead)

Search This thread

z3DD3r

Senior Member
Feb 9, 2016
195
1,147
Minsk
Google Nexus 5
Hi there.

I've got a Nexus 5 device for tests for some days and i'm trying to understand what is going on with encryption. I was able to encrypt my device on 20210207 build but the reason of previous fails is still a mystery for me. I'll appreciate if anyone can test encryption. I'll post instruction here but you should be aware that this process is destructive and you can loose all your data. Read instruction carefully and don't skip any step!

Here we go:
1. Backup all data from your phone to PC
2. Install latest version of the TWRP HH and boot it
3. Dump 2 partitions to /sdcard from Terminal with next commands:
Bash:
dd if=/dev/block/mmcblk0p26 of=/sdcard/crypto.img
dd if=/dev/block/mmcblk0p14 of=/sdcard/metadata.img
4. Copy crypto.img and metadata.img to your PC
5. Fill 2 partitions with zeros from Terminal with next commands:
Bash:
dd if=/dev/zero of=/dev/block/mmcblk0p26
dd if=/dev/zero of=/dev/block/mmcblk0p14
6. Wipe all partitions in TWRP
7. Format Data in TWRP
8. Reboot from TWRP into TWRP
9. Intall ROM as always (Gapps and Magisk are optional)
10. Boot into system
11. Finish Setup Wizard and configure screen lock. Do not install any apps and don't restore any backups cos data maybe lost after encryption. I suggest even skip Play Market account setup. You can do it after encryption if everything will work.
12. Encrypt your phone from the Settings -> Encryption
13. Wait pationtly...
14. If your phone will boot into TWRP then try to decrypt data, then wipe /Cache, /Data, /Dalvik and /Internal Storage, then reboot into system.
15. If your phone will boot into System then reboot into TWRP, try to decrypt data, wipe /Cache, /Data, /Dalvik and /Internal Storage, then reboot into system.

Do not skip any of this steps!
After doing that you can setup your phone and check your encryption status in Settings -> Encryption. If you will ses "Encrypted" then u can setup your account, restore backups and use your phone.

If device won't boot then well this doesn't helped you and you need to boot into TWRP, wipe all partitions, format data and install ROM from scratch. You can also restore dumped partitions. You can do it with next steps:
1. Boot into TWRP HH
2. Copy crypto.img and metadata.img to /sdcard/
3. Restore 2 partitions from Terminal with next commands:
Bash:
dd if=/sdcard/crypto.img of=/dev/block/mmcblk0p26
dd if=/sdcard/metadata.img of=/dev/block/mmcblk0p14

This works for me but i can't guarantee that this will work for everyone.
Screenshot_20210218-151745_Settings.png

PS: I'm not responsible for bricked devices. Do it at your own risk!
 
Last edited:

sant514

Senior Member
Jun 1, 2014
99
50
Yes it works. Thank you @z3DD3r. I used ROM v20210207 and TWRP R10.
I followed all steps till 13
Then the N5 booted into TWRP. It decrypted data normally and very fast.
I wiped /Cache, /Dalvik and /Internal Storage and reboot into system. But in this point there was problem. The N5 booted into TWRP again. I tried 3 times but every time i had the same result.
So, i decided to restore my nanroid (which i had made before make encryption) without i wipe or format the partitions.
When the restore completed, i wiped /Cache, /Dalvik and /Internal Storage and reboot into system. That was. The N5 booted normally into system.
I checked the encryption and it is enabled.
So after all of these, i restore and my files in the sdcard.
I made some others tests, i booted into TWRP (decryption works), again booted into system (decryption works), again booted into TWRP (decryption works), again booted into system decryption works and all of my files in sdcard are there, the apps are there.
 
  • Like
Reactions: z3DD3r

jollfye

Member
Feb 4, 2014
11
0
Hello, tried to update to the latest 18.1 version through Updater in Android Settings, downloaded ROM, pressed INSTALL, it restarted to the latest installed TWRP HH.R.10, but it was unable to flash zip automatically (see the error), had to do it manually, idk what's wrong, just reporting the issue I met with. Overall, 18.1 works great as a daily driver. Thank you, @z3DD3r!

Screenshot_2021-02-20-13-33-17.png
 

jenkinsad0

New member
Feb 12, 2021
4
1
69°N
Now I've just installed yesterday 17.1-20210209-...-signed.zip

What would be the recommended way to upgrade to [the next version of] LOS 18.1?

Answer: Seems OK with dirty flash 17.1-20210216 signed to 18.1-20210220 signed. Wiped System, Cache and Dalvik (but not Data) before installing, and then deleted /data/system/locksettings.db after first reboot to fix the lockscreen, according to @snow 's instructions https://forum.xda-developers.com/t/...-for-nexus-5-hammerhead.4214367/post-84271085

No need to use @snow 's unsigned->signed migration script.

Thank you, @z3DD3r @snow and other lineageos developers!
 

timgoodwin

Senior Member
Nov 12, 2013
73
14
Hello, tried to update to the latest 18.1 version through Updater in Android Settings, downloaded ROM, pressed INSTALL, it restarted to the latest installed TWRP HH.R.10, but it was unable to flash zip automatically (see the error), had to do it manually, idk what's wrong, just reporting the issue I met with. Overall, 18.1 works great as a daily driver. Thank you, @z3DD3r!

View attachment 5227901
I have this problem as well. Updates have to be manual.
 
  • Like
Reactions: jollfye

sant514

Senior Member
Jun 1, 2014
99
50
There is a bug in file manager. It can not read NTFS. The same NTFS media (usb stick 32GB), is recognizable writable and readable in Windows10, Linux and Lineage17.1_by_z3dd3r_for_N5. A temporary solution is MiXplorer with custom otg driver enabled, but in this case the media mount is ro (read only).
 
  • Like
Reactions: itbauer

z3DD3r

Senior Member
Feb 9, 2016
195
1,147
Minsk
Google Nexus 5
Hello, tried to update to the latest 18.1 version through Updater in Android Settings, downloaded ROM, pressed INSTALL, it restarted to the latest installed TWRP HH.R.10, but it was unable to flash zip automatically (see the error), had to do it manually, idk what's wrong, just reporting the issue I met with. Overall, 18.1 works great as a daily driver. Thank you, @z3DD3r!
I have this problem as well. Updates have to be manual.
Well, the old issue returned. It is a problem in TWRP HH. Anyway if TWRP fails to install update automatically then you can install it manually from /data/lineageos_update/.

There is a bug in file manager. It can not read NTFS. The same NTFS media (usb stick 32GB), is recognizable writable and readable in Windows10, Linux and Lineage17.1_by_z3dd3r_for_N5. A temporary solution is MiXplorer with custom otg driver enabled, but in this case the media mount is ro (read only).
It is not a file manager's bug. Some patches were not included into the LOS 18.1 source code by the authors cos of problems. I can include these patches in my builds but i can't guarantee that everything will work correctly.
 
  • Like
Reactions: jollfye and sant514

AtumTTG

New member
Nov 14, 2012
4
2
Hi there.

I've got a Nexus 5 device for tests for some days and i'm trying to understand what is going on with encryption. I was able to encrypt my device on 20210207 build but the reason of previous fails is still a mystery for me. I'll appreciate if anyone can test encryption. I'll post instruction here but you should be aware that this process is destructive and you can loose all your data. Read instruction carefully and don't skip any step!

Here we go:
1. Backup all data from your phone to PC
2. Install latest version of the TWRP HH and boot it
3. Dump 2 partitions to /sdcard from Terminal with next commands:
Bash:
dd if=/dev/block/mmcblk0p26 of=/sdcard/crypto.img
dd if=/dev/block/mmcblk0p14 of=/sdcard/metadata.img
4. Copy crypto.img and metadata.img to your PC
5. Fill 2 partitions with zeros from Terminal with next commands:
Bash:
dd if=/dev/zero of=/dev/block/mmcblk0p26
dd if=/dev/zero of=/dev/block/mmcblk0p14
6. Wipe all partitions in TWRP
7. Format Data in TWRP
8. Reboot from TWRP into TWRP
9. Intall ROM as always (Gapps and Magisk are optional)
10. Boot into system
11. Finish Setup Wizard and configure screen lock. Do not install any apps and don't restore any backups cos data maybe lost after encryption. I suggest even skip Play Market account setup. You can do it after encryption if everything will work.
12. Encrypt your phone from the Settings -> Encryption
13. Wait pationtly...
14. If your phone will boot into TWRP after some reboots then try to decrypt data, then wipe /Cache, /Dalvik and /Internal Storage, then reboot into system.
15. If your phone will boot into System after some reboots then reboot into TWRP, try to decrypt data, wipe /Cache, /Dalvik and /Internal Storage, then reboot into system.

Do not skip any of this steps!
After doing that check your encryption status in Settings -> Encryption. If you will ses "Encrypted" then u can setup your account, restore backups and use your phone.

If device won't boot then well this doesn't helped you and you need to boot into TWRP, wipe all partitions, format data and install ROM from scratch. You can also restore dumped partitions. You can do it with next steps:
1. Boot into TWRP HH
2. Copy crypto.img and metadata.img to /sdcard/
3. Restore 2 partitions from Terminal with next commands:
Bash:
dd if=/sdcard/crypto.img of=/dev/block/mmcblk0p26
dd if=/sdcard/metadata.img of=/dev/block/mmcblk0p14

This works for me but i can't guarantee that this will work for everyone.
View attachment 5225625

PS: I'm not responsible for bricked devices. Do it at your own risk!

Encryption is now working!

I followed your guide and flashed the latest build (lineage-18.1-20210220). After setting up encryption, the phone rebooted into system and it was bootlooping on the "Starting Android..." dialog. Wiping the needed partitions as you said on step 15 fixed it, and now my phone is working 100%.

Thank you so much, this old device is now somewhat brand new :p
 
  • Like
Reactions: Baonks81 and z3DD3r

ProBird79

Senior Member
  • Jan 13, 2008
    222
    73
    I did a clean flash and kept getting an error once Open GApps began to flash. Apparently you need GApps for Android 11 and nothing on Open GApps will work. There is a link on the first page for Android 11 GApps.
     

    z3DD3r

    Senior Member
    Feb 9, 2016
    195
    1,147
    Minsk
    Google Nexus 5
    New build is out. Short changelog:
    1. March security patch
    2. Latest changes from LOS team
    3. Added patches for OTG. Thanks to @sant514 for pointing this.
    4. Added patches for GPS (GLONASS, BeiDou). Read about it here
    5. Some improvements to SELinux policies.

    During offline charging, pressing power button doesn't wake the screen up. Can anyone confirm this?
    Maybe. Can't check cos i don't have device. Unfortunately without device i can't fix it. If anyone will find a fix then notify me please.

    It Is possibile to dirty flash latest build? and how can i do It?
    If you have installed LOS 18.1 then just flash new update in TWRP
     

    z3DD3r

    Senior Member
    Feb 9, 2016
    195
    1,147
    Minsk
    Google Nexus 5
    Latest build gives me the "serial console enabled, performance is impacted" warning. Is that a problem? It seem to work fine.
    Have u installed build from experimental folder? If so then return back to normal builds. Experimental builds are unstable... Thats why they are placed in experimental folder and excluded from OTA
     

    Gynlemon

    Senior Member
    Jul 31, 2008
    731
    308
    New build is out.


    Have u had a chance to test OTG?
    I can confirm that it works, tested with today's latest build.
    I wanted to ask you if there is the possibility of an advanced restart with the keys, since OTA update does not work properly, you need to manually turn off and go to recovery for manual installation
     
    • Like
    Reactions: z3DD3r

    z3DD3r

    Senior Member
    Feb 9, 2016
    195
    1,147
    Minsk
    Google Nexus 5
    I wanted to ask you if there is the possibility of an advanced restart with the keys, since OTA update does not work properly, you need to manually turn off and go to recovery for manual installation
    What do you mean by "restart with the keys"? U can enable advanced restart menu in Settings -> System -> Gestures -> Power Menu -> Advanced Restart and reboot directly into recovery. Btw OTA works just fine. Recovery (TWRP HH) sometimes fails to install OTA update, but in case of auto installation failure u can mount /data and install update from /data/lineageos_update/
     
    Last edited:
    • Like
    Reactions: Gynlemon

    Top Liked Posts

    • There are no posts matching your filters.
    • 14
      New build of LOS 18.1 is out (lineage-18.1-20210525-UNOFFICIAL-hammerhead-signed).
      Short changelog:
      1. Latest LOS source code
      2. Fixed some SELinux denials
      3. Added voice call recording in standard Dialer app. Will not work with current criterion kernel. @Slmnj, check my kernel for required commits.
      4. Enabled 'TTL' target support in kernel. Fix ttl should work from now. Be very careful using it because this feature EXTREMELY DANGEROUS.
      5. Other small improvements in the kernel.
      1
      Just updated to the latest (i.e. the June) build and it's stuck on the lineageos splash screen. :-( Then flashed the May 25 release and same thing. Going back one more now… That's where I was before I jumped over the May 25 release to the June 02 release and this all started going to hell.
      Every build was tested by my testers with 2 scenarios:
      1. Dirty flash (Update from previous version)
      2. Clean flash

      And only after such tests new build will be uploaded to sourceforge.
      So, there is something wrong with your setup. Make a clean install.
      1
      Bruh, this didn't help one bit
      I just wanted show you how easy it is to find the group with Google Search or any other search engine you may prefer.
    • 45
      LineageOS 18.1 is a free, community built, aftermarket firmware distribution of Android 11.0 (R), which is designed to increase performance and reliability over stock Android for your device.

      Code:
      #include <std_disclaimer.h>
      
      /*
      * Your warranty is now void.
      *
      * We are not responsible for bricked devices, dead SD cards,
      * thermonuclear war, or you getting fired because the alarm app failed. Please
      * do some research if you have any concerns about features included in this ROM
      * before flashing it! YOU are choosing to make these modifications, and if
      * you point the finger at us for messing up your device, we will laugh at you.
      *
      */
      LineageOS is based on the Android Open Source Project with extra contributions from many people within the Android community. It can be used without any need to have any Google application installed. Linked below is a package that has come from another Android project that restore the Google parts. LineageOS does still include various hardware-specific code, which is also slowly being open-sourced anyway.

      The source code for LineageOS is available in the LineageOS Github repo. And if you would like to contribute to LineageOS, please visit our Gerrit Code Review. Your changelog is whatever was merged into gerrit.

      Known bugs:
      Screen mirroring via slimport HDMI adapter doesn't work.
      PMF aka 802.11w doesn't work.
      Encryption has problems. Read more about it here

      Downloads:
      ROM: https://sourceforge.net/projects/hammerhead-lineageos/files/18.1/
      GAPPS: https://opengapps.org/?arch=arm&api=11.0&variant=pico

      Credits:
      Many thanks to the LineageOS team and all the contributors out there in the community

      Contributors:
      z3DD3r

      Source Code:
      Device tree: https://github.com/z3DD3r/android_device_lge_hammerhead/tree/lineage-18.1
      Kernel tree: https://github.com/z3DD3r/android_kernel_lge_hammerhead/tree/lineage-18.1
      Vendor tree: https://github.com/z3DD3r/android_vendor_lge/tree/lineage-18.1

      Android version: 11.0.0 (R)
      Kernel version: Linux 3.4.113
      Status: Stable

      Created 2021-01-07
      Last Updated 2021-06-08
      16
      Hello

      New build is out. Short changelog:
      1. April's security patch
      2. Fixed GPS blobs
      3. Fixed SELinux denials
      4. Fixed Wi-Fi Display
      5. Added some changes in kernel
      6. Improved memory usage

      Some notes about last item. I have enabled some options which are used on low memory devices with Android GO. It doesn't mean that i've build GO version of android. This will improve memory usage and more memory will be available.

      Huge thanks to @tapecoda for tests!
      15
      Hello

      New build is out. Short changelog:
      1. May's security patch
      2. Minor improvements in device tree and kernel
      14
      New build of LOS 18.1 is out (lineage-18.1-20210525-UNOFFICIAL-hammerhead-signed).
      Short changelog:
      1. Latest LOS source code
      2. Fixed some SELinux denials
      3. Added voice call recording in standard Dialer app. Will not work with current criterion kernel. @Slmnj, check my kernel for required commits.
      4. Enabled 'TTL' target support in kernel. Fix ttl should work from now. Be very careful using it because this feature EXTREMELY DANGEROUS.
      5. Other small improvements in the kernel.
      11
      New build (2020-02-05) is up!
      This one includes improvements for lowmemorykiller from motorola which should improve memory usage
    Our Apps
    Get our official app!
    The best way to access XDA on your phone
    Nav Gestures
    Add swipe gestures to any Android
    One Handed Mode
    Eases uses one hand with your phone