Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

Partially OT - parted -l equivalent without sudo

Feel free to talk about anything and everything in this board. Just don't post offensive topics that are meant to cause trouble with other members or are derogatory towards people of different genders, race, color, minors (this includes nudity and sex), politics or religion. Let's try to keep peace among the community and for visitors.

No spam on this or any other forums please! If you post advertisements on these forums, your account may be deleted.

Do not copy and paste entire or even up to half of someone else's words or articles into posts. Post only a few sentences or a paragraph and make sure to include a link back to original words or article. Otherwise it's copyright infringement.

You can talk about other distros here, but no MX bashing. You can email the developers of MX if you just want to say you dislike or hate MX.
Post Reply
Message
Author
User avatar
Buck Fankers
Forum Novice
Forum  Novice
Posts: 61
Joined: Sat Mar 10, 2018 9:06 pm

Partially OT - parted -l equivalent without sudo

#1 Post by Buck Fankers » Mon Apr 02, 2018 7:12 pm

Didn't see Off Topic forum, hope this is OK to ask here

I'm looking for equivalent of this command:

Code: Select all

parted -l | grep "Partition Table: "
That does not need sudo.
I wrote a small python script in Manjaro, that i'm now porting here to MX, that check few logs for keywords such as "error', "failed"... and few other things. One of them is to check if OS is properly installed such as that partition table matches bios setting like this: BIOS+msdos or UEFI+gpt

I can check how is BIOS set with:

Code: Select all

test -d /sys/firmware/efi && echo UEFI || echo BIOS
But this one will not return anything unless I run it with sudo:

Code: Select all

parted -l | grep "Partition Table: "
Since it is bad sport to toss around to others code that ask for password, :-) I would rather have non sudo equivalent if it is possible. Anyone happen to knows what could I use instead of <parted -l | grep "Partition Table: ">?

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 8495
Joined: Sun Dec 16, 2007 1:17 pm

Re: Partially OT - parted -l equivalent without sudo

#2 Post by dolphin_oracle » Mon Apr 02, 2018 7:25 pm

I don't know if this will do quite what you want but

Code: Select all

udevadm info /dev/sda |grep ID_PART_TABLE_TYPE
will output a partition table type. you have to call each device though.
http://www.youtube.com/runwiththedolphin
eeepc 904ha antix 17 32 bit (streaming media player)
lenovo ThinkPad T530 - MX-17
lenovo s21e - antiX-17, MX17(live-usb)

User avatar
Buck Fankers
Forum Novice
Forum  Novice
Posts: 61
Joined: Sat Mar 10, 2018 9:06 pm

Re: Partially OT - parted -l equivalent without sudo

#3 Post by Buck Fankers » Mon Apr 02, 2018 8:13 pm

That works, thanks.
Do you happen to know, what exact info it returns on EFI machines?
Maybe:

Code: Select all

ID_PART_TABLE_TYPE=efi
Can't test it, my computers are old ;-)

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 8495
Joined: Sun Dec 16, 2007 1:17 pm

Re: Partially OT - parted -l equivalent without sudo

#4 Post by dolphin_oracle » Mon Apr 02, 2018 8:17 pm

well, efi is not a partition type, so it won't return anything.

what do you actually want to know?

this will tell you the Partition type of each partition

Code: Select all

lsblk -o NAME,LABEL,PARTTYPE
with output like

Code: Select all

NAME   LABEL           PARTTYPE
sda                    
├─sda1 SYSTEM_DRV      c12a7328-f81f-11d2-ba4b-00a0c93ec93b
├─sda2                 e3c9e316-0b5c-4db8-817d-f92df00215ae
├─sda3 Windows7_OS     ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
├─sda4 Lenovo_Recovery ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
├─sda5 rootMX17        44479540-f297-41b2-9af7-d131d5f0458a
├─sda6 datapart        ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
├─sda7                 0657fd6d-a4ab-43c4-84e5-0933c84b4f4f
├─sda8 rootMX17        44479540-f297-41b2-9af7-d131d5f0458a
└─sda9 dataext         0fc63daf-8483-4772-8e79-3d69d8477de4
sr0        



note on my sda1 partition this string

Code: Select all

c12a7328-f81f-11d2-ba4b-00a0c93ec93b
that is the GUID itentifier for ESP partitions, which are the partitions where efi stub files are stored for UEFI booting.

Good reading here: https://en.wikipedia.org/wiki/GUID_Partition_Table
http://www.youtube.com/runwiththedolphin
eeepc 904ha antix 17 32 bit (streaming media player)
lenovo ThinkPad T530 - MX-17
lenovo s21e - antiX-17, MX17(live-usb)

User avatar
Buck Fankers
Forum Novice
Forum  Novice
Posts: 61
Joined: Sat Mar 10, 2018 9:06 pm

Re: Partially OT - parted -l equivalent without sudo

#5 Post by Buck Fankers » Mon Apr 02, 2018 8:30 pm

