Partition based emuMMC and L4T Ubuntu on the same SD card

Discussion in 'Switch - Tutorials' started by lordelan, Jul 21, 2019.

  1. lordelan

    lordelan GBAtemp Psycho!

    Jan 4, 2015
    I take no responsibility for any damage that following this guide might cause to you, your Switch, other devices or your neighbourhood! You have been warned!

    With this guide you will create an emuMMC that can be used by KOSMOS/Atmosphère and SX OS. If you don't need/want the latter, you can follow other guides for that but I'm not sure how partitioning is changed then and even if you intend not to use SX OS at all there should be no downside in following this guide as you will end up with an emuMMC that you can use in Atmosphère as well.

    Since both processes
    • creating a partition based emuMMC
    • flashing the L4T Ubuntu image to the SD card
    are each wiping the whole card, you can't simply do one after the other to achieve this. That's why some more work has to be done.

    My way might seem to be a bit laborious but it just worked for me so here's what I did:
    1. Make a full NAND dump with hekate including BOOT0/1 just in case
    2. Since all data will be deleted from your SD card following these steps, create a temp folder on your computer and copy everything into it
    3. Download SX OS boot.dat and put it on the SD card's root directory
    4. Download their payload.bin as well and fire that up on your Switch while it is in RCM and while you hold VOL+
    5. In the SX OS bootmenu click the right button and then emunand
    6. Create a partition based emuNAND from there - this will take some time
    7. After it's finished, put your SD card in your computer. You will have a
      You will end up with the following:
      [30 GB hidden partition][rest of the card formatted to FAT32 with boot.dat on it]
    8. Take a USB flash drive (!) and flash the L4T Ubuntu image with Etcher to it
      (all data on the flash drive will be deleted!)
    9. Download either a GParted live image or any live Linux distribution (I took Ubuntu amd64) and flash/write that to another flash drive or a DVD so you can boot from it
    10. Boot your computer from it while your Switch SD card is connected to the computer so it is automatically mounted there
    11. Run GParted, unmount the FAT32 partition from there so you can resize it
    12. Resize it to free up some space for L4T Ubuntu. I resized it so there were around 16 GB after it at the end of the SD card
    13. Create an EXT4 partition in that unallocated free space with GParted and hit the apply button so both operations (resizing FAT32 and creating EXT4 partition) will be done - this will take some time
    14. Download a CloneZilla Live and flash/write that to a flash drive or DVD
      I burned it to a DVD with imgburn
    15. Boot your computer into CloneZilla while these both things are connected to your computer:
      • Switch SD card
      • flash drive from step 8 where you flashed the L4T image to
    16. In CloneZilla choose the options to clone not a whole drive but only a partition to another
    17. Choose expert mode so you can untick the option (with SPACE) to resize the destination partition size to the source partition size
    18. As the source partition choose the EXT4 partition (not the FAT32 one) from the flash drive from step 8
    19. As the destination partition choose the EXT4 partition from your Switch SD card that you just created with GParted
    20. Very important: remember how the devices are labeled (for example sdb, sdc, sdd and so on)
      In my case my source device (the flash drive from step 8) was sdb and the EXT4 partition on it was sdb1
      and my destition device (Switch SD card) was sdc and the destition EXT4 partition was sdc3
      What you need to remember now is the label of your source device (the USB flash drive)
    21. Now proceed and hit Y on both warnings that all data in the destination partition will be deleted (that's fine, it's really just the partition, not the whole SD card including your created emuMMC)
    22. Most likely CloneZilla will now complain that source and destition partition tables (MBR and GPT) are not the same and you have to resolve that first
      That's why I told you to remember the label from your flash drive!
      Hit ENTER and then get into the shell/commandline and type the following:
      sudo sgdisk -z /dev/sdx
      (where you replace x by the letter that you remembered)
      In my case it was /dev/sdb (without any numbers behind it)
      Confirm all warnings
    23. Now head back to step 16 and repeat the steps to clone the drive
      It should work now without complaints from CloneZilla
    24. After that is finished, boot back into your usual operation system on your computer and copy everything from your temp folder back to the FAT32 partition that you should be able to access from there
    25. Windows might complain about two "drives" that are not readable and need to be formatted - obviously that's your emuMMC and your L4T Ubuntu partition and you don't want to format them ... just ignore the messages
    26. Download the most recent L4T update (at this time it's 1.3.1), delete the boot.scr file and the boot folder (not to be confused with the bootloader folder!), then copy the content of the L4T update zip to the FAT32 partition of your SD card
    27. On your SD card rename the Nintendo folder to Emutendo
      If you boot into the emuMMC now all games that you had installed previously are present there
      If you want them to be present in your sysNAND instead for whatever reason leave the folder by its name Nintendo
    28. Edit you're SD:\bootloader\hekate_ipl.ini to cover all your needs (CFW emuMMC, Stock sysNAND, CFW sysNAND, L4T Ubuntu, whatever else you want)
      You can find an example of mine at the end of this guide
      The emuMMC section is important as it has to be exactly like that for Atmosphère to detect it
    29. On your SD root directory create a folder called emuMMC
    30. Inside that folder create an empty text file called emummc.ini and open it with a text editor
    31. Paste into it what I put at the end of this thread and save the file
    maybe obsolte
    Congratulations, that should be it. Now you can boot everything from within hekate.
    Keep in mind that the initial boot of L4T Ubuntu takes some time while the screen is black. Be patient!
    Also let me give you the advice to choose different themes for your sysNAND and emuMMC. I have the white theme enabled in my sysNAND while I have the dark theme in my emuMMC environment so I always definitely know where I am.

    Here's my promised hekate_ipl.ini:
    {AtlasNX/Kosmos v13.0.2}
    {Pegascape DNS:}
    {--- Custom Firmware ---}
    [CFW (EMUMMC)]
    [SX OS]
    [Argon NX]
    {--- Stock ---}
    [Stock (SYSNAND)]
    [L4T Ubuntu]
    And here's the emummc.ini:
    enabled = 1
    sector = 0x2
    nintendo_path = Emutendo
    What if I buy a new/bigger SD card later on?
    Last edited by lordelan, Jul 23, 2019
    ry755, Worldblender, Powerful and 6 others like this.
  2. ~~Tito~~

    ~~Tito~~ GBAtemp Regular

    Apr 7, 2009
    United States
    Thanks for the write up! I have not had a chance to finish the process. I'm glad that you found a way to get this to work! I may go the extra mile and have a quadboot solution, but I'm not sure if it would work. L4T Lakka and Ubuntu. Not sure which is better to be honest, but I'll sort it out tonight.
    lordelan likes this.
  3. lordelan

    lordelan GBAtemp Psycho!

    Jan 4, 2015
    I don't care that much for Lakka since you can install RetroArch in Ubuntu as well but right now I can ...
    • launch sysNAND stock
    • launch sysNAND Atmosphère
    • launch emuNAND Atmosphère
    • launch emuNAND SX OS
    • launch L4T Ubuntu
    ... which is really cool. All from within that fantastic lookin' new hekate Nyx. :)
    tatumanu and ~~Tito~~ like this.
  4. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    Oct 27, 2002
    Engine room, learning
    I don't know if it's fixed yet, but last time I checked Lakka website, it said if ubuntu partition is present, lt would launch it in priority and lakka would not work.
    maybe it's fixed, but I just wanted to tell you that if it's not fixed, it's just a bug and might not be your setup which is wrong.

    wouldn't it be a little dangerous to launch sysNAND atmosphere on a sysNAND with network access?
    well, it's possible, but maybe should be prevented, unless you keep your sysNAND on plane mode by default, and set all network to not auto-connect, so you can enable it only when you are on stock and know you are safe.

    about your guide, first thanks for taking the time to do all the tests and to write it.
    I have some question about other possible method:
    1. you don't need a license to make emuNAND partition? only xci playing? great :D
    2- when installing the linux partition with etcher directly on SD, does it let you choose the partition size or is it a fixed image size? what if your SD is of a different size? Does it always end at the end of the SD?
    3- if it's not overwriting the full SD card, but just writing the image at the end, then it's not really "wipping out" the SD card content and other partion's data. it's only overwriting the partition table located on first sector.

    My idea would be to :
    - install both linux and emuNAND partitions one by one, and each time dump the MBR (actually, only the partition table with is few bytes) and merge the information at the end.
    - install linux partition on the latest partition (or let etcher make one)
    - create emuNAND partition (at the beginning) it'll erase the partition table, but NOT the actual ext4 partition content.
    - restore the MBR to get back your partition positions

    okay, that's just the idea, not the real steps. What I meant is "write or restore MBR manually" because creating a partition does NOT overwrite partition data, only the table.
    you can also calculate the FAT32 position size manually.

    Steps would be :
    Burn linux partition (you get fat32+linux) and store both sector start and sector size in a file by checking the MBR in hexeditor. make emuNAND+FAT32 (which DID NOT PHYSICALLY DELETE EXT4, only it's partition information is lost). again store both sector start and sector size. calculate FAT32 size by substracting linux size and emuNAND size. Edit MBR manually to shorten FAT32, and re-add the linux partition start/length as 3rd partition definition in the partition table. if the FAT32 file table also contains the partition size information, you could resize it in a partition manager to make enough "unnallocated space" at the end to free the linux content which is still here, just really hidden, it's easier than subtract and is less prone to error than doing it manually.
    This is how I would have done it, without using linux tools or partition managers at all, just an hex editor.

    there's also dd option instead of using linux tools burned on flashdrives etc.
    burn linux, dump it with dd to keep it.
    burn emuNAND
    resize FAT32 to free enough size at the end. create a new partition (unformatted, doesn't matter if it's FAT32, nor how much cluster size you use, really! it would even be better to make it ext4 directly if your manager allows it), use dd to restore the linux partition at the end. change MBR to set it to ext/linux type if not already that.
    Method2 is actually even faster and easier because you don't need to dump/calculate MBR yourself.

    You can also make 2 partitions manually and use that tool if you don't want SXOS compatibility :, advantage is you can place it wherever you want.
    hint: Does Linux really has to be at the end? I would make it : emuNAND+Linux+resizable FAT32 in case I want to use a bigger SD card later.

    I want to make a dual boot too, so I might write a guide with pictures while doing it myself.
    but your solution is good too :) it just uses a lot of different tools and steps.
    Last edited by Cyan, Jul 21, 2019
    lordelan likes this.
  5. lordelan

    lordelan GBAtemp Psycho!

    Jan 4, 2015
    Hi Cyan, cool to hear from you. :)

    Don't worry. That's exactly what I did: I set it to manually so I don't connect to it if I ever start the sysNAND with Atmosphère.
    Only reason to do it would be to restore a savegame from my old "hacky" sysNAND (which is my emuNAND now) to a game on my "clean" sysNAND now that I can play it online there.
    Of course this does not involve cheating in online games and I hope no one does but as an example:
    Since I feared going online for all the time until emuEMMC came up, I started my Diablo III savegame offline obviously and might want to restore that to my sysNAND now so I can play with my character online with others. :)
    Correct. I was surprised by this as well but you really don't need a licence for that.
    You can even boot into SX OS without a licence and run the hbmenu from there (which was a launch feature iirc) but there's no sig patches and no XCI loading.
    I can definitely say it works since right after I finished yesterday, I did my method to a friend's Switch as well and he does not own a licence. ;)
    The problem is that if you create an emuNAND with SX OS, it formats your whole SD card, creates a partition for the emuNAND and an empty FAT32 partition.
    Kind of the same happens if you flash the L4T img with Etcher. Again it would format the whole SD card and then create a FAT32 partition and an EXT4 partition.
    That's why I took a USB flash drive in step 8 as a temporary "in the middle device" for that because all I wanted was the EXT4 partition with its content that Etcher would flash this way. So I wouldn't recommend to flash it directly to your SD obviously as it would delete the emuNAND (and everything else).
    But to answer your question: The size of the destination device (SD or flash drive) for Etcher doesn't matter. It's a fixed size FAT32 partition (don't remember the size right now) and an EXT4 partition with I think 8 GB (don't remember that as well now but it's fixed to that). After that EXT4 partition all the left space (depending on your flash drive/SD size) is unallocated space. That's why most L4T install guides involve rezising the EXT4 partition to the max possible size afterwards.
    However with my guide and if you use expert options in CloneZilla you clone that EXT4 partition to an EXT4 partition on the SD that you manually created with GParted before and which size you chose. Just make sure that it's bigger and to uncheck the option in CloneZilla to resize the destination partition to the source partition's size as I wrote. :)
    Afair the source partition was 8 GB and my manually created one was 16 so that worked out well and I have some space in Ubuntu right now.
    I might be wrong about that (didn't try obviously since I didn't wanted to wipe my emuNAND) but according to all guides, Etcher definitely wipes the full SD card and creates those two partitions I mentioned.
    Cool, didn't know about that.
    I don't know tbh. It seems like Horizon is just looking for a FAT32 partition and boots it but I can't promise you that.
    But if I would buy a bigger card, I would:
    1. Clone the whole card to the new one which should leave me with some unallocated space at the end since the new card is bigger
    2. Delete the EXT4 partition from the new SD card
    3. Resize the FAT32 partition on the new SD card so it leaves just the amount of space I need for Ubuntu at the end (for example 16 GB)
    4. Create a new EXT4 partition at the end in the left unallocated space
    5. Use the method from my guide to clone the EXT4 partition from my old SD card to the new one
    Sounds like quite some work but on the other hand I don't see me getting a bigger SD card that often. :D
    Nice, go ahead. Always liked your guides.
    Also it might be better for endusers as my guide was just a quick and dirty write up last night before I went to bed and I just wanted to get the steps down as long as I remember them.
    ~~Tito~~ and Cyan like this.
  6. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    Oct 27, 2002
    Engine room, learning
    Tariq is currently writing a guide to quadBoot, so I'll wait to see how he does. If my idea is different than his, I'll try and write a guide if it works.

    By reading at L4T thread, I'm not sure the linux partition is located at the end. if feels like it's near the beginning (small FAT32+8GB Linux) that you can move/resize as you want in your favorite partition manager after l4t flashing.
    so sxos emuMMC/L4T are indeed overwriting eachother. you don't just dd a partition or sector position but the full card's beginning, that's why tariq said to extract the partition from the image, the image contains the MBR the linux and a fat32 partition.

    etcher is 110Mb? what's inside?
    I'll use dd or any of the 3DS nand writer tools we used to use, like Win32DiskImager :)

    edit: by checking the sd.img, the MBR contains 2 Linux partitions. no FAT32.
    Partition 1 : 0020210083EE323C0008000000E80E00, type 0x83 (linux), Start 0x00000800 (2048) * 512 = 0x00100000 , size 0x000EE800 (976896) * 512 = 500.170.752 = 500MB
    Partition 2 : 00EE333C8355011400F00E000010F100, type 0x83 (linux), Start 0x000EF000 (978944) * 512 = 0x1DE00000, size 0x00F11000 (15798272) * 512 = 8.088.715.264 = 8GB

    Partition 1 - FAT
    MBR says it's Linux, but the partition itself says it's mkfs.fat. so it's a "FAT32 under linux", not a native MS-DOS FAT32.
    But, maybe it's a requirement because Linux needs to access the files on that partition? it doesn't work with other FAT type?

    does the FAT partition in the image contains files you need? or do you need only the linux partition?

    Partition 2 - Ext4

    I suppose you can dd the linux partition to your SD using something like this :
    dd if=sd.img skip=978944 of=/dev/sda seek=xxxxxx bs=512 count=15798272

    dev/sda/ : replace with your SD card device, don't use a partition info.
    skip=978944 : Skip 978944 block of 512 bytes on the source. (start at 978944th sector, where Linux partition is). Linux Start LBA defined in MBR.
    seek=xxxxxx : number of sector you want to skip on your destination SD before starting to to write. beware, sector0 is the first one. Seek=1 is NOT the first sector, but the second one.
    bs=512. number of byte per sector. keep bs at the end of the command line or it'll use default value (2048) instead.
    count=15798272 : number of sector to copy, Linux partition size defined in MBR.

    or if you want to extract only the linux partition to a new file to use a different tool to write to an existing partition :
    dd if=sd.img skip=978944 of=linux.img bs=512 count=15798272
    if you already created a partition on your SD, I guess you could use /dev/sda/xxx (partition number?), and don't "seek", write the "linux partition" image at first partition's sector. be sure your partition is big enough (8.088.715.264 byte).
    or you can use a bigger partition than the linux image but you'll waste space, it's not a problem if your partition table has a bigger partition size than the real partition's size as long as you don't intend to resize it later. (the contrary is really bad!)

    Okay, based on everything I gathered above:
    New tutorial:
    - dump emuMMC and write to SD with your preferred method (or use sxOS, or hekate)
    - resize the FAT32 to ~8GB (exactly 8.088.715.264 or bigger) it will become your linux partition, and create a new FAT32 partition at the end
    - use dd or any other tool to write linux img to linux partition
    - edit MBR with hexeditor to set "83" instead of "0C" on your 2nd partition type. If you used "FAT32" as original partition to put your MMC into, set it to "00" too make it unallocated, or else the console will try to mount it as the first FAT partition.
    [00 unallocated emuMMC][83 Linux][0C FAT32]

    FAT32 at the end lets you resize it to fill the entire SD Card remaining space, which is very useful if you plan to install nsp/xci, or any other homebrew data on it, like diablo, morrowind, alien vs predator, etc..

    Sorry, I hijacked your tutorial thread.
    I can move it to another thread if you prefer, but it's not verified, it's only theoretical ! use with care!
    If anyone found these useful, let me know :)
    Last edited by Cyan, Jul 21, 2019
    ~~Tito~~ and lordelan like this.
  7. ~~Tito~~

    ~~Tito~~ GBAtemp Regular

    Apr 7, 2009
    United States
    For those who are having trouble getting the appropriate environment setup. I was able to get a ubuntu live cd working with persistent storage. Also installed clonezilla. Will now be able to go through with this!

    I was initially partitioning the drive via the live CD... then booting back into windows... Hopefully having native GParted and clonezilla on the same OS will solve a lot of my headaches.
    Haven't booted yet, but here are the steps I took:
    • Use SXOS to make EmuNand hidden partition
    • Use Hekate to migrate emummc
    • Use GParted to create Ext4 partition and remainder FAT32
    • Use Disks tool in linux to restore 1.img from L4T ubuntu build to the ext4 partition
      • Disks will also let you correct the hex partition flag
    • Restore data from your backup
    • Modify the appropriate configuration .ini's
    Last edited by ~~Tito~~, Jul 22, 2019
    Cyan and lordelan like this.
  8. lordelan

    lordelan GBAtemp Psycho!

    Jan 4, 2015
    Ah, I guess we misunderstood each other.
    If you flash the img with Etcher to a drive or card, it actually is at the beginning so if you look at it that way you are right but from those two partitions, the actual L4T Ubuntu EXT4 partition is the second one (and thus at the end). That's why I put it at the end of my SD card in my guide as well because it seemed like it had to be the last partition. Still not sure though if that's a must. :)
    In fact I tried extracting and manually copying over the files inside Ubuntu first but it wouldn't let me due to some protected files/folders. That's why I decided to just clone the whole partition as it is to my SD card and use a temporary device (my USB flash drive) in step 8.
    Well I was suprised by this as well but since it was the official recommended install method from ByLaws I went with it to be as safe as possible.
    I don't think so. As you can see, the FAT32 partition that you end up with if you are following my guide, is the one, that SX OS's emuNAND script creates (only resized with GParted) so it's not a "tricky Linux FAT partition" that the L4T image contains and as I said Ubuntu is working for me with it.
    I looked it up again (on my temporary flash drive) and all files are kind of obsolete.
    In fact it only includes the files needed for hekate to boot Linux.
    It includes these folders:
    and this file
    If you apply the 1.3.1 update (which you can do even before you launch Ubuntu for the first time) you would have to delete the boot folder and the boot.scr file anyway before you copy them over from the update zip. So those two can be ignored completely in the img.
    What's left? The bootloader folder.
    It only contains an ini with the following content:
    You guessed right: You don't need that as well as you simply add this to your hekate_ipl.ini (look at the end of my guide) which is better anyway since you have it along your other launch options in hekate instead of having to go the way of other configs there.
    You are very welcome. The more info that can be gathered here, the better for everyone. :)

    Also as a sidenote without quoting more things you wrote: I read a lot about dd as well when trying to find out how to do this but I wasn't familiar enough with it so I considered CloneZilla the easier and safer way for me.
    But if you know what you're doing, dd should be the better (and faster) option.
    Cyan likes this.
  9. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    Oct 27, 2002
    Engine room, learning
    yeah, I always fear to mess things with dd, it's unforgivable if you make a mistake.
    yesterday I tried the "extract linux" partition to file, and found that "bs=512" didn't work if it was at the beginning, it needs to be located after "if=". At least, I tried that and can confirm it's working fine.
    I didn't try to write to SD yet.
    lordelan likes this.
  10. lordelan

    lordelan GBAtemp Psycho!

    Jan 4, 2015
    Wow somehow I was totally confused and wrote (and named) it emuEMMC instead of emuMMC.
    Sorry for that. Fixed it in my guide.
    If you name it right (without the E in the middle) you don't need to migrate it in hekate afterwards I guess.
    Will have to find out when I'm at home.
    tatumanu likes this.
  11. tatumanu

    tatumanu GBAtemp Advanced Fan

    Nov 1, 2004
    Wonderful work! Thank you so much I was needing this tutorial badly!
    lordelan likes this.
  12. ~~Tito~~

    ~~Tito~~ GBAtemp Regular

    Apr 7, 2009
    United States
    I think I did everything correctly, however I'm not able to boot into anything other than SXOS sysnand. When I try to run the Atmostphere payload it prompts with a message stating that it cant find an SD. Booting into stock horizon prompts with the format SD card message. L4T does not boot either.

    Haven't played with this too much. I'm assuming that my partition table is not setup correctly.

    My Partitions:

    [Unallocated space][EXT4 11gb][FAT32 400+gb]

    I did want to have the option to resize FAT32 so I placed it at the end. Is that what is screwing up everything? I can move everything later if I need to... I don’t think I have to though.

    I’ll probably review the hex stuff in windows. I’m tempted to unhide the SXOS partition so I can rebuild the rest of the card with out worrying about the unallocated space getting over written.
    Last edited by ~~Tito~~, Jul 22, 2019
  13. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    Oct 27, 2002
    Engine room, learning
    if Horizon asks to format, maybe the table is wrong.
    your partition table is still MBR ?
    maybe your manager changed it to GPT?

    Or the unallocated space is not really unallocated on the MBR? maybe it kept its old partition type code (fat32?) and the console tries to mount it.
    some manager don't always update the table when formatting a partition. I don't know what sxos or hekate does, I didn't try yet.

    if you want I can take a look at your partition table, or MBR sector if you make a dump or screenshot the first 512bytes in a hexeditor.
    Last edited by Cyan, Jul 22, 2019
    lordelan and ~~Tito~~ like this.
  14. ~~Tito~~

    ~~Tito~~ GBAtemp Regular

    Apr 7, 2009
    United States
    Thanks! I’ll check this when I get home. I cant boot into SXOS Emunand either.

    I’m thinking the table is bad some how.

    This is my MBR partition I believe? I can see the TXNAND section start right after it so I think everything is there. Not sure why it wont boot though.

    Offset(h)   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    0000000000  FA B8 00 10 8E D0 BC 00 B0 B8 00 00 8E D8 8E C0  ú¸..ŽÐ¼.°¸..ŽØŽÀ
    0000000010  FB BE 00 7C BF 00 06 B9 00 02 F3 A4 EA 21 06 00  û¾.|¿..¹..ó¤ê!..
    0000000020  00 BE BE 07 38 04 75 0B 83 C6 10 81 FE FE 07 75  .¾¾.8.u.ƒÆ..þþ.u
    0000000030  F3 EB 16 B4 02 B0 01 BB 00 7C B2 80 8A 74 01 8B  óë.´.°.».|²€Št.‹
    0000000040  4C 02 CD 13 EA 00 7C 00 00 EB FE 00 00 00 00 00  L.Í.ê.|..ëþ.....
    0000000050  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000060  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000070  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000080  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000090  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00000000A0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00000000B0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00000000C0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00000000D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00000000E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00000000F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000100  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000110  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000120  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000130  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000140  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000150  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000160  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000170  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000180  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    0000000190  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00000001A0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00000001B0  00 00 00 00 00 00 00 00 DA 68 67 C2 00 00 00 01  ........ÚhgÂ....
    00000001C0  01 00 83 FE FF FF 02 20 A4 03 FE 07 40 01 00 FE  ..ƒþÿÿ. ¤.þ.@..þ
    00000001D0  FF FF 0C FE FF FF 00 28 E4 04 00 D8 B8 36 00 00  ÿÿ.þÿÿ.(ä..ظ6..
    00000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00000001F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA  ..............Uª
    Yeah taking a look, it looks as though when I wrote to the space after the unallocated area the MBR was modified. Not sure how I would actually get that information back.

    00 01 01 00 83 FE FF FF 02 20 A4 03 FE 07 40 01
    00 FE FF FF 0C FE FF FF 00 28 E4 04 00 D8 B8 36
    These are the only two partitions listed in the MBR. I can see the 83 code, and the 0C code. Which explains why Hekate can read the fat32 partition. This doesn't explain why linux doesn't boot though. I may just redo the card and create the linux partition at the end.

    I looked at the starting sector of each subsequent partition and I only found two headers. One for the emunand, and the other for the FAT32 partition. I didn't see anything listed in ubuntu other than an ubuntu file path a few sectors over.

    Emu Nand Header - Starts at sector 1 ends at 61087745
    Offset(h)   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    0000000200  54 58 4E 41 4E 44 00 00 00 00 00 00 00 00 00 00  TXNAND..........
    0000000210  54 65 61 6D 20 58 65 63 75 74 65 72 20 96 20 52  Team Xecuter – R
    0000000220  6F 63 6B 69 6E 67 20 74 68 65 20 53 77 69 74 63  ocking the Switc
    0000000230  68 20 66 6F 72 65 76 65 72 20 61 6E 64 20 62 65  h forever and be
    0000000240  79 6F 6E 64 00 00 00 00 00 00 00 00 00 00 00 00  yond............
    0000000250  00 20 A4 03 02 00 00 00 00 00 00 00 00 00 00 00  . ¤.............
    Ubuntu Header starts at 61087746, but nothing appears until 61087748. Ends at 82061311
    Offset(h)   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    0748400800  00 E7 09 00 00 00 28 00 FE FF 01 00 CD 72 13 00  .ç....(.þÿ..Ír..
    0748400810  5A 33 07 00 00 00 00 00 02 00 00 00 02 00 00 00  Z3..............
    0748400820  00 80 00 00 00 80 00 00 B0 1F 00 00 A5 B5 35 5D  .€...€..°...¥µ5]
    0748400830  A5 B5 35 5D 01 00 FF FF 53 EF 01 00 01 00 00 00  ¥µ5]..ÿÿSï......
    0748400840  62 B5 35 5D 00 00 00 00 00 00 00 00 01 00 00 00  bµ5]............
    0748400850  00 00 00 00 0B 00 00 00 00 01 00 00 3C 00 00 00  ............<...
    0748400860  C6 02 00 00 7B 00 00 00 15 F1 03 09 38 5B 4A 18  Æ...{....ñ..8[J.
    0748400870  88 78 C2 99 CC 90 8D 8A 00 00 00 00 00 00 00 00  ˆx™Ì..Š........
    0748400880  00 00 00 00 00 00 00 00 2F 6D 65 64 69 61 2F 75  ......../media/u
    0748400890  62 75 6E 74 75 2F 31 35 66 31 30 33 30 39 2D 33  buntu/15f10309-3
    07484008A0  38 35 62 2D 34 61 31 38 2D 38 38 37 38 2D 63 32  85b-4a18-8878-c2
    07484008B0  39 39 63 63 39 30 38 64 38 61 00 00 00 00 00 00  99cc908d8a......
    FAT32 Header Starts at 82061312 ends at 1000144895
    Offset(h)   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    09C8500000  EB 58 90 6D 6B 66 73 2E 66 61 74 00 02 40 40 00  ëX.mkfs.fat..@@.
    09C8500010  02 00 00 00 00 F8 00 00 3F 00 FF 00 00 28 E4 04  .....ø..?.ÿ..(ä.
    09C8500020  00 D8 B8 36 C0 B5 01 00 00 00 00 00 02 00 00 00  .ظ6Àµ..........
    09C8500030  01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    09C8500040  80 01 29 1E E3 AE E9 53 57 49 54 43 48 42 52 41  €.).ã®éSWITCHBRA
    09C8500050  49 4E 46 41 54 33 32 20 20 20 0E 1F BE 77 7C AC  INFAT32   ..¾w|¬
    09C8500060  22 C0 74 0B 56 B4 0E BB 07 00 CD 10 5E EB F0 32  "Àt.V´.»..Í.^ëð2
    09C8500070  E4 CD 16 CD 19 EB FE 54 68 69 73 20 69 73 20 6E  äÍ.Í.ëþThis is n
    09C8500080  6F 74 20 61 20 62 6F 6F 74 61 62 6C 65 20 64 69  ot a bootable di
    09C8500090  73 6B 2E 20 20 50 6C 65 61 73 65 20 69 6E 73 65  sk.  Please inse
    09C85000A0  72 74 20 61 20 62 6F 6F 74 61 62 6C 65 20 66 6C  rt a bootable fl
    09C85000B0  6F 70 70 79 20 61 6E 64 0D 0A 70 72 65 73 73 20  oppy
    09C85000C0  61 6E 79 20 6B 65 79 20 74 6F 20 74 72 79 20 61  any key to try a
    09C85000D0  67 61 69 6E 20 2E 2E 2E 20 0D 0A 00 00 00 00 00  gain ... .......
    At this point I'm pretty much format my SD card completely and start from scratch. I'm going to compare the MBR table to before I repartition the SD after emunand is created vs after.
    Last edited by ~~Tito~~, Jul 23, 2019
    lordelan likes this.
  15. lordelan

    lordelan GBAtemp Psycho!

    Jan 4, 2015
    @~~Tito~~ @Cyan
    I had that message to format the SD on my sysNAND as well.
    Two things have to be taken care of:
    1. If you copy back the entire content of your SD from your PC you will end up with a Nintendo folder that isn't matching with your sysNAND (since you turned the matching sysNAND into your emuNAND) so you have to rename that one to Emutendo.
    2. Your sysNAND has to be on 5.1.0 or above because that's where it stopped showing that message for me. I updated the FW with Super Mario Party cartridge.
    Last edited by lordelan, Jul 23, 2019
    ~~Tito~~ and Cyan like this.
  16. ~~Tito~~

    ~~Tito~~ GBAtemp Regular

    Apr 7, 2009
    United States
    I’m running 8.1.0. Forgot about renaming the folder though.

    I want to boot linux lol. So not being able to boot that is concerning. Prior to creating the ext4 partition. I did not get that message. Going to try adding it at the end to see if that will sort it out. I’m assuming that for what ever reason the OS is reading the linux partition before the FAT32 partition.
  17. lordelan

    lordelan GBAtemp Psycho!

    Jan 4, 2015
    Oh that's really interesting. Either something with the partition table is messy or this is kind of the prove that the EXT4 partition indeed has to be at the end (unfortunately).
    ~~Tito~~ likes this.
  18. ~~Tito~~

    ~~Tito~~ GBAtemp Regular

    Apr 7, 2009
    United States
    As soon as I add a Ext4 partition to the card manually. Things stop working. Not sure why though. Going to try a few things. I didn't verify that Horizon or hekate was able to read the card after resizing the partition. I went straight to creating an EXT4 partition after the resize...

    This is becoming cumbersome.

    I'm starting to wonder if its worth creating an SD image so I can DD flash it instead of having to redo the SD via SXOS multiple times...
    Last edited by ~~Tito~~, Jul 23, 2019
  19. lordelan

    lordelan GBAtemp Psycho!

    Jan 4, 2015
    Tbh I was really surprised that it just worked what I did involving all those steps and GParted and CloneZilla but it did for me.
    Your issue is really strange. How did you create that EXT4 partition? As I wrote, I did it with GParted (from withing a computer Ubuntu).
    Also your FAT32 partition is still the one that SX OS created? You didn't do anything to it but to resize it? With which tool did you resize it?

    Since my guide worked I would recommend you to try it. I know it sucks to have the EXT4 partition at the end if you want to upgrade to a bigger SD card later on but even for that there's a workaround (that I replied earlier in this thread to Cyan although I didn't test it yet obviously).

    In short, from current SD (SD1) to a bigger one (SD2):
    1. CloneZilla: Clone the whole SD1 to SD2
    2. GParted: Delete the EXT4 partition on SD2
    3. GParted: Resize the FAT32 partition on SD2 as you like but leave some space at the end for L4T Ubuntu
    4. GParted: Create an EXT4 partition out of that left unallocated space at the end of SD2
    5. CloneZilla: Clone only the EXT4 partition from SD1 to the newly created EXT4 partition on SD2 (similar to how I do it in my guide with my temporary flash drive to get Linux onto my SD card)

    Edit: Added those steps in a spoiler tag to the end of my original post.
    Last edited by lordelan, Jul 23, 2019
    ~~Tito~~ likes this.
  20. ~~Tito~~

    ~~Tito~~ GBAtemp Regular

    Apr 7, 2009
    United States
    I don’t know where my 32gb flash drive is so I’ve been using my other 128gb micro sd as my linux boot drive lol. So cloning is out of the question until I become frustrated enough to go dig out my drive from where ever it is.

    Also. Yes, the only thing I did this last go around was resize the FAT32 partition SXOS created. Then I used GParted to create a 15gb Ext4 partition at the end of my card.

    When I went to verify booting from the SD. Hekate complained that I didn’t have a FAT partition. So something is definitely changing in the MBR boot table.

    The method I’m using should work as all I’m doing differently is cutting out the cloning steps and writing the 1.img directly to the Ext4 partition I made.

    I don’t know enough about partition tables and such to really dive in and troubleshoot exactly why I’m having so much trouble. I can probably figure it out eventually, but since I only have so much time to spare. It might take me a while.
    Last edited by ~~Tito~~, Jul 23, 2019
    lordelan likes this.
Quick Reply
Draft saved Draft deleted