On Manjaro, if you miss match installations, say you install it msdos + UEFI or BIOS + gpt, one of this combo will (or can) cause a problem. Some users managed to get this wrong and I have a noob script that check few things, check logs for errors, check this combo to see if install is correct. On Debian may not be the same. To check I run these two commands:

Code: Select all

test -d /sys/firmware/efi && echo UEFI || echo BIOS'
parted -l | grep "Partition Table: "
If output is one of these two pairs: BIOS+msdos or UEFI+gpt all is OK, otherwise there can be a problems.

On Manjaro i could run second command without sudo, so i could just put it into script. Here it requires SUDO, because of this I'm looking for alternatives, which you gave me. All I need is to know what it returns on newer, modern systems.

But maybe this whole check is not needed on MX systems anyway? I'm quite fresh in Linux world and me doing something silly is usually a norm ;)

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 8495
Joined: Sun Dec 16, 2007 1:17 pm

Re: Partially OT - parted -l equivalent without sudo

#6 Post by dolphin_oracle » Mon Apr 02, 2018 8:50 pm

gotcha
http://www.youtube.com/runwiththedolphin
eeepc 904ha antix 17 32 bit (streaming media player)
lenovo ThinkPad T530 - MX-17
lenovo s21e - antiX-17, MX17(live-usb)

User avatar
asqwerth
Forum Guide
Forum Guide
Posts: 2815
Joined: Sun May 27, 2007 5:37 am

Re: Partially OT - parted -l equivalent without sudo

#7 Post by asqwerth » Tue Apr 03, 2018 12:25 am

Buck Fankers wrote:On Manjaro, if you miss match installations, say you install it msdos + UEFI or BIOS + gpt, one of this combo will (or can) cause a problem. Some users managed to get this wrong...

If output is one of these two pairs: BIOS+msdos or UEFI+gpt all is OK, otherwise there can be a problems. ...
Hmm. My Manjaro install:

1. has the honour of being controlling grub on the MBR of the msdos-formatted /dev/sda (ie, BIOS setting is legacy boot)
2. is itself installed on a partition in gpt-formatted /dev/sdb

I don't recall having problems installing it in 2015.
Desktop: Intel i5-4460, 16GB RAM, Intel integrated graphics
Clevo N130WU-based Ultrabook: Intel i7-8550U (Kaby Lake R), 16GB RAM, Intel integrated graphics (UEFI)
ASUS X42D laptop: AMD Phenom II, 6GB RAM, Mobility Radeon HD 5400

User avatar
Buck Fankers
Forum Novice
Forum  Novice
Posts: 61
Joined: Sat Mar 10, 2018 9:06 pm

Re: Partially OT - parted -l equivalent without sudo

#8 Post by Buck Fankers » Tue Apr 03, 2018 7:08 am

asqwerth wrote: Hmm. My Manjaro install:
1. has the honour of being controlling grub on the MBR of the msdos-formatted /dev/sda (ie, BIOS setting is legacy boot)
2. is itself installed on a partition in gpt-formatted /dev/sdb
I don't recall having problems installing it in 2015.
Well, I never said, problem is guaranteed :p

Sometimes, when community was troubleshooting someones problem, this occasionally appeared as the culprit and it is generally not advised for beginner members.

Similarly with boot customizer. Occasionally it would cause the problem, although many said, works OK with me. Enough to suggest beginners to stay away from potential problems.

Back to original subject, I don't know if it is the same case for Debian or MX. But that script is just my little project, trying to learn some basic in Linux and working on my first baby steps in Python programming.

Anyone with EFI system could you show me, what is the output of this command:

Code: Select all

udevadm info /dev/sda |grep ID_PART_TABLE_TYPE

User avatar
richb
Administrator
Posts: 16625
Joined: Wed Jul 12, 2006 2:17 pm

Re: Partially OT - parted -l equivalent without sudo

#9 Post by richb » Tue Apr 03, 2018 7:21 am

Code: Select all

$ udevadm info /dev/sda |grep ID_PART_TABLE_TYPE
E: ID_PART_TABLE_TYPE=gpt
And for /sdd:

Code: Select all

udevadm info /dev/sdd |grep ID_PART_TABLE_TYPE
E: ID_PART_TABLE_TYPE=dos
Forum Rules
Guide - How to Ask for Help

Rich
SSD Production: MX 17.1
AMD A8 7600 FM2+ CPU R7 Graphics, 16 GIG Mem. Three Samsung EVO SSD's 250 GB, 350 GB HD

User avatar
Buck Fankers
Forum Novice
Forum  Novice
Posts: 61
Joined: Sat Mar 10, 2018 9:06 pm

Re: Partially OT - parted -l equivalent without sudo

#10 Post by Buck Fankers » Tue Apr 03, 2018 7:45 am

richb wrote: E: ID_PART_TABLE_TYPE=gpt
Thank you!
I got the 'dos' on my old system, but could not check the output for gpt/uefi.

Post Reply

Return to “General